Skip to content

[TEST,DOC] MS1LabeledWorkflow: pin the join's re-measurement, the 30 % lower-isotope bound and its read window; document the window rule's limits - #10808

Merged
timosachsenberg merged 1 commit into
developfrom
claude/silac-paired-intensity-gating
Nov 3, 2026

Conversation

@timosachsenberg

@timosachsenberg timosachsenberg commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Description

Tests and documentation for how MS1LabeledWorkflow decides whether the peak one isotope below a channel belongs to another envelope (the 30 % check of #10786), its join of separately detected channels, and the window in which both are read. No code change: every new test passes on develop and pins its current behaviour.

This PR first changed that decision to a per-peak rule. Measured on real data, the change made no difference that justifies it, so it was dropped:

  • PXD022659 (HeLa, Lys8/Arg10 duplex, 21 runs, with and without match between runs and targeted quantification): byte-identical outputs.
  • PXD003327 (E. coli triple SILAC, known per-residue mixes K 1:2:4 and R 4:2:1; one triplex run, independent Sage search, profile and centroided input): about 1 % of ~900 peptide ratios differ, complete triplets change by at most one, accuracy within 1.5x of the class median is unchanged (e.g. 98.0 → 98.0 % M/L, 95.1 → 95.1 % H/L). The two duplex runs give identical outputs.

What the rule change targeted stays documented as a limit of develop's rule (see Docs).

Terms: M0 is a channel's monoisotopic peak, M+k its k-th isotope, M−1 the position one isotope (1.00336/z) below its M0; tol is algorithm:mz_tolerance (6 ppm by default).

Tests

New synthetic fixtures with isotope centroids where real centroids lie (e.g. M+3 at +3.008 Da, not at 3× the 13C spacing); each test has an _out1 consensusXML check.

  • _21_join_target: a join is rejected by the identified multiplet's own channel, re-measured against the candidate's more intense one (an unrelated envelope sits one isotope below it); the light keeps its own value. A co-eluting 1:4 pair whose channels are detected separately is joined (L/H 0.25).
  • _21_join_dimethyl: the join's list of channels whose isotopes do not count holds the partial multiplets' channels: a Dimethyl4 medium whose M−1 holds the light M+3 is joined (M/L 0.25).
  • _22_requant, _22_targeted, _22_heavy: a non-exempt M−1 peak at 0.2× the M0 keeps the channel, at 0.4× it does not. This pins the 30 % constant to [0.2, 0.4) for a channel measured against a reference (re-quantification and targeted mode) and to (0.2, 0.4) for the identified channel in targeted mode. _22_requant runs with -targeted_quantification false, as the counterpart of _22_targeted.
  • _23 (triple SILAC): the M−1 is read within 2× tol (a peak 9 ppm away is read, one 15 ppm away is not), and develop's exemption by theoretical position within that window: a peak at the medium M−1, 9 ppm from the theoretical light M+3, is exempt although no light M+3 centroid is there (M/L 0.5).

Docs (MS1LabeledWorkflow.cpp)

  • -requantify help: the exemption applies where the M−1 position lies within twice algorithm:mz_tolerance of isotope M+0 to M+n of another channel.
  • -join_channels help and the join's doc: the identified multiplet's own channel can reject a join; in triple SILAC, where two candidates can be joined, the remaining one is re-measured again, and the identified multiplet keeps its values unless a joined candidate holds the most intense channel. The join's list holds the channels of the identified multiplet and its candidates only.
  • lowerIsChannel_ doc, the rule's limits:
    • Real isotope centroids are off the 13C spacing (15N/34S variants put M+3 at about +3.006–3.008 Da), so another channel's isotope centroid can be read at the M−1 while its theoretical position lies just outside the window. In [][Lys4,Arg6][Lys8,Arg10] this hits the medium M+3 at the heavy M−1 for peptides of about 1.7–2.1 kDa, where a heavy channel weaker than about the medium is not quantifiable.
    • Inside the window any peak at the M−1 is exempt, also an unrelated one.
    • The lower isotopologue a deuterium label (Lys4, Leu3, Dimethyl4/6/8, ICPL4/10) carries itself is not modelled, as in MultiplexFiltering.

Local run

  • All 146 tests selected by ctest -R "MS1Labeled|ProteinGroupArrowExport|ConsensusMapArrowExport" pass on develop's code (3ae8f28) with the new tests.

Checklist

  • Make sure that you are listed in the AUTHORS file
  • I have commented my code, particularly in hard-to-understand areas
  • New and existing unit tests pass locally with my changes
  • Updated or added python bindings for changed or new classes (Tick if no updates were necessary.) (no binding changes: TOPP tool only)

🤖 Generated with Claude Code

@coderabbitai

coderabbitai Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Walkthrough

MS1LabeledWorkflow now classifies lower-isotope peaks using observed centroids during re-quantification, targeted quantification, and channel joining. New regression tests cover missing and overlapping channels, intensity thresholds, and peak-reading tolerances.

Changes: MS1LabeledWorkflow isotope peak handling

Layer / File(s) Summary
Observed-peak checks in quantification
src/topp/MS1LabeledWorkflow/MS1LabeledWorkflow.cpp
lowerPeak_ checks whether a centroid near the lower-isotope position also matches another channel’s isotope position. Re-quantification and targeted quantification use this check to obtain lower-peak intensities.
Channel joining with missing channels
src/topp/MS1LabeledWorkflow/MS1LabeledWorkflow.cpp
Channel joining adds expected m/z positions for channels not present in the observed handles when it checks for isotope overlap. The option and procedure descriptions document the remeasurement behavior.
Regression scenarios and fixtures
src/tests/topp/CMakeLists.txt, src/tests/topp/MS1LabeledWorkflow_20*, src/tests/topp/MS1LabeledWorkflow_21*, src/tests/topp/MS1LabeledWorkflow_22*, src/tests/topp/MS1LabeledWorkflow_23*
New tests and fixtures cover re-quantification, targeted quantification, channel joining, the 30% intensity limit, and peak-reading versus isotope-identity tolerances.

Possibly related issues

Possibly related PRs

  • OpenMS/OpenMS#10786: Adds isotope-pattern checks that this PR refines for observed peaks.
  • OpenMS/OpenMS#10802: Aggregates targeted evidence into peptide and protein ratios; this PR changes which targeted channel measurements pass isotope-pattern checks.
  • OpenMS/OpenMS#10783: Introduces targeted quantification and channel joining paths that this PR updates.

Suggested reviewers: jpfeuffer

Change: Bug fix

Merge Risk: Minimal · up to 90361

No actionable merge-blocking risk remains in the reviewed changes; the PR is mergeable with normal checks.

Pre-merge checks: Passed 5
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage Passed Docstring coverage is 87.50% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentati…
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.
Title check Passed The title names the test and documentation work, but the changeset's main change is the lower-isotope exemption rule for MS1LabeledWorkflow, now decided per observed peak. The title mentions the join'…
Full details: Docstring Coverage

Explanation

Docstring coverage is 87.50% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 8 functions across 1 files. (1 skipped: 1 unsupported.)

Full details: Title check

Explanation

The title names the test and documentation work, but the changeset's main change is the lower-isotope exemption rule for MS1LabeledWorkflow, now decided per observed peak. The title mentions the join's re-measurement, the 30% lower-isotope bound and its read window, and the window rule's limits. These all appear in the changeset's added tests and updated docs. The title does not name the core behavioral change in MS1LabeledWorkflow.cpp (the per-peak exemption in lowerPeak_). The title is long (20 words) and dense with jargon, but it is specific and relates to the changes. It is a partial match on the main code change, so it passes.

Finishing Touches
Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · 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 each peak in view,
And tests the isotope matches too.
Missing channels join the chart,
Threshold cases play their part.
The fixtures keep the signals true,
Then hops away with work to do.

CodeRabbit Verify

  • Run CodeRabbit Verify to test the changes in this pull request.
Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 66b6d401-7815-4a45-8870-52999455e119
Commits

Reviewing files that changed from the base of the PR and between c9d6fbb and 90361a2.

Files selected for processing: 1
  • src/tests/topp/CMakeLists.txt

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

@coderabbitai coderabbitai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Fix comments: Fix CodeRabbit comments on this PR

Comment thread src/tests/topp/CMakeLists.txt Resolved

@timosachsenberg timosachsenberg left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AI-generated initial review

This is an automated, AI-generated first review. It looks only for high- and medium-priority issues (no nits) and checks whether the PR has tests and measurements. Please double-check anything before acting on it; a maintainer will follow up. I reviewed 90361a21 against the merge base 84a5b3f0 on develop.

What I ran: I did not build OpenMS: a full vcpkg build is not feasible in this 4-core container. Instead:

  • Code trace: I followed lowerPeak_() through its three callers (re-quantification, join, targeted mode) and compared it with MultiplexFiltering::filterPeakPositions_().
  • Fixture check: I re-implemented develop's and this PR's lower-isotope rule in Python and ran both on the spectra of the PR's _20 fixture, with a global m/z offset applied.
  • Fine structure: I computed the isotopic fine structure (C, H, N, O, S isotopes) of 26,943 E. coli tryptic peptides from the repo's target_decoy_Ecoli_K12_TaxID_83333.proteomes.fasta: 1.4–3.5 kDa, one K or one R, carbamidomethylated C. Assuming the M+3 fine structure forms one centroid, I took its mean m/z. This checks the PR's premise and shows how far the new rule tolerates a mass-calibration offset.
  • CI: build-and-test on Linux clang, Linux ARM g++ and Windows cl.exe is green. Linux g++ was still running and macOS queued when I looked.

Verdict: I found no high-priority issue. In the re-quantification (on by default), the per-peak rule does what the description says and matches the detection. One medium point: in targeted mode and for the join's channels that no partial multiplet has, the rule compares an observed centroid with a position computed from the sequence. A negative mass-calibration offset now enters that decision.

Medium priority

1. Where the other channels' m/z come from the sequence, the 1× tol identity check has to absorb the calibration offset as well as the isotope-centroid shift.

  • The rule: lowerPeak_() exempts the M−1 peak if it is the nearest peak within 1× tol of mzs[o] + k * spacing.

  • Re-quantification: mzs holds measured m/z there: the detected handles, and the resolver's dummies at the observed anchor plus the mass shift (MultiplexResolverAlgorithm.cpp L567). A calibration offset cancels, as in MultiplexFiltering, whose satellites are searched at the observed peak plus the shift.

  • Targeted mode and join: in targeted mode, candidate.mzs come from expectedChannelMZs(). In the join, so do the channels that none of the partial multiplets has.

  • Consequence: there the exemption needs |isotope-centroid shift + calibration offset| ≤ tol. develop's check compared two theoretical positions, so it did not depend on the offset (it had the centroid-shift problem this PR fixes).

  • Size of the shift: the M+3 centroid lies a median 1.15 ppm below 3 × 13C (10 % of peptides beyond −2.55 ppm). By sulfur count:

    • no S: −0.3 to −1.7 ppm
    • 1 S: down to −3.5 ppm
    • 2 S: down to −4.6 ppm
    • 3 S: down to −5.3 ppm

    The shift is always negative, so only negative offsets (the instrument reading low) push it out of the tolerance.

  • Effect in targeted mode: the table gives the share of heavy channels (triple SILAC, one K or one R) whose M−1 is read but not exempt, as develop → this PR. A counted M−1 makes the heavy NaN only where the medium M+3 exceeds 30 % of the heavy M0, roughly a heavy below 0.7–1.2× the medium according to the description.

offset 1.4–1.8 kDa 1.8–2.1 kDa 2.1–2.5 kDa 2.5–3.5 kDa
0 ppm 7.8 % → 0 % 66.5 % → 0 % 1.2 % → 0 % 0 % → 0 %
−2 ppm 53.5 % → 2.2 % 91.2 % → 0 % 1.2 % → 0 % 0 % → 0 %
−3 ppm 76.0 % → 12.0 % 91.2 % → 1.3 % 1.2 % → 0 % 0 % → 0 %
−4 ppm 92.6 % → 40.3 % 91.2 % → 17.5 % 1.2 % → 5.2 % 0 % → 0.2 %
−5 ppm 100 % → 91.8 % 91.2 % → 57.4 % 1.2 % → 57.1 % 0 % → 30.1 %
  • Reading the table:
    • Below 2.1 kDa: this PR is better than develop at every offset.
    • Above 2.1 kDa: develop's window exempted nearly everything there, and this PR becomes worse from about −4 ppm. At −5 ppm it is clearly worse, while the M0 is still found within the default 6 ppm.
    • On the _20 fixture: its M+3 centroid is about −1 ppm off, and my re-implementation keeps the exemption down to −5 ppm. The sulfur-containing peptides are what make it fail earlier.
    • Re-quantification: none of the 26,943 peptides is affected, since the offset cancels there.

Suggested mitigation: anchor the sequence-derived positions to the observed signal, as the detection does.

  • Targeted: take the median relative error of the identified channel's M0 centroids over the window, (*it)[index].getMZ() / candidate.mzs[own] - 1. That peak is already found in the monoisotopic loop, L1987–L1991. Scale the mzs passed to lowerPeak_() by 1 + error, and also the read position if it should match the detection fully.
  • Join: shift the missing channels' expected m/z by the median error of the covered handles, handle.getMZ() / mzs[*channel_at(mzs, handle.getMZ())] - 1. The doxygen already notes that this error is not applied.
  • Test: add a targeted fixture whose spectra are all scaled by (1 − 4.5e-6). Use a 2.1–2.5 kDa K peptide with a Met or Cys (M+3 about −2.5 ppm) at H/M 0.5. develop quantifies the heavy there; this PR as it stands does not.

Checked and found sound

  • Match to the detection.
    • filterPeakPositions_() reads the M−1 with findNearest(…, 2 * mz_tolerance) and the 30 % significance test.
    • It lets the peak pass only if it is a satellite, which is found at the observed peak plus the shift within 1× tol.
    • lowerPeak_() reproduces this, extended to the missing channels.
  • The premise. The fine-structure numbers match the description:
    • "M+3 at about +3.006–3.008 Da" (median 3.0078 Da at 2 kDa)
    • "0.4–4.8 ppm" measured on PXD003327
  • Duplex unchanged.
    • In Lys8/Arg10, the only isotopes at a heavy M−1 are the light M+7 and M+9. Both have k > 5, so neither rule exempts them.
    • The M−1 read is the same as in develop's !lower_is_channel branch.
    • So "duplex results do not change" holds by construction.
  • Join list.
    • Every handle maps to a channel through channel_at(), as the fits check and the partners' all_of guarantee. So no channel gets both a measured and an expected entry.
    • requantifyChannel_()'s exact-match lookup of self still finds the measured handle.
  • Cost. The rule adds at most one findNearest() per other channel, per channel and spectrum. I agree it needs no benchmark.

Tests

  • Thorough: 10 new TOPP tests, each with an _out1 consensusXML diff. The fixtures put the centroids where real ones lie.
  • Fail-before and mutants: 5 tests (plus their 5 _out1) fail on develop, and all 17 mutants are killed. They cover the read window, the identity tolerance, k ≤ n, the join list and the 30 % constant.
  • Missing: a case with an m/z calibration offset (see point 1).
  • I did not run the tests myself, since I could not build.

Measurements

  • Real data, good:
    • PXD003327 (E. coli triple SILAC, known mix): three analyses, with values gained and lost, accuracy against the class medians, and Fisher tests on the 12–14 ppm band.
    • PXD022659: 9 runs unchanged, in default and targeted mode.
    • Trade-off: the Lys4 2H3 isotopologue is measured and documented.
  • Gaps:
    • One raw run, as the description says.
    • Calibration offset: that run's mass-calibration offset is not reported. Given point 1, it would show how representative the targeted numbers (503 → 505 cells) are.
    • No deuterium-labelled triplex on real data (Dimethyl0/4/8, ICPL).
      • With one label site, develop's window exempted the Dimethyl4 M−1 for nearly every peptide: it lies 0.0117 Da from the light M+3, within 2× tol from about 1 kDa.
      • It also exempted the Dimethyl8 M−1, 0.0058 Da from the medium M+3, from about 0.5 kDa.
      • The per-peak rule now decides there, on a centroid that also holds the label's own 2H(n−1) isotopologue.
      • _21_join_dimethyl is synthetic. One dimethyl triplex run would show whether the trade-off is as small there as for Lys4.

Generated by Claude Code

…% lower-isotope bound and its read window; document the window rule's limits

Tests for behaviour develop already has, without changing it (synthetic fixtures 21-23):
- _21_join_target: a join rejected by the identified multiplet's own channel (re-measured against the
  candidate's more intense one) keeps the light's own value; a co-eluting 1:4 pair is joined (L/H 0.25).
- _21_join_dimethyl: the join's list of channels whose isotopes do not count holds the partial
  multiplets' channels (Dimethyl4 medium joined at M/L 0.25).
- _22_requant / _22_targeted / _22_heavy: the 30 % bound on the peak one isotope below a channel, for
  a re-quantified channel, a channel measured in targeted mode and the identified channel (pinned to
  [0.2, 0.4) and (0.2, 0.4)).
- _23: the M-1 is read within twice 'algorithm:mz_tolerance' (not 1x, not 3x), and develop's exemption
  by theoretical position within that window (DGSFVNLTSAYK's medium, M/L 0.5).

Docs: the '-requantify' help states the exemption window; '-join_channels' and joinChannelsOfIdentifiedPeptides_'s
doc describe the two-candidate case of triple SILAC and the join's list of channels; lowerIsChannel_'s
doc states the rule's limits (real isotope centroids off the 13C spacing, deuterium labels' own lower
isotopologue).

All 146 tests selected by ctest -R "MS1Labeled|ProteinGroupArrowExport|ConsensusMapArrowExport" pass.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@timosachsenberg
timosachsenberg force-pushed the claude/silac-paired-intensity-gating branch from 3965261 to f93640e Compare November 3, 2026 15:59
@timosachsenberg timosachsenberg changed the title [FIX] MS1LabeledWorkflow: decide the lower-isotope exemption per peak [TEST,DOC] MS1LabeledWorkflow: pin the join's re-measurement, the 30 % lower-isotope bound and its read window; document the window rule's limits Nov 3, 2026
@timosachsenberg
timosachsenberg merged commit 39e96fc into develop Nov 3, 2026
13 checks passed
@timosachsenberg
timosachsenberg deleted the claude/silac-paired-intensity-gating branch November 3, 2026 18:46
timosachsenberg pushed a commit that referenced this pull request Nov 8, 2026
…ges natively

MS1LabeledWorkflow (#10786, #10802, #10808, #10833): develop's changes are
written against the owning model of this branch:
- the lower-isotope bounds and the join read the best match of the linked
  identifications (getLinkedIdentifications); targeted quantification uses
  maxIsotope_() and the match sequence;
- the TARGETED_RUNS and REQUANTIFIED_* run meta values are removed after
  editPooledProteins; re-quantification reads its lower bounds from the
  linked identifications and marks the linked queries
  (replaceObservation); markTargetedRuns_/markRequantified_ are native,
  the latter removes the mark from all queries of every run;
- splitOffTargeted_ keeps the full identification data in both parts;
- MS1LabeledFAIMS::append(result, part) joins maps linked from the same
  columns and identification data (column sizes add up);
- MS1LabeledRatioQuantifier keeps the feature reference and takes develop's
  targeted/re-quantified sets; its class test adds IDs through the map's
  identification data (export, append, import).

Tests: develop's new MS1LabeledWorkflow tests (7_partial_qpx, pg_dump,
requantified_count, min_correlation) are added; 7_attached stays replaced
by the class test of 5505030.

Expected outputs: MS1LabeledWorkflow_11/13_targeted_mbr_out.consensusXML
are develop's new files with the unassigned peptide identifications in the
order of the native model (the lines are develop's, permuted; the tool's
output equals them block by block).

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

1 participant