Fix args.reference_targets AttributeError in U-test fake-test path#4
Open
adamklie wants to merge 1 commit into
Open
Fix args.reference_targets AttributeError in U-test fake-test path#4adamklie wants to merge 1 commit into
adamklie wants to merge 1 commit into
Conversation
args.reference_targets is never defined on the argparse namespace; mirror
the real-test path's fallback (line 49) and use args.guide_annotation_key
instead. This is the correct reference-target list since the fake-test code
relabels NT guides to {'non-targeting', 'targeting'} before this call.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix
args.reference_targetsAttributeError in U-test fake-test pathSummary
Closes #2.
The U-test calibration's
compute_fake_perturbation_testscrashes immediately on the first call tocompute_perturbation_associationbecause line 160 passesargs.reference_targets, which is never defined on the argparse namespace. This makes--compute_fake_perturbation_testsunusable onmain.Change
One-line fix that mirrors the real-test path's fallback logic (lines 44–49). When
--guide_annotation_pathisn't provided, the real-test path falls back toargs.guide_annotation_key(default['non-targeting']); the fake-test path now does the same.In the fake-test code path, the relabeled NT subset has
guide_targets ∈ {'non-targeting', 'targeting'}(see line 149 where the 6 fake-targeting guides are flipped), soreference_targets=['non-targeting']is the correct reference set. Usingargs.guide_annotation_keymatches the real-test fallback and respects user override.Test plan
python U-test_perturbation_calibration.py --compute_fake_perturbation_tests --guide_annotation_path <tsv> --components 30 ... --sel_thresh 2.0end-to-end on a real dataset (Huangfu HUES8 endoderm differentiation, K=30,50,60,80,100,200,250,300, sel_thresh=2.0).<K>_fake_perturbation_association_results.txtfiles are written inEvaluation/<K>_<sel_thresh>/.Out of scope
Two adjacent issues spotted while debugging — filed/will file separately:
main()line 391:pd.concat([test_stats_real_df, test_stats_fake_df], ...)raisesNameErrorwhen--visualizationsis set without--compute_real_perturbation_tests.load_real_perturbation_tests()line 199: hardcoded['D0', 'D4', 'D7']sample names. Function is currently unreachable frommain()so harmless, but should be parameterized.🤖 Generated with Claude Code