Skip to content

CRT: option to sample NTC null groups with replacement (as SCEPTRE does) - #16

Draft
maggiesychen wants to merge 1 commit into
crt-fixed-count-resamplingfrom
msychen/crt-ntc-replace
Draft

maggiesychen wants to merge 1 commit into
crt-fixed-count-resamplingfrom
msychen/crt-ntc-replace

Conversation

@maggiesychen

Copy link
Copy Markdown

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_guide groups, 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=False option on make_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_v2 in src/negative_control_functions.cpp, Katsevich-Lab/sceptre).
  • --max_ntc_groups to cap groups per ensemble. With --ntc_replace and no cap, one group is built per real target (~10x the real-target CRT runtime at n_ensemble=10).
  • Docs: CRT README, CRT.sh / CRT_parallel.sh comments, runner-skill parameter references, CHANGELOG.
  • Tests: tests/Script/Stage2_Evaluation/test_crt_ntc_replace.py.

Default unchanged: with replace=False the 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 --help shows the new flags. Not yet run: the existing test_crt_resampling.py, or CRT on real data with --ntc_replace.

Note: CRT.py on 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 with ImportError: cannot import name 'OUTCOMES' from any other checkout. PR #14 on main already makes this path relative; merging main into crt-fixed-count-resampling should fix it.

🤖 Generated with Claude Code

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant