Repository navigation
[FIX] FragmentIndex: replace the previous index on rebuild - #10350
Conversation
FragmentIndex::build() only cleared protein_lengths_. generatePeptides() and the fragment merge append to fi_peptides_ / fi_fragments_, so building twice on the same object kept the old peptides and fragments, and their (protein_idx, offset) coordinates were read against the new FASTA. A minimal probe goes from 1 to 2 peptides and 16 to 48 fragments. A build that throws (e.g. an entry over 65535 residues) also left isBuild() true with the previous index. build() now starts with clear(). ProSE's existing electron-ion rebuild already called clear() first and is unaffected. Split out of #10335. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Hgr7bpkMaiCg7A1F15yLjf
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (4)
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review. 📝 WalkthroughWalkthrough
ChangesFragmentIndex rebuild behavior
Suggested reviewers: Priority: ➖ Normal Change: Bug fix Merge Risk: ⚪ Minimal · up to The change prevents stale peptide and fragment data from surviving rebuilds and adds regression coverage for replacement and failure behavior. It is ready to merge subject to normal build and test checks. Security Architecture ReviewSecurity architecture risk: ⚪ Minimal · up to Rebuilding now discards stale index data and invalidates the previous index before processing new input. The change does not introduce a new input boundary, privilege, or dependency. No introduced or worsened material security risk was identified. Retained concerns Security review detailsSecurity Blast Radius
Trust Boundaries and Controls
Resilience and Maintainability Implications
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 3 files. (1 skipped: 1 unsupported.)
✨ Finishing Touches 💡 1📝 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. A rabbit checks the index anew Comment |
…10394) A peptide that occurs in several proteins was indexed once per occurrence. Its copies took several of the per-spectrum candidate slots (scoring:max_candidates_per_spectrum), and the runner-up was often the same peptide, so delta_score was 0 and the candidate-pool features counted copies. FragmentIndex gains peptide:deduplicate (default false): after peptide generation, exact modified peptides are collapsed to one representative coordinate, compared on the full peptidoform string (hashes only group candidates). SNES mother indices are unchanged. ProSE enables it by default; its PeptideIndexing step already recovers every protein mapping and the target/decoy label. Chunked searches additionally skip a peptide/charge/isotope hypothesis already scored in an earlier chunk. Split out of #10335 (0af4cf6); its index-rebuild part is in develop as #10350. The four ProSE idXML references gain the peptide:deduplicate search-parameter line; replaying the TOPP tests changes nothing else in them. Claude-Session: https://claude.ai/code/session_01D1N3pC2AqJt57Q3v87bWxz Co-authored-by: Claude Opus 5.5 <[email protected]>
Description
Split out of #10335. This is the independent bug fix from that PR, without its deduplication, scoring or filtering changes.
FragmentIndex::build()only clearedprotein_lengths_.generatePeptides()and the fragment merge append tofi_peptides_andfi_fragments_. Building twice on the same object therefore kept the old peptides and fragments, and their(protein_idx, offset)coordinates were read against the new FASTA. A build that throws, such as one with an entry over 65535 residues, also leftisBuild()true with the previous index.build()now starts withclear(). ProSE's existing electron-ion rebuild insearchWithModificationAnalysisalready callsclear()first, so it behaves the same as before. Every other caller builds a fresh index, so they are also unchanged.New test
[EXTRA] rebuilding replaces the previous peptide and fragment buffers:isBuild()falseChecklist
How it was tested. There was no full local build.
FragmentIndex.cpp,FragmentIndex_test.cpp,ProSEAlgorithm_test.cppand the test framework were compiled from this branch (GCC 13.3, C++23, OpenMP). They were linked againstlibOpenMS.sofrom nightly3.6.0-pre-nightly-2026-09-29, which was built from 55f7bdb and has an identicalFragmentIndex.h.FragmentIndex_testagainst the unmodified nightly library: the 55 existing sections pass. The new section fails with 2 peptides instead of 1 and 48 fragments instead of 16, which reproduces the bug.FragmentIndex_testwith this branch'sFragmentIndex.cpp: all 56 sections pass.ProSEAlgorithm_testwith this branch'sFragmentIndex.cpp: passes.LD_DEBUG=bindingsconfirms that libOpenMS's calls toFragmentIndex::buildresolved to the patched definition.🤖 Generated with Claude Code
https://claude.ai/code/session_01Hgr7bpkMaiCg7A1F15yLjf
Generated by Claude Code
Summary by CodeRabbit