Skip to content

[FIX] IDConflictResolverAlgorithm: an identification without hits is never a feature's best - #10444

Merged
timosachsenberg merged 1 commit into
developfrom
fix/idconflictresolver-empty-ids-lower-is-better
Oct 8, 2026
Merged

timosachsenberg merged 1 commit into
developfrom
fix/idconflictresolver-empty-ids-lower-is-better

Conversation

@timosachsenberg

@timosachsenberg timosachsenberg commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

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:

  • default mode (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 with getHits()[0] (out of bounds).

compareIDsSmallerScores_ orders identifications without hits first. max_element (higher is better) therefore never returns one, but min_element (lower is better) does.

Change

  • src/openms/source/ANALYSIS/ID/IDConflictResolverAlgorithm.cpp: the lower-is-better branch of both functions uses lowerScoreFirst, which orders identifications without hits last (strict weak ordering as before). The higher-is-better branch is unchanged.
  • IDConflictResolverAlgorithm_test: new section for resolve(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.
  • CHANGELOG entry.

Validation

  • The fixed files are identical to the ones tested on 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 in TOPP_IDConflictResolver_3 once the input's hit-less identifications took the map's q-value score type.
  • Both changed files compile against develop (097bad2). No TOPP expected output on develop changes: 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

  • Bug Fixes
    • Corrected identification selection when lower scores are better. Features now retain an identification with hits instead of losing those hits to the unassigned list.
    • Prevented missing-hit access when keeping matching identifications.

…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
@coderabbitai

coderabbitai Bot commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 1430a997-f220-4f03-9e1f-cad8ab242a5e
📥 Commits

Reviewing files that changed from the base of the PR and between 097bad2 and 1fcf7ca.

📒 Files selected for processing (3)
  • CHANGELOG
  • src/openms/source/ANALYSIS/ID/IDConflictResolverAlgorithm.cpp
  • src/tests/class_tests/openms/source/IDConflictResolverAlgorithm_test.cpp

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

The 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 keep_matching settings, and the changelog records the fix.

Changes

ID conflict resolution

Layer / File(s) Summary
Lower-score selection and validation
src/openms/source/ANALYSIS/ID/IDConflictResolverAlgorithm.cpp, src/tests/class_tests/openms/source/IDConflictResolverAlgorithm_test.cpp, CHANGELOG
Both lower-score resolution branches now use an ordering that places identifications with hits before hitless identifications. Tests cover both score directions and both keep_matching settings. The changelog describes the fix.

Suggested reviewers: cbielow

Priority: ➖ Normal

Change: Bug fix · Severity of issue fixed: Medium

Merge Risk: ⚪ Minimal · up to 1fcf7

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)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning 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… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the fix in IDConflictResolverAlgorithm and accurately states the main behavior change: an identification without hits must not be selected as a feature's best identificati…
Linked Issues check ✅ Passed Issue #10443 requires lower-is-better resolution to prefer hit-bearing identifications in both conflict modes, while preserving higher-is-better behavior, and requires tests for both score directions …
Out of Scope Changes check ✅ Passed The changed implementation directly fixes issue #10443. The added test verifies the required behavior. The changelog entry documents the fix. No unrelated change appears in the reviewed pull-request s…
Full details: Docstring Coverage

Explanation

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.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

❤️ Share

A rabbit checks the scores in line
Hit-bearing IDs rank just fine
PEPTIDEK stays in view
Tests check the other score path too
The changelog marks the fix as done

Comment @coderabbitai help to get the list of available commands.

@timosachsenberg
timosachsenberg merged commit 50f4b61 into develop Oct 8, 2026
14 checks passed
@timosachsenberg
timosachsenberg deleted the fix/idconflictresolver-empty-ids-lower-is-better branch October 8, 2026 07:55
timosachsenberg added a commit that referenced this pull request Oct 8, 2026
…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]>
timosachsenberg added a commit that referenced this pull request Oct 8, 2026
…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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

IDConflictResolver: with lower-is-better scores, an identification without hits is kept as a feature's best

3 participants