Repository navigation
search: choose the out-of-core retrieval strategy automatically, and say which one (#76) - #84
Conversation
…say which one (#76) The fragment-ion index was selected for any out-of-core search. Measured on the standard sets by forcing it on (8 threads, Percolator seed 42), that is wrong on low-resolution data: TMT 12,281 -> 3,613 PSMs @1% and UPS1 15,838 -> 10,312, both while running slower, because the index bins ions at the fragment tolerance and a 0.5 Da bin does not discriminate. No benchmark hit this because the low-res sets fit in RAM, but a large low-res search would have. Selection now requires out-of-core AND high-resolution fragment matching, is made by one testable function, and is reported in a single line naming the reason. --fragment-index becomes a hidden escape hatch for reproducing a measurement rather than a user-facing knob, and its DOCS row is replaced by a note on the automatic behaviour. The Astral row in that measurement (38,394 -> 46,774) is not a win and is documented as such: top-1 decoy wins fall 9.4% against 1.8% for targets, so the decoy competition is biased and the q-values are optimistic. Astral has no entrapment component to catch it; where the index is selected, the phospho entrapment FDP goes down rather than up.
|
Warning Review limit reachedNext included review available in 59 minutes. View limit detailsLimit details: You’ve used the included review currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Review configuration: ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (4)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
PR Summary by QodoAutomatically select and report out-of-core candidate retrieval
AI Description
Diagram
High-Level Assessment
Files changed (4)
|
Code Review by Qodo
1. Enumeration is reported as indexed
|
| let high_res = match fragment_tol { | ||
| Tolerance::Ppm(_) => true, | ||
| Tolerance::Da(d) => d <= 0.05, |
There was a problem hiding this comment.
1. Wide ppm searches use wrong retrieval 🐞 Bug ≡ Correctness
retrieval_choice equates every Tolerance::Ppm with high resolution without considering its numeric width, although Tolerance::as_da scales ppm by fragment mass. For metadata-less MGF input, any finite positive --fragment-tol-ppm is accepted, so an out-of-core search at 1000 ppm (1 Da at m/z 1000) enables the nonselective fragment-ion shortlist instead of enumeration.
Agent Prompt
## Issue description
Every ppm tolerance is currently classified as high resolution, even when its effective fragment-mass window is too wide for selective fragment-ion retrieval.
## Fix Focus Areas
- crates/andes/src/bin/andes/search.rs[75-78]
- crates/andes/src/bin/andes/search.rs[2047-2125]
## Recommended Fix
Apply an explicit maximum supported ppm tolerance based on the index's selectivity criterion instead of treating the unit alone as proof of high resolution. Keep enumeration above that limit and add boundary tests, including a very wide ppm value.
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
| if choice.use_index { | ||
| eprintln!( | ||
| "candidate retrieval: fragment-ion index ({reason}; {} candidates per spectrum, \ | ||
| >= {} matched b/y ions)", |
There was a problem hiding this comment.
2. Enumeration is reported as indexed 🐞 Bug ◔ Observability
params.fragment_index_top_k preserves an explicit zero while choice.use_index remains true, and the new message chooses its label only from choice.use_index. On an out-of-core high-resolution run with --fragment-index-top-k 0, downstream > 0 checks take full enumeration but stderr says “fragment-ion index ... 0 candidates,” misleading benchmark records and operators.
Agent Prompt
## Issue description
A zero fragment-index shortlist disables the downstream index while the new strategy report still claims indexed retrieval.
## Fix Focus Areas
- crates/andes/src/bin/andes/search.rs[754-769]
- crates/andes/src/bin/andes/cli.rs[203-207]
## Recommended Fix
Validate `--fragment-index-top-k` as nonzero before retrieval starts, returning a clear argument error for zero. Add a test proving that zero cannot reach the indexed reporting branch.
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
…strategy table Astral 38,394 and UPS1 15,838 are identical to the in-RAM counts and TMT is within 0.3%, so the out-of-core path preserves identifications and everything the index column does belongs to the index.
Stacked on #83 (docs). Removes the retrieval knob and makes the engine choose correctly, which it was not doing.
The defect this fixes
--fragment-index autoselected the fragment-ion index for any out-of-core search. It never looked at fragment resolution. Measured on the three standard sets, same binary, 8 threads, Percolator seed 42, forcing the index on:On low-resolution data the index loses most of the identifications and runs slower: it bins ions at the fragment tolerance and ranks candidates by peak votes, and a 0.5 Da bin does not discriminate. No benchmark caught this because both low-res sets fit in RAM and so never took the out-of-core path — but a large low-resolution search (a PTM-rich ion-trap run, say) would have hit it silently.
The Astral row is not a win and is documented as not being one. A candidate filter cannot create identifications. The top-1-per-scan competition shows the mechanism: decoy wins fall 9.4% while target wins fall 1.8%, so decoys leave the competition preferentially and the decoy-based q-values become optimistic. Astral has no entrapment component to detect that. Where the index is selected, the phospho benchmark measures error with a 1:1 entrapment database and it goes down (1.22–1.32% → 1.15–1.16%), which is why that result stands.
What changes
retrieval_choice, with eight unit tests covering every branch including the two refusals.candidate retrieval: fragment-ion index (out-of-core index, high-resolution fragments at 20 ppm; 100 candidates per spectrum, >= 3 matched b/y ions)orcandidate retrieval: per-spectrum enumeration (out-of-core index, but low-resolution fragment matching — the fragment-ion index is not selective at a 0.5 Da tolerance). In-RAM searches say nothing, because there is no choice to report.--fragment-indexbecomes hidden. It stays as an escape hatch for reproducing a measurement (the benchmark README usesoffto reproduce the enumeration rows), but it is out of--helpand its DOCS row is replaced by a note describing the automatic behaviour. Forcingonwhere the index cannot be used now refuses with the reason instead of silently doing nothing.Proteinscolumn.Verification
cargo test --workspace1,121 passed (8 new), clippy at-D warnings, and the four ignored out-of-core equivalence gates pass. Behaviour checked end to end on the fixture: high-res out-of-core selects the index, low-res out-of-core selects enumeration and says why, forcingonat low resolution is refused, and an in-RAM run prints nothing.