Repository navigation
search: fragment-ion index for out-of-core searches, on by default — Comet parity on phospho (169 s vs 226 s, +9.6% PSMs) (#76) - #77
Conversation
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
|
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 (14)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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 |
|
Round 2 on the full file (same protocol):
K and the minimum match barely move identifications or time. The full-run profile explains why: ~70% of the index path was expanding peptidoforms into Peptide/Candidate objects (and freeing them), three passes per 15 Da chunk and again for every overlapping chunk; scoring was 3%. The last commit replaces that with an allocation-free walk over per-residue masses (same recursion, same form order and index) and widens slices to 150 Da so each record is expanded once per slice. Fixture output is unchanged; full-file timing on that build is queued. |
|
Pruned, mass-ordered index (commit e57a21f8), full phospho file, 32 threads, production defaults, Percolator 3 seeds:
Comet parity on time is reached (andes is 25% faster wall-to-wall including the 24 s calibration pre-pass) with +9.6% PSMs and +12.4% phospho PSMs at a third less measured error. What did it: the mass-bounded walk visits only in-window forms (the previous build enumerated every form of every reachable record and discarded ~97% afterwards), and mass-ordered form ids turn the per-bin sort into an integer sort and the precursor window into an id range. Profile now: bounded walk 28%, GBDT 12%, scoring closure 9%, record scan 9%, sorts 12%. Remaining memory cost is the 150 Da slice (~1G ion entries); an adaptive slice width against the #68 budget is the next housekeeping item. |
|
Production defaults, no index flags (commit 3a4a24a3): the memory budget picks mmap, |
|
VM head-to-head (8 threads, 31 GB, same mzML, Percolator seed 1), andes at 23530049 with the budget-derived slice width (77 Da here):
Same PIN rows as the cluster run (912,747), so identical identifications; the enumeration path on this VM took 45,255 s. The raw→mzML conversion Comet needs costs another 577 s on this machine. |
…s, flag-gated (#76) Milestones 1 and 2 of workstream C. With --fragment-index-top-k K the chunk's peptidoforms are enumerated once, their singly-charged b/y ions binned at twice the fragment tolerance, and each spectrum's peaks vote for forms within its precursor windows; forms with at least --fragment-index-min-matched votes (default 3), at most K, are materialised and scored by the unchanged path. Off by default and byte-identical when off. Judged on identifications and entrapment FDP.
A chunk in file order spans the whole precursor mass range, so its per-chunk index was the whole database (100 GB on phospho). In fragment-index mode the binary collects the stream, sorts spectra by precursor mass, and scores mass-ordered chunks; each chunk's index then covers a narrow mass range.
Its sample spans every precursor mass, so a per-chunk index over it is the whole database.
…; 64-bit CSR offsets (#76) A record reachable through one modification offset carries dozens of forms at other masses; indexing them all put one mass-ordered chunk past 2^32 ion entries and overflowed the 32-bit bin offsets.
… mode, size logging (#76) The build held every in-window form's ion list before packing, tens of millions of forms on a phospho chunk. It now counts in one pass and writes packed entries in a second, logs records/forms/entries per chunk, and index-mode chunks are 1,000 spectra.
…l as count (#76) 1,000 high-mass phospho spectra spanned 450 Da; that window held 39.7M peptidoforms and 3.3G ion entries.
… 150 Da index slices (#76) A full-run profile put ~70% of the index path in expanding peptidoforms into Peptide/Candidate objects and freeing them, three passes per 15 Da chunk and again for every overlapping chunk. for_each_form_masses walks the same recursion as expand_mod_combinations, in the same order with the same k, but yields per-residue masses without allocating; the index build computes masses and b/y ions from those. Slices are now 150 Da / 20,000 spectra, so each record is expanded once per slice.
…ent index (#76) The lean build still walked every form of every reachable record and discarded those outside the slice window afterwards (28% of the run), and sorted ~1G ion entries per slice by an indirect mass lookup (22%). Variable modifications only add mass, so the walk now prunes subtrees by running sum plus the min/max of the remaining positions; the build and materialisation share that walk, so the pruned index k selects the same form on both sides. Form ids are assigned in ascending mass order, so a bin sorted by id is sorted by mass and the per-bin sort is an integer sort; the query narrows the precursor window to an id range.
…idate index is out-of-core (#76) auto (default) turns the fragment-ion index on when --candidate-index resolves to mmap and neither --chimeric, --refine nor --glyco is active; searches that fit in RAM are untouched. on warns and falls back to enumeration when the index is in RAM. The equivalence gates pass --fragment-index off explicitly: they are about the enumeration paths agreeing, and the index changes the candidate set by design.
Measured on the phospho space: a 150 Da slice peaks at ~25 GB RSS, about 0.13 GB per Da over a ~5 GB base. The width is now derived from the #68 budget (10-150 Da) so a 31 GB machine gets ~60 Da; --fragment-index-slice-da overrides it.
- pruned form index widened from u16 to u32: a 50-residue peptide with ~30 modifiable sites and four slots exceeds 65,535 forms, and truncation would materialise the wrong form - the per-record expansion cache is not built in index mode (materialise never reads it; ~3.5% of the run and up to 4M cached candidates) - record_span / expand_base_record bounds-check the protein index - the precursor-mass sort uses total_cmp - the index test compares modification-aware peptidoforms
b8faa51 to
e59a7b3
Compare
Stacked on #74 (base
perf/mod-handle-no-atomic). Workstream C for #76: the fragment-ion index, now on by default whenever a search goes out-of-core.What it does
--fragment-index auto|on|off(defaultauto): when--candidate-indexresolves tommap(and neither--chimeric,--refinenor--glycois active), spectra are sorted by precursor mass and scored in slices of ≤ 150 Da / ≤ 20,000 spectra. For each slice the peptidoforms inside its precursor window are enumerated once with a mass-bounded walk, their singly-charged b/y ions are binned at the fragment tolerance, and each spectrum's peaks vote for forms inside its own precursor windows. Forms with ≥ 3 matched ions, at most 100 (--fragment-index-top-k), are materialised and go through the unchanged scoring, feature and PIN path. Searches that fit in RAM are untouched;--fragment-index offreproduces enumeration byte for byte.Result — PXD007653 phospho, full file, same 32-core node, production defaults, Percolator 3 seeds
Comet parity on time, +9.6% PSMs and +12.4% phospho PSMs at a third less measured error. Search phase 123 s (~830 spectra/s).
What the measurements on the way taught (each in its commit)
Peptide/Candidateobjects per form was ~70% of the first index build; walking per-residue masses instead, and pruning the walk by mass bounds (variable mods only add mass), took the search from 1,167 s to 169 s. Mass-ordered form ids turn the per-bin sort into an integer sort.Gates
cargo test --workspace1,111 passed; the four ignored RAM/mmap equivalence gates pass (they run with--fragment-index off, being about the enumeration paths); two in-crate tests pin that the index ranks the true peptide first on exact spectra and that the bounded walk's index selects the same form on build and materialisation.Not yet
Proteinsrepeats) are not reproduced in index mode.--candidate-index mmapon them is not measured.