CRT: option to sample NTC null groups with replacement (as SCEPTRE does) - #16
Draft
maggiesychen wants to merge 1 commit into
Draft
maggiesychen wants to merge 1 commit into
maggiesychen wants to merge 1 commit into
Conversation
Add replace=False to make_ntc_groups_matched_by_freq / make_ntc_groups_ensemble, exposed as --ntc_replace, plus --max_ntc_groups to cap groups per ensemble. Without replacement, NTC guides are consumed as groups are built, so the null runs out after about n_ntc / --number_guide groups, and frequency-bin matching shrinks that further (e.g. ~200 NTC guides with 15 guides per target gave only 3-6 groups per ensemble). With replace=True each group is drawn without replacement but guides return to the pool, and identical groups are rejected, mirroring SCEPTRE's negative-control group construction (sample_combinations_v2, Katsevich-Lab/sceptre). With no cap, one group is built per real target. Default behavior is unchanged: replace=False reproduces the original groups exactly (checked against the unmodified function over 20 configurations). Co-Authored-By: Claude Opus 5.5 (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.
Builds on #13 (base:
crt-fixed-count-resampling).Why: Without replacement, NTC guides are used up as null groups are built, so the null runs out after about n_ntc /
--number_guidegroups, and frequency-bin matching cuts that further. With ~200 NTC guides and 15 guides per target we got only 3–6 null groups per ensemble.What:
replace=Falseoption onmake_ntc_groups_matched_by_freq/make_ntc_groups_ensemble, exposed as--ntc_replace. With it, each group is drawn without replacement, guides go back into the pool after each group, and identical groups are rejected. This follows SCEPTRE's negative-control group construction (sample_combinations_v2insrc/negative_control_functions.cpp, Katsevich-Lab/sceptre).--max_ntc_groupsto cap groups per ensemble. With--ntc_replaceand no cap, one group is built per real target (~10x the real-target CRT runtime at n_ensemble=10).CRT.sh/CRT_parallel.shcomments, runner-skill parameter references, CHANGELOG.tests/Script/Stage2_Evaluation/test_crt_ntc_replace.py.Default unchanged: with
replace=Falsethe groups are identical to the original code (checked over 20 configurations).One difference from SCEPTRE: groups are still matched to real-gene frequency-bin signatures, as elsewhere in this module.
Testing: new tests pass;
CRT.py --helpshows the new flags. Not yet run: the existingtest_crt_resampling.py, or CRT on real data with--ntc_replace.Note:
CRT.pyon this branch (and #13) imports the CRT package from a hard-coded path to ymo's checkout (line 28), which doesn't have #13's changes yet, so it fails withImportError: cannot import name 'OUTCOMES'from any other checkout. PR #14 on main already makes this path relative; merging main intocrt-fixed-count-resamplingshould fix it.🤖 Generated with Claude Code