Repository navigation
[FIX] ProteinQuantifier: correctly split merged ID runs by origin file - #9658
Conversation
PeptideAndProteinQuant::readQuantData() for idXML input read the
per-PSM origin index from a mistyped meta key "id_merge_idx", which is
never set anywhere. IDMerger annotates the origin file index under
Constants::UserParam::ID_MERGE_INDEX ("id_merge_index"). As a result the
lookup always fell back to the default 0, so every PSM in a merged ID
run was attributed to the first origin file and the remaining
per-file samples were left empty.
Use the correct constant so merged idXML input (a single ID run with
several primary MS run paths) is split into one sample per origin file,
as already intended by ExperimentalDesign::fromIdentifications().
Adds a regression test that feeds a merged ID run with two origin files
through readQuantData()/quantifyPeptides() and checks that the two PSMs
land in two distinct samples.
Fixes #5518
Co-Authored-By: Claude Opus 4.8 <[email protected]>
Claude-Session: https://claude.ai/code/session_01AGp2wPBLyzAGNkcC6AGvMF
|
@timosachsenberg The following names might be missing from the
Please consider applying the following patch: --- AUTHORS 2026-06-25 05:11:39.515131892 +0000
+++ AUTHORS.new 2026-06-25 05:11:44.789830639 +0000
@@ -25,6 +25,7 @@
- Chris Bielow
- Christian Ehrlich
- Christie Mathews
+ - Claude
- Clemens Groepl
- Cornelia Friedle
- Daniel Jameson |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughPeptideAndProteinQuant now reads peptide merge indices from ChangesMerged ID merge-index handling
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 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 |
CI Failure AnalysisThe code fix itself is correct — the typo Why the two TOPP integration tests fail
The bug made every PSM fall back to origin file index 0, so all protein abundance counts piled into sample 1 with zero in samples 2 and 3. With the fix, PSMs are correctly spread across the three BSA samples. Concrete diff from CI (test 6, line 95, protein
The same pattern repeats for every quantified protein in both reference files — the total per-protein count is preserved (73+49+33 = 155), just correctly distributed. What needs to be doneThe reference files must be regenerated from the fixed code. Since a full local build wasn't available when the PR was created, this step was missed. To fix:
The reference update is straightforward once the binary is available — it's purely a consequence of the fix producing the correct values that the old reference doesn't reflect. Generated by Claude Code |
…al counts The fix correctly attributes each PSM in a merged ID run to its true origin file (via Constants::UserParam::ID_MERGE_INDEX) instead of collapsing all PSMs into the first origin file. ProteomicsLFQ's spectral_counting path (TOPP_ProteomicsLFQ_4 / _6) therefore now distributes protein spectral counts across the correct samples instead of piling them into sample 1. Update the two affected mzTab references to the corrected output. Only protein (PRT) abundance rows change; per-protein totals are conserved and merely redistributed across the 3 BSA samples, e.g. P02769|ALBU_BOVIN 91 -> 35/31/25 (test 4) and 155 -> 73/49/33 (test 6). MTD headers and PSM rows are unchanged. Co-Authored-By: Claude Opus 4.8 <[email protected]>
Documents PRs that landed after the last CHANGELOG update (#9656): - #9647 PIP-ECHO match-between-runs algorithm in ProteomicsLFQ - #9666 ProteomicsLFQ mzTab crash on non-string search settings - #9658 ProteinQuantifier wrong per-file split on merged ID runs (fixes #5518) - #9664 Math::quantile1st/3rd crash on 1–2 element inputs (fixes #9659) Claude-Session: https://claude.ai/code/session_01DYJ6LYHiJADSGjCkfBBJiN Co-authored-by: Claude <[email protected]>
Fixes #5518
Background
Issue #5518 asked for
ProteinQuantifierto support merged ID files directly (so workflows don't have to branch into two different merge strategies). In the thread, @jpfeuffer asked whether this is already handled by the internalPeptideAndProteinQuantalgorithm and whether exposing it in the standalone tool would be a small change.Digging in: the machinery is almost all there.
ExperimentalDesign::fromIdentifications()already expands a merged ID run's multiple primary MS run paths into one sample per origin file ("Due to merging it is valid to have multiple origins in a ProteinIDRun"), andPeptideAndProteinQuant::readQuantData()for idXML input contains a{identifier, merge_index} → MS filemapping intended to attribute each PSM back to its origin file.ProteinQuantifierroutes idXML input straight through that overload.The bug
The per-PSM origin lookup read a mistyped meta key:
IDMergerannotates the origin file index underConstants::UserParam::ID_MERGE_INDEX, whose value is"id_merge_index"(also consumed correctly under that name byIDRipper). The literal"id_merge_idx"appears nowhere else in the codebase — nothing sets it. So the lookup always fell back to the default0, and every PSM in a merged run was attributed to the first origin file, leaving the remaining per-file samples empty. The experimental design correctly created N samples, but all counts piled into sample 1.This went unnoticed because no test fed a merged idXML through this path.
The fix
Use the shared constant:
Unmerged input (a single primary MS run path) still resolves to index
0, so existing behavior is unchanged.Test
Adds a regression test in
PeptideAndProteinQuant_test.cppthat builds a merged ID run with two origin files (PSMs annotated withid_merge_index0 and 1), runsreadQuantData()/quantifyPeptides(), and asserts the two PSMs are split across two distinct samples. Without the fix both collapse into sample 0.Note
This was developed in an environment where a full OpenMS build/contrib toolchain isn't available, so I relied on CI to compile and run the test. The change is a one-line key correction plus a self-contained unit test; API usages were verified against the headers.
🤖 Generated with Claude Code
Generated by Claude Code
Summary by CodeRabbit
Bug Fixes
Tests