Repository navigation
[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
Conversation
|
No actionable comments were generated in the recent review. Walkthrough
Change: Bug fix Merge Risk:
|
timosachsenberg
left a comment
There was a problem hiding this comment.
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 withMultiplexFiltering::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
_20fixture, 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 ofmzs[o] + k * spacing. -
Re-quantification:
mzsholds measured m/z there: the detected handles, and the resolver's dummies at the observed anchor plus the mass shift (MultiplexResolverAlgorithm.cppL567). 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.mzscome fromexpectedChannelMZs(). 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
_20fixture: 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 themonoisotopicloop, L1987–L1991. Scale themzspassed tolowerPeak_()by1 + 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 withfindNearest(…, 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_channelbranch. - So "duplex results do not change" holds by construction.
- Join list.
- Every handle maps to a channel through
channel_at(), as thefitscheck and the partners'all_ofguarantee. So no channel gets both a measured and an expected entry. requantifyChannel_()'s exact-match lookup ofselfstill finds the measured handle.
- Every handle maps to a channel through
- 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
_out1consensusXML 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_dimethylis synthetic. One dimethyl triplex run would show whether the trade-off is as small there as for Lys4.
Generated by Claude Code
b3ecb84 to
3965261
Compare
…% 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]>
3965261 to
f93640e
Compare
…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
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:
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
_out1consensusXML 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_requantruns 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)-requantifyhelp: the exemption applies where the M−1 position lies within twicealgorithm:mz_toleranceof isotope M+0 to M+n of another channel.-join_channelshelp 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:[][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.Local run
ctest -R "MS1Labeled|ProteinGroupArrowExport|ConsensusMapArrowExport"pass on develop's code (3ae8f28) with the new tests.Checklist
🤖 Generated with Claude Code