Repository navigation
[FIX] IDConflictResolverAlgorithm: an identification without hits is never a feature's best - #10444
Conversation
…never a feature's best With lower scores better, resolve() picked an identification without hits as the best of a feature: compareIDsSmallerScores_ orders those first, which max_element (higher is better) passes over but min_element takes. The feature then kept an empty identification and lost its hits to the unassigned list; with keep_matching, the empty winner's first hit was read out of bounds. Lower-is-better selection now orders identifications without hits last. The new IDConflictResolverAlgorithm_test section covers both directions and both modes and fails without the fix. Fixes #10443 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01B51nRFoHvZuVXD7cT8XZav
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (3)
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 0 remain after this review. 📝 WalkthroughWalkthroughThe resolver now ranks identifications with hits ahead of hitless identifications when lower scores are better, then compares first-hit scores. Both lower-score resolution branches use this ordering. Tests cover both score directions and ChangesID conflict resolution
Suggested reviewers: Priority: ➖ Normal Change: Bug fix · Severity of issue fixed: Medium Merge Risk: ⚪ Minimal · up to Lower-is-better selection now prefers identifications with hits in both conflict modes. The unchanged all-hitless edge case leaves no actionable merge-blocking risk introduced by this PR. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 75.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 2 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 scores in line Comment |
…t data; remove unused fixtures (#10446) * Test data: remove six unused feature maps AssayGeneratorMetabo_decoy_generation_input (and _1, _2, _multids), AssayGeneratorMetabo_intsort_input and RawTandemMSSignalSimulation_no_ms2 are not used by any test (the simulator is gone). Their identifications had no score type. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01B51nRFoHvZuVXD7cT8XZav * OpenSWATH and AccurateMassSearch: record the score type of their identifications Both wrote peptide identifications without a score type, so readers could not tell what the hit scores mean. (The owning identification model of #10423 also requires a named score for every PSM.) - MRMFeatureFinderScoring (OpenSwathAnalyzer, OpenSwathWorkflow, ...): the hit score is the feature's preliminary LDA score; the identification now says so (score type xx_lda_prelim_score, higher is better; xx_swath_prelim_score or OverallQuality when one of those is used instead). - AccurateMassSearchEngine, feature/consensus annotation: hits scored 0. They now carry the m/z error in ppm, with the score type MassErrorPPMScore (lower is better). The placeholder hit of an unmatched mass (keep_unidentified_masses) keeps 0, as it has no m/z error. Expected outputs and inputs that stand for these tools' output change only in the score type, direction and (AccurateMassSearch) hit scores of their identifications: OpenSwathAnalyzer_{1,2,5,6,7,8,9,10,11}_output, AccurateMassSearch_2_output, AccurateMassSearchEngine_output1 (featureXML, consensusXML), OpenSwathFeatureXMLToTSV_input and OpenSwathConfidenceScoring_1 _output (hit score = main_var_xx_lda_prelim_score in all features), MRMFeatureSelector_..._reduced (likewise, 210 features) and AssayGeneratorMetabo_ams_input (hit score = its mz_error_ppm value). Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01B51nRFoHvZuVXD7cT8XZav * Test data: a score type for every peptide identification; IDFileConverter: rank as the score of TSV hits Peptide identifications without a score type leave their scores without meaning, and the owning identification model of #10423 rejects them. Every peptide identification in the test data now has one (59 files): - maps mixing typed and untyped identifications take the type and direction of the typed ones: score_type (lower is better) in the FeatureLinker and TextExporter_6 inputs and outputs, q-value (lower) in IDConflictResolver_3, bla (higher) in TextExporter_1; - IDMerger_2_input2 (from protXML) takes what ProtXMLFile writes today: ProteinProphet probability (higher); - hand-made fixtures without any type (MapAligner*, ProteinQuantifier*, IDMapper*, IDSplitter_1, FeatureLinkerUnlabeledQT_5/6, FileInfo_3, DatabaseFilter_1, MzTabExporter_3, QuantIDMapper_1) take the neutral "score" with their direction unchanged; their scores have no stated meaning. Inputs and the expected outputs computed from them change together: - IDConflictResolver_3: with its map's score type (q-value, lower is better) the feature with two candidates keeps the lower q-value (0.1329), as it should since #10444; the expected output changes only in that feature's identification and the order of the unassigned ones. - TextExporter_1 (score type column of the unassigned peptide, now "bla") and ProteinQuantifier_9's mzTab (psm_search_engine_score "Epifany score") print the new score types. IDFileConverter's TSV import wrote hits without scores. The hits of a line are given in rank order, so their score is now their rank (score type "rank", lower is better); IDFileConverter_11_output changes accordingly. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01B51nRFoHvZuVXD7cT8XZav * Test data: score types in the pyOpenMS copies of the ProteinQuantifier inputs src/pyOpenMS/tests/unittests/ProteinQuantifier_input.{featureXML,consensusXML} are copies of the class test fixtures of the same name and still had peptide identifications without a score type. They take the fixed fixtures (score type "score", direction unchanged); nothing else differs. test_FileInfo and test_PeptideAndProteinQuant read them. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01B51nRFoHvZuVXD7cT8XZav * AccurateMassSearch: score hits by the absolute m/z error (MassErrorAbsPPMScore) The hits of feature and consensus map annotations scored the signed m/z error in ppm with lower scores better, so a hit 4.6 ppm below the theoretical m/z beat one 1.6 ppm below it. They now score the absolute error, with the score type MassErrorAbsPPMScore (lower is better); the signed error stays in the meta value mz_error_ppm. MassErrorPPMScore keeps naming the signed error, as in the mzTab and mzTab-M output. Expected outputs: AccurateMassSearch_2_output, AccurateMassSearchEngine_ output1 (featureXML, consensusXML) and the fixture AssayGeneratorMetabo_ ams_input change only in the score type and the sign of negative scores. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01B51nRFoHvZuVXD7cT8XZav --------- Co-authored-by: Claude <[email protected]>
…test data (#10446), IDConflictResolver fix (#10444) Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01B51nRFoHvZuVXD7cT8XZav
…10445) * [FIX] Guard all-hitless identifications in keep_matching resolution Return before accessing the winning hit when every identification is hitless. Preserve those identifications and their metadata without moving them to the unassigned list. Leave score-direction selection and default resolution unchanged. Add regression coverage for FeatureMap and ConsensusMap, both score directions, and zero, one or several hitless identifications. Follow-up to #10444. * [DOC] Document all-hitless keep_matching resolution
Fixes #10443.
Problem
With lower-is-better scores (q-values, PEPs, E-values),
IDConflictResolverAlgorithm::resolve()picked an identification without hits as a feature's best whenever the feature carried one:resolveConflict_): the feature kept the empty identification and its real hits were moved to the unassigned peptide identifications;keep_matching(resolveConflictKeepMatching_): the empty winner's first hit was then read withgetHits()[0](out of bounds).compareIDsSmallerScores_orders identifications without hits first.max_element(higher is better) therefore never returns one, butmin_element(lower is better) does.Change
src/openms/source/ANALYSIS/ID/IDConflictResolverAlgorithm.cpp: the lower-is-better branch of both functions useslowerScoreFirst, which orders identifications without hits last (strict weak ordering as before). The higher-is-better branch is unchanged.IDConflictResolverAlgorithm_test: new section forresolve(FeatureMap&, keep_matching)covering both score directions and both modes (a feature with two hit-less identifications and two scored ones); it fails without the fix.Validation
refactor/identificationdata-native-followups(stacked on Introduce owning IdentificationData and native Parquet persistence #10423), where the new test section fails without the fix and passes with it, and the full test suite passes (apart from the CometAdapter comparisons that need OpenTIMS, unrelated). There it showed up inTOPP_IDConflictResolver_3once the input's hit-less identifications took the map's q-value score type.develop(097bad2). No TOPP expected output ondevelopchanges: its IDConflictResolver inputs that mix hit-less identifications select through the higher-is-better branch.🤖 Generated with Claude Code
https://claude.ai/code/session_01B51nRFoHvZuVXD7cT8XZav
Generated by Claude Code
Summary by CodeRabbit