Repository navigation
[FIX] ConsensusMapMergerAlgorithm: throw instead of segfault when there are no ID runs to merge - #10618
Conversation
…re are no ID runs to merge mergeAllIDRuns() returned early only for exactly one protein identification run. With none, it fell through to getProteinIdentifications()[0] to take the merged run's search settings from, reading past the end of the empty vector. ProteomicsLFQ, ProteinInference, Epifany and MS1LabeledWorkflow call it before protein inference, so such a ConsensusMap made them segfault without any hint at the cause. That is how ProteomicsLFQ crashed on FAIMS data while FeatureOverlapFilter::mergeFAIMSFeatures still dropped the runs (fixed in #10001; reported downstream as bigbio/quantms#741). Throw Exception::MissingInformation instead, as BayesianProteinInferenceAlgorithm::inferPosteriorProbabilities already does for the same condition, so the TOPP tools exit with an error message. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01PK6GmaArNt5uUyNHYwEBT8
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Priority: ➖ Normal Change: Bug fix · Severity of issue fixed: Medium Merge Risk: ⚪ Minimal · up to
|
timosachsenberg
left a comment
There was a problem hiding this comment.
Reviewed 94289f04 for substantive regressions. No new actionable findings. The empty-run guard executes before both first-run dereferences, preserves the existing single-run fast path, and has a targeted exception regression test. Build and Test and the pyOpenMS wheel workflow passed on this head. Review was static; I did not build locally.
|
Correct |
…#10301, #10611, #10606, #10608, #10609, #10617, #10610, #10578 ProSE Percolator rescoring, #10628) Only CHANGELOG conflicted; both entries are kept. Develop's changes to FalseDiscoveryRate, IDScoreGetterSetter, ConsensusMapMergerAlgorithm, FileInfo and ProSE work on the established classes, which this branch keeps as they are. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01B51nRFoHvZuVXD7cT8XZav
#10612, #10301, #10578 ProSE, #10628) Develop's changes to the map-level identification code are ported to identification data: - FalseDiscoveryRate::applyBasicPeptideLevel(ConsensusMap&) (#10617): in the scope, an identification keeps its best match and the matches tied with it whose peptide has an FDR; the others are removed (they would keep their search score under the FDR score type). Without decoys it keeps only targets, and nothing if its best match is not a target, as before. The best match is the first of the best score, as develop's sort makes it; q-values on a map were already lower-is-better (the FDR score definition). Develop's two test sections are rewritten for identification data. - ConsensusMapMergerAlgorithm::mergeAllIDRuns() (#10618) throws Exception::MissingInformation for a map without runs. Identification data has no identification without its run, so the test uses a map without identifications. - FileInfo (#10612) counts the occurrences per map id on the linked identifications (auto-merged). - IsobaricWorkflow_hyperscore_peptide_out.consensusXML (#10617): one identification whose best match is a decoy loses its matches, as on develop; develop leaves it the score type of the search (hyperscore, higher is better), identification data the score type of its run (peptide q-value). Features, matches and values are the same as develop's. - FeatureFinderIdentificationAlgorithm_test (#10628): the peptide identifications of the new section have a score type and scores, which the conversion to identification data needs. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01B51nRFoHvZuVXD7cT8XZav
Description
ConsensusMapMergerAlgorithm::mergeAllIDRuns()returned early only when there was exactly one protein identification run. With zero runs it fell through togetProteinIdentifications()[0], where it reads the search settings for the merged run, and read past the end of the empty vector. ProteomicsLFQ, ProteinInference, Epifany and MS1LabeledWorkflow all call it before protein inference, so such a ConsensusMap made them segfault with no hint at the cause.That is how ProteomicsLFQ crashed on FAIMS data while
FeatureOverlapFilter::mergeFAIMSFeaturesstill dropped the runs: exit 139 right after "Size of consensus fraction". #10001 fixed the cause; the crash was reported downstream as bigbio/quantms#741, where it still occurs with the2026.07.02container.This PR makes the function throw
Exception::MissingInformationinstead, the same wayBayesianProteinInferenceAlgorithm::inferPosteriorProbabilitiesalready does for this condition. The TOPP tools then exit through TOPPBase's handler withError: Unexpected internal error (The ConsensusMap has no protein identification runs to merge. ...)andUNKNOWN_ERROR, not a segfault. Behaviour changes only for input that crashed before, so no previously working input is affected.Changes:
ConsensusMapMergerAlgorithm.cpp: guard against an empty run list before thesize() == 1early return.ConsensusMapMergerAlgorithm.h: document the new@throwscase.ConsensusMapMergerAlgorithm_test.cpp: new sectionmergeAllIDRuns (no IdentificationRuns), a ConsensusMap with a PSM whose run is missing.CHANGELOG: one FIX entry.Verification (local, Release build, GCC 13)
ConsensusMapMergerAlgorithm_testConsensusMapMergerAlgorithm.cpp(control)ctest -R ConsensusMapMergerAlgorithm_test)TOPP tests were not built locally.
Found along the way, not changed here
The existing section
mergeProteinsAcrossFractionsAndReplicatesasserts the order of the merged runs' file lists (BSA1_F1beforeBSA1_F2).ConsensusXMLHandlergives each loaded run the identifier<engine>_<date>_<UniqueIdGenerator id>, andmergeProteinIDRunsorders by that identifier (std::map). Runs with the same date, as inBSA.consensusXML, are therefore ordered by the random part. The test is deterministic only because of the fixed test seed and the number of ids drawn before it. A first version of the new section loadedBSA.consensusXMLtoo, and that alone swapped F1/F2 in the later section. The new section therefore builds its map by hand and draws no ids. In production, with a time-based seed, this means the file order of the merged run can differ between executions for runs with equal dates (id_merge_indexstays consistent).Checklist
No signatures changed and
mergeAllIDRunsis not bound in pyOpenMS, so no binding updates were needed. AUTHORS left for a maintainer to decide.Generated by Claude Code
Summary by CodeRabbit