Skip to content

[FIX] IsobaricWorkflow: precursor purity tolerance was truncated to 1 ppm - #10448

Merged
timosachsenberg merged 2 commits into
developfrom
claude/intelligent-johnson-tk7099
Oct 8, 2026
Merged

timosachsenberg merged 2 commits into
developfrom
claude/intelligent-johnson-tk7099

Conversation

@timosachsenberg

@timosachsenberg timosachsenberg commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Bug

getPurities_() in src/topp/IsobaricWorkflow.cpp declared max_precursor_isotope_deviation as bool, while the call site passes the double read from -extraction:precursor_isotope_deviation (default 10 ppm). The implicit conversion turned every non-zero setting into true, so PrecursorPurity::computeSingleScanPrecursorPurities / computeInterpolatedPrecursorPurity ran with a 1 ppm isotope tolerance and a 1 ppm fuzzy border of the isolation window, whatever the user set. The precursor purities IsobaricWorkflow reports (precursor_purity, quant_precursor_purity, and the MS3 average) were therefore computed at the wrong tolerance; on real data that undercounts isotope peaks of the precursor and reports purities that are too low. IsobaricAnalyzer is not affected (it goes through IsobaricChannelExtractor, which keeps the double).

Fix

One line: the parameter is a double.

Test

The existing IsobaricWorkflow fixtures cannot detect this: in TMTTenPlexMethod_test.mzML every isolation window holds only the precursor peak, so the purity is 1.0 at any tolerance and all existing references stay unchanged (verified by recomputing them at 1 ppm and 10 ppm).

New test TOPP_IsobaricWorkflow_purity_tolerance: the same run on IsobaricWorkflow_purity_in.mzML, a copy of the fixture whose MS1 carries one extra peak 0.004 Th above the strict upper border of scan 24217's isolation window, with twice the precursor's intensity. At the default 10 ppm the fuzzy border is 0.0077 Th at m/z 769, the peak counts half into the total intensity and the purity is 0.5; at 1 ppm (0.00077 Th) it lies outside and the purity is 1.0. The other four scans keep purity 1.0.

The reference IsobaricWorkflow_purity_out.consensusXML is IsobaricWorkflow_1_out.consensusXML with the file name and that one feature's two purity values adjusted. I could not build OpenMS in this environment, so the expected 0.5 comes from a line-by-line port of computeSingleScanPrecursorPurities run on the new fixture (and the port reproduces the 1.0 of the existing references at both tolerances). The value is exact in float arithmetic (I / (I + 0.5 × 2I)), so FuzzyDiff tolerances are not involved. CI will confirm.

Also added a CHANGELOG entry under TOPP tools.

🤖 Generated with Claude Code

https://claude.ai/code/session_0116xbaQQJpHtmofZc5FirfT


Generated by Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Precursor purity calculations now honor the configured precursor isotope deviation in ppm for isotope matching and the isolation-window boundary. Previously, nonzero values could be treated as 1 ppm; the default is 10 ppm.
  • Tests
    • Added regression coverage for precursor purity calculations using a 10 ppm deviation setting.

timosachsenberg and others added 2 commits October 8, 2026 14:19
getPurities_() declared max_precursor_isotope_deviation as bool, and the
call site handed it the double read from -extraction:precursor_isotope_deviation
(default 10 ppm). The conversion turned every non-zero setting into true, so
PrecursorPurity ran with a 1 ppm isotope tolerance and a 1 ppm fuzzy border
of the isolation window, whatever the user set.

The existing IsobaricWorkflow fixtures cannot see this: their isolation
windows hold only the precursor peak, so the purity is 1.0 at any tolerance
and the references stay as they are. The new TOPP_IsobaricWorkflow_purity_tolerance
test runs the same input on a copy of the mzML whose MS1 has one extra peak
0.004 Th above the strict upper border of scan 24217's isolation window with
twice the precursor's intensity: at 10 ppm the fuzzy border (0.0077 Th at
m/z 769) counts it half, purity 0.5; at 1 ppm it is outside, purity 1.0.
The reference is IsobaricWorkflow_1_out.consensusXML with the file name and
that one feature's purities adjusted; the purity was recomputed for the
fixture with a line-by-line port of PrecursorPurity::computeSingleScanPrecursorPurities.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_0116xbaQQJpHtmofZc5FirfT
@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: 7fb08ec1-43d6-4773-b9c8-4b0f718edb62
📥 Commits

Reviewing files that changed from the base of the PR and between 03703a7 and 605934f.

⛔ Files ignored due to path filters (1)
  • src/tests/topp/IsobaricWorkflow_purity_design.tsv is excluded by !**/*.tsv
📒 Files selected for processing (5)
  • CHANGELOG
  • src/tests/topp/CMakeLists.txt
  • src/tests/topp/IsobaricWorkflow_purity_in.mzML
  • src/tests/topp/IsobaricWorkflow_purity_out.consensusXML
  • src/topp/IsobaricWorkflow.cpp

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


📝 Walkthrough

Walkthrough

IsobaricWorkflow now passes precursor isotope deviation as a numeric tolerance for precursor-purity calculations. A TOPP regression test runs the workflow with a 10 ppm setting and compares its consensusXML output with a reference.

Changes

Precursor isotope tolerance

Layer / File(s) Summary
Use the configured numeric tolerance
src/topp/IsobaricWorkflow.cpp, CHANGELOG
getPurities_ now accepts the maximum precursor isotope deviation as a double. The changelog describes its use for isotope matching and the isolation-window fuzzy border.
Validate 10 ppm precursor tolerance
src/tests/topp/CMakeLists.txt, src/tests/topp/IsobaricWorkflow_purity_in.mzML, src/tests/topp/IsobaricWorkflow_purity_out.consensusXML
A TOPP regression test runs IsobaricWorkflow with a 10 ppm deviation and compares its consensusXML output with the reference fixture.

Suggested reviewers: cbielow

Priority: ➖ Normal

Change: Bug fix

Merge Risk: ⚪ Minimal · up to 60593

No actionable issue is established; the change is mergeable after normal checks.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 1 files. (4 skipped: 4 … 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 main change: the precursor purity tolerance was incorrectly reduced to 1 ppm. It is concise and specific to the pull request.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 1 files. (4 skipped: 4 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 tolerance line,
Ten ppm now passes through just fine.
The spectra hop, the channels gleam,
A reference guards the workflow’s stream.
The bunny stamps the test as green!

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

@timosachsenberg

Copy link
Copy Markdown
Contributor Author

clear bug

@timosachsenberg
timosachsenberg merged commit 0e769f5 into develop Oct 8, 2026
29 checks passed
@timosachsenberg
timosachsenberg deleted the claude/intelligent-johnson-tk7099 branch October 8, 2026 15:34
timosachsenberg pushed a commit that referenced this pull request Oct 8, 2026
Brings in #10448, #10453, #10449 (ProSE -rescore), #10429, #10463, #10455 and
#10452. #10429 is the same PeptideIndexing change this branch carried from
#10403, so the files merged identically; its duplicate CHANGELOG entry is
dropped. The CHANGELOG conflict keeps both sides.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01UQCiwdbPoEkrebED8VQ2TJ
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.

2 participants