Skip to content

[FIX] MS1LabeledWorkflow: require the isotope pattern for paired channel intensities - #10786

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

timosachsenberg merged 34 commits into
developfrom
claude/silac-paired-intensity-gating

Conversation

@timosachsenberg

@timosachsenberg timosachsenberg commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

Description

Follow-up to #10783: fixes the ratio compression at low ratios that #10783 documents as a known limitation. It does this by requiring a channel's isotope pattern before its paired peaks give it a value.

#10783 is merged; this PR now targets develop and its diff shows only this change.

Problem

pairedIntensity_ measures a channel against a reference channel from paired peaks. It is shared by the default re-quantification of missing channels (-requantify, in develop before #10783), the join (-join_channels) and the targeted quantification (-targeted_quantification).

  • What it paired: each isotope on its own. A lone heavy M+2, or the M+1/M+2 of an unrelated envelope one isotope below, gave the channel a value.
  • No lower-isotope check on the measured channel. On the identified channel, the existing check was switched off for about 40 % of Lys8/Arg10 features. The reason: "the peak one isotope below is another channel's isotope" had no upper bound on the isotope index, and the light M+7 lies 0.013/z from the Lys8 channel's M−1 (the light M+9 0.025/z from the Arg10 M−1).
  • Targeted mode reported 0 (absent) even where the channel's peaks were visible. In one 1:1 run (C_099), 538 such 0s were false.

Changes (all in MS1LabeledWorkflow.cpp)

  1. Pattern gate, in all three paths.
    • A measured channel needs at least 2 spectra, paired with the reference, that show its isotope pattern.
    • Such a spectrum has its first two isotopes, and no peak one isotope lower that exceeds 30 % of its monoisotopic peak (MultiplexFiltering's zeroth-peak check).
    • A channel that fails is not quantifiable (NaN), never 0.
    • The reported value is still the estimate over all paired peaks, so the gate only accepts or rejects.
    • In the join: a candidate is not joined to that target if a re-measured channel has no value: one of the candidate's channels or, if the candidate holds the most intense channel, one of the target's. The target is joined to its remaining candidates if they pass. The minimum of 6 spectra still counts all paired spectra.
  2. Lower-isotope bound.
    • A peak one isotope below a channel counts as the peptide's own only if it is isotope M+0 to M+n of another channel, with n + 1 the maximum of algorithm:isotopes_per_peptide. This is the same bound MultiplexFiltering uses. It is decided by a window: the peak is exempt if that isotope's theoretical position lies within twice the m/z tolerance of the position one isotope below. Real centroids are not at 13C spacing, so in triple SILAC some are read there without being exempted (fixed in [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).

    • Whether the exemption applies depends on the label pair and the peptide mass, not on the charge (default algorithm:mz_tolerance and algorithm:isotopes_per_peptide):

      pair isotope at the M−1 exempt
      light → Arg6 light M+5 always
      light → Lys4 or Dimethyl4 (one label) light M+3 above about 970 Da
      Dimethyl4 → Dimethyl8 (one label) medium M+3 above about 480 Da
      Lys4 → Lys8, Arg6 → Arg10 (triple SILAC) medium M+3 above about 2.02 / 2.10 kDa
      light → Lys8, Arg10, Dimethyl8; any pair in a peptide with two labels (e.g. two K) M+7 or higher never
    • It also applies to the identified channel's clean-spectrum check in targeted mode.

  3. Targeted mode, absent channels. A channel without a value is absent (0) only if none of its isotopic peaks read (M+0 to M+2) is seen within the elution boundaries, whether the peak is its own or one left out because it belongs to another peptide. Otherwise it is not quantifiable. The 0 of the default re-quantification keeps its meaning.
  • Log: a new line counts re-quantified channels that are not quantifiable for lack of their pattern. It is printed only if there are any. Three existing lines change:
    • the join summary now ends "(fewer than 6 spectra with paired peaks, or a re-measured channel without a value).";
    • the completed-multiplets line gains ", or the channel's peaks there do not form its isotope pattern";
    • the counts of the "Re-quantified N …" line no longer include gated channels, so it can read "Re-quantified 0 …".
  • Docs: the -requantify, -targeted_quantification and -join_channels help, the class doc and the doxygen are updated.
  • No new option. The thresholds are documented constants (lower_isotope_fraction_ = 0.3, min_pattern_spectra_ = 2).

Real data

PXD022659 HeLa SILAC (Lys8/Arg10) dilution series (Pino et al.): 7 points from 70 % to 0 % heavy, 3 DDA runs each (21 runs). Also the 1:1 three-run set from #10783. Same MetaMorpheus PSMs and parameters as in #10783. The numbers were recomputed independently from the outputs. Targeted-mode numbers are from 914abeb; default-mode numbers did not change with that commit, which affects targeted mode only. The #10783 commits merged since then do not change outputs.

Default settings

heavy cells re-quantified channel: dev re-quantified channel: 2x protein ratios 2x
70 % −1.6 % +0.04 → +0.05 98.4 → 98.6 % 99.9 → 99.9 %
50 % −1.1 % +0.02 → +0.02 97.8 → 97.8 % 99.9 → 99.9 %
30 % −2.7 % +0.12 → +0.12 97.7 → 98.0 % 99.3 → 99.4 %
10 % −7.0 % +0.42 → +0.39 82.2 → 84.5 % 88.7 → 90.5 %
5 % −10.3 % +0.30 → +0.22 74.6 → 79.1 % 75.8 → 80.9 %
1 % −20.6 % +1.24 → +0.77 46.0 → 54.5 % 34.3 → 42.7 %
  • Pure light (0 % heavy): false protein ratios 74 → 41 per run; false re-quantified heavies 282 → 147.
  • Re-quantified values that change: only to NaN (4,983 over 21 runs). Every kept value is bit-identical, and the re-quantification adds nothing. The only other changes come from rejected joins (below).
    • The dropped values were 66 / 48 / 23 % within 2x at 10 / 5 / 1 % heavy.
    • At 70–30 % heavy they were mostly correct (94–98 %). That is the coverage cost.
  • Protein ratios: no ratio is added. Common ratios do not move (median paired shift 0.000 in all 21 runs).
  • Joins: 10 of 806 are rejected (2 of them by the target's own re-measured channel). A rejected candidate that was identified stays a feature of its own, and the target is quantified without it. Over 21 runs this changes 2 target channels and adds 4 features (207,405 → 207,409). Example: B_061 IVEPYIAWGYPNLK, joined before at L 4.74e7 / H 1.24e8, is now L 6.02e7 only.
  • 1:1 three-run set: 22,079 → 21,845 cells (−1.1 %); within 1.5x of the median 96.4 → 96.5 %. The lost cells were 86.8 % within 1.5x.
  • Cost: mzTab protein abundance ratios (channel sums over all peptides) get slightly worse on the same proteins: within 2x −2.5 pp at 10 % heavy and −4.1 pp at 5 %. A heavy value that becomes NaN leaves the heavy sum while its light still enters the light sum.
  • 0s of the re-quantification at 1:1: 173 / 166 / 166 per run, unchanged. All of them are false at 1:1 (see "Still open").

Triple SILAC (Lys4/Arg6 + Lys8/Arg10), where the lower-isotope exemption applies, default settings

  • Data: PXD003327, E. coli triple SILAC Lys4/Arg6 + Lys8/Arg10, with a known mix of K 1:2:4 and R 4:2:1. One run (Chris_Ecoli_1-2-4, the authors' mzML), run with the authors' identifications (A) and with an independent SimpleSearchEngine search (B).
  • Cell: all three channels > 0. 1.5x: all of its ratios within 1.5x of the expected value.
IDs / input not quantifiable by the gate cells lost / gained within 1.5x: kept / lost
A, profile 18 452 → 440 (−2.7 %) 12 / 0 88.4 % / 33.3 %
B, profile 15 346 → 336 (−2.9 %) 10 / 0 89.9 % / 30.0 %
A, MS1 centroided 20 460 → 441 (−4.1 %) 19 / 0 90.5 % / 47.4 %
  • What is lost: mostly the peptide's weakest channel (the light of K peptides, the heavy of R peptides), most of whose old values were biased. Some accurate heavy values of peptides of about 1.7–2.1 kDa are lost too (fixed in [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). Kept cells do not get worse (95.0 → 95.2 % within 1.5x of the class median; class: peptides with the same number of K and R, median of their ratios).
  • The exemption keeps good values: without it, 13 more cells would be lost (MS1-centroided input), all within 1.5x of the class medians. It protects mostly heavy channels, whose M−1 holds the medium M+3 (11 heavy and 8 medium channels in these 13 cells). The medium channel loses only 2 / 1 / 2 values (A profile / B profile / A centroided).
  • Caveat: this is one run; the lost-cell shares rest on n = 10–19.

-targeted_quantification true

heavy measured targeted values dev 2x new protein ratios 2x
70 % −19.6 % −0.10 → −0.08 97.3 → 98.1 % 99 → 99 %
50 % −17.1 % +0.05 → +0.05 98.7 → 98.8 % (1.5x: 93.1 → 94.2 %) 100 → 100 %
30 % −20.8 % +0.29 → +0.27 94.4 → 95.7 % 97 → 98 %
10 % −26.2 % +0.72 → +0.63 65.0 → 71.8 % 45 → 59 %
5 % −28.4 % +0.58 → +0.30 62.1 → 72.9 % 40 → 62 %
1 % −40.2 % +3.97 → +0.74 36.5 → 52.8 % 12 → 19 % (n ≈ 12)

The dev and 2x columns cover all targeted features with both channels > 0.

  • Pure light: false heavies among targeted features 79 → 31; false protein ratios 86 → 46.
  • False absents at 1:1 (0 reported where the channel at its true ratio is well above the centroid floor): 538 → 27 in C_099, the one 1:1 run evaluated this way. Reported 0s at 70–30 % heavy fall to 2–5 % of their former count.
  • Cost in true absences: at 0 % heavy, where every 0 is correct, heavy channels reported as 0 fall from 12,167 to 4,389 per run (90 % → 32 % of them); the rest become NaN.
  • 1:1 three-run set: 36,576 → 33,953 cells; within 1.5x of the median 95.1 → 95.7 %.
  • Effect of the lower-isotope bound on the identified channel:
    • About 6 % of the heavy-identified features that the unbounded exemption covered are no longer quantified (B_102: 204, C_099: 91; per-run means B 250, C 128). The ones lost at 70 % heavy were less accurate than the rest (90 % vs 97.7 % within 2x).
    • For about half of the rest, the identified channel's value drops (median 0.1 log2), because contaminated spectra leave its elution peak. Their ratios barely move (median 0.04 log2).
  • Side effects on other features (attributed, nothing unexplained):
    • A re-quantified channel of another peptide's multiplet that turns NaN can free a position for a targeted peptide. This gives 80 new features, and 9 channels change; one checked example moved to within 0.03 log2 of its expected ratio.
    • A gated channel can resolve a conflict between targeted identifications. This gives 32 new features.

Runtime and memory: unchanged (CPU time ratio 1.00, peak memory ±0.5 %, measured before the last targeted-mode fix, which only widens one condition).

Still open (not in this PR)

  • Targeted mode stays off by default. Its values at 10 % heavy remain compressed (+0.63, against +0.39 for re-quantified channels). This is truncation at the vendor centroid floor, which no accept/reject rule fixes.
  • Summed protein abundances in targeted mode stay biased (−0.2 to −0.35 log2 at ≤ 10 % heavy; slightly more than before at 70/30/10/0 %), because the identified channel is summed while its partner is NaN. Dropping such features would remove the bias, but at a cost in light-channel coverage; that should be decided together with the default.
  • The default re-quantification still reports 0 when only the M0 is seen. At 1:1 that gives about 168 false 0s per run (mean of the 3 runs), about 6x the 0s that targeted mode now reports there (24–29 per run). Their detected channels are not weak (median 1.9e7 vs 2.1e7). Applying the targeted rule there would change the meaning of the -requantify 0, so it is left for a separate decision.
  • The join's exemption list holds only the channels present. In a triplex join that covers two channels, a peak one isotope below that is an isotope of the missing third channel is not exempted, so the candidate can be rejected. This is conservative and cannot occur in duplex (fixed in [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).

Tests

  • New fixture MS1LabeledWorkflow_16 (Lys8/Arg10 duplex, synthetic). Each case states its setup in the CMake comment.
    • Targeted:
      • heavy under a lower envelope with its M−1 on the light M+7 → NaN (was H/L 0.60);
      • heavy pattern in only 1 spectrum → NaN (was 0.50; pins the threshold of 2);
      • 1:0.03 with only the heavy M0 → NaN (was 0);
      • controls 1:0.25 and light only, unchanged;
      • heavy identification on a contaminated channel → not quantified (pins the bound on the identified channel);
      • Dimethyl 1:0.2 with the medium M−1 on the light M+3 (k = 3) → unchanged (pins the exemption); the same case with algorithm:isotopes_per_peptide 3:4 (still exempt) and 3:3 (not exempt → NaN) pins the bound exactly;
      • heavy channel with an unrelated envelope on its M+1/M+2, or on its M+2/M+3, and nothing at its M0 → NaN (was 0; pins the absent rule on all isotopes read).
    • Re-quantification: heavy under a lower envelope → NaN (was 0.12); controls 1:0.1, M0 only and nothing at the position → unchanged.
  • New fixture MS1LabeledWorkflow_17 (join):
    • a candidate whose heavy peaks are another envelope's isotopes → not joined (was joined, H/L 1.19);
    • a candidate with 9 paired spectra, 3 of them with its pattern → joined (pins the ungated minimum of 6).
  • New fixture MS1LabeledWorkflow_18 (detected features, which fixture 16 cannot take without shifting the unique ids in its reference):
    • targeted: a heavy channel with nothing at M0/M1 whose M+2 is the light M0 of another detected, identified duplex → NaN (was 0; pins the absent rule on reserved peaks at all isotopes read);
    • default settings, Dimethyl 1:0.2 with the medium missed by the detection and its M−1 on the light M+3 (k = 3) → re-quantified at M/L 0.2000 without a "not quantifiable" line (pins the exemption in the re-quantification together with _7_partial).
  • Fixture 15: SVEDLAFGNYQGEDVTALR's medium has an unrelated peak at its m/z, so it is now not quantifiable instead of absent. Three regexes change, and each of the three references loses exactly that one element (checked by diff before replacing). No other reference changes.
  • Fail-before: every new test fails with the [FEATURE] MS1LabeledWorkflow: owner-aware blacklist, join of separately detected channels, targeted quantification #10783 binary, except _16_dimethyl, _16_dimethyl_isotopes4 and _18_dimethyl_requant (with its _out1), which pin behaviour that does not change.
  • Mutants: each rule was pinned by a mutant that fails its tests: unbounded exemption, bound k < n or hard-coded 3–6, no lower check, no pattern requirement, threshold 1, absent rule removed or limited to M0 / M0–M1, reserved peaks counted only at M0–M1, exemption removed (in all paths or only in the re-quantification), gated join count.
  • [FEATURE] MS1LabeledWorkflow: owner-aware blacklist, join of separately detected channels, targeted quantification #10783's FAIMS fixture 19 (now in develop): its 8 tests pass on this branch with the same references.
  • Local run: all 391 tests that ctest -R "MS1LabeledWorkflow|Multiplex|ConsensusMap|MzTab|ExperimentalDesign|QPX|StatisticFunctions|ProteomicsLFQ|OpenNuXL|FeatureFinderMultiplex|IMDataConverter" selects pass. These are the class and TOPP tests whose names contain one of these words. This was on the branch before develop was merged in; after [FEATURE] MS1LabeledWorkflow: owner-aware blacklist, join of separately detected channels, targeted quantification #10783's squash merge, the branch differs from develop by exactly this PR's changes.
  • The Doxygen warning test could not be run locally; CI runs it.

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

https://claude.ai/code/session_0149aXmbpvTPyiZ7DxhD6MoJ

Summary by CodeRabbit

  • Bug Fixes
    • Improved labeled MS1 quantification by distinguishing channels with no detected signal from channels that cannot be quantified because their peaks are reserved or do not meet isotope-pattern checks.
    • Applied isotope-pattern checks more consistently during targeted quantification and re-quantification, reducing unsupported channel measurements and joins.
    • Consensus results no longer include zero-intensity channel entries.

claude added 25 commits October 30, 2026 16:24
…s, two-sided overlap check, satellite union, per-channel RT range

Defects found while checking the SILAC attrition report in
PhilRe99/openms_silac_nextflow#6 (mirrored in #10775):

- Math::rankCorrelationCoefficient took two square roots, so an exact
  correlation of 0.5 came out as 0.49999999999999989 and failed the
  'peptide_similarity' (0.5) cutoff in MultiplexFiltering; 0.4 failed
  'averagine_similarity' the same way. With three isotopes this meant
  light and heavy needed identical intensity rank order. Now one square
  root of the product, as in pearsonCorrelationCoefficient.
- MultiplexResolverAlgorithm::isBlacklisted_ looked only at the first
  blacklisted peak at or above the dummy's m/z (MZBegin), so a peak just
  below it was missed and the channel reported as absent (0) instead of
  not quantifiable (NaN). Now MSSpectrum::findNearest within tolerance.
- generateMapsCentroided_ stopped collecting a point's satellites at the
  first duplicate ('break'), dropping the later unique ones (reachable
  with rt_band > 0). Now skips only the duplicate.
- determinePeptideIntensities{Centroided,Profile}_ started rt_min/rt_max
  at 0 and only reset them for the first mono-isotopic satellite, so the
  'rt_min' duration check never applied to later channels and used only
  the last mono-isotopic RT of the first one. Now a proper min/max per
  channel.
- Column header sizes were incremented before a later channel could
  abort the multiplet. Now counted for reported multiplets only.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_0149aXmbpvTPyiZ7DxhD6MoJ
… multiplet's own isotopes, applies to added channels; join separately detected channels

- The two-sided blacklist lookup made the multiplet's own isotopic peaks
  veto its missing channels: the light M+4 peak lies ~9 ppm below a Lys4
  (or Dimethyl4) channel (4.0251 Da vs. 4 x 1.0034 Da), so e.g. the
  re-quantified medium channel of a light-detected triplex became NaN.
  isBlacklisted_ now skips blacklisted peaks at the first six isotopic
  positions of the multiplet's detected channels (those the detection
  follows by default) and checks every blacklisted peak within the
  tolerance on either side, keeping the strict '<' boundary.
- A channel added to a multiplet for an identification of it
  (MS1LabeledWorkflow attachToUndetectedChannels_: intensity 0, no unique
  id) skipped the overlap check, because the multiplet looked complete
  (duplex) or the handle was copied as detected (triplex). It is now
  checked like a missing channel (PhilRe99/openms_silac_nextflow#9).
- MS1LabeledWorkflow: when no spectrum holds a peptide's complete
  pattern, its channels can be detected separately (partial multiplets).
  mergeFragments_ never merges two such partials (neither is larger), and
  the resolver completed each with a dummy on the other's blacklisted
  peaks, so the peptide got no ratio. joinChannelsOfIdentifiedPeptides_
  lets an identified partial multiplet take up the partials at the m/z
  its peptide has in the missing channels (same charge and CV, eluting at
  the identification within the id_mapping tolerances, identifications of
  the same peptide only). Synthetic fixture MS1LabeledWorkflow_8.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_0149aXmbpvTPyiZ7DxhD6MoJ
…el RT range fixes

Each change was traced to one fix by applying the fixes one at a time on
top of develop (on which all of these tests pass):

- Spearman (exact 0.5 / 0.4 no longer rejected): FeatureFinderMultiplex
  4, 5, 6, 9, 11. More seeds pass the filters, so some intensities and
  ratios change and test 9 gains 6 features, test 11 one.
- RT range per channel (the first channel no longer spans only from its
  last mono-isotopic satellite, which dropped multiplets with rt_band > 0):
  FeatureFinderMultiplex 10 gains a singlet; MS1LabeledWorkflow 1-6 detect
  one more (unidentified) multiplet, which changes only feature ids (and
  the MBR log count, 7 -> 8 unidentified); ProteomicsLFQ 3 and 9 (seeds
  from FeatureFinderMultiplex) get a few more seeds, which changes ids and
  shifts a few quantities by < 0.5%.

The satellite union, the overlap check and the joining of separately
detected channels change none of the existing outputs. References that
did not take the change as a patch (FeatureFinderMultiplex, two of
ProteomicsLFQ 3) were regenerated, keeping their input names and version
strings.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_0149aXmbpvTPyiZ7DxhD6MoJ
…; resolver: own isotopes only by proximity

Review of #10781:

- joinChannelsOfIdentifiedPeptides_ compared only charge and expected
  channel m/z, so partials identified as different peptides of the same
  composition (e.g. LVNELTEFAK / VLNELTEFAK) were joined. The unlabelled
  sequences (other modifications kept) now have to match as well.
- The join ran before keepMultiAssignedOnClosest_, so a spectrum match the
  mapping had attached to several partials let the first of them (not the
  closest) take up the partner. Multi-assigned matches are now settled
  before the join (and again after the attachment, as before).
- The resolver attributed every blacklisted peak within its tolerance of
  one of six isotopic positions of a detected channel to the multiplet,
  which also exempted another feature's peak exactly at the dummy (the
  light M+4 position is only ~9 ppm from a Lys4 channel). A peak now only
  counts as the multiplet's own if it is closer to one of those positions
  than to the dummy's.

New TOPP fixture MS1LabeledWorkflow_9 covers both join cases (the previous
version joined the two peptides and paired the heavy channel with a ten
times stronger envelope 15 ppm off: H/L 0.09 instead of ~1); the resolver
class test gains a peak of another feature exactly at the Lys4 channel.
MS1LabeledWorkflow_7/8 references: only the order of two meta values
changed ('map_index' is now registered before 'feature_id').

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_0149aXmbpvTPyiZ7DxhD6MoJ
…this PR

On real data (PXD022659, three injections of a SILAC Lys8/Arg10 mix, MetaMorpheus
PSMs, MS1LabeledWorkflow with knock_out and requantify), each of these changes was
harmful on its own against develop:
- two-sided overlap check in MultiplexResolverAlgorithm::isBlacklisted_: 95 fewer
  quantified peptide forms; the removed ratios were mostly fine;
- overlap check for channels added for an identification: 519 fewer forms; the
  removed ratios were 94% within 1.5x of the mix ratio;
- joining separately detected channels of an identified peptide: 59 more forms,
  but only 44% of the new ratios within 1.5x, and 96 of the 99 existing ratios it
  changed got worse.

The overlap veto works on an anonymous blacklist and is too imprecise to be made
stricter; these changes need a different design and go to a follow-up. Restores
MultiplexResolverAlgorithm, MS1LabeledWorkflow and their tests to develop and
removes the MS1LabeledWorkflow_8/9 fixtures. The Spearman and FeatureFinderMultiplex
fixes stay.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_0149aXmbpvTPyiZ7DxhD6MoJ
…rted multiplet

The channel ids were numbered over the column headers that existed at that point, i.e. the
channels of reported multiplets only (since the header counts moved behind the abort check, a
channel used only by aborted multiplets no longer has one). A channel without a reported
multiplet then got its header later, without a channel id (ColumnHeader::getLabelAsUInt()
returns 1 for it), and the ids of the following channels shifted down. The ids are now set
after the headers of all configured channels exist, as the channel's index.

Reported by CodeRabbit on #10781.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_0149aXmbpvTPyiZ7DxhD6MoJ
…xact Spearman cutoffs

The featureXML references of these tests were updated for the exact Spearman cutoffs in
52e783c, but their consensusXML references still held the develop values of the doublet
(light 1.7945e9, heavy 1.6043e9, H/L 0.894). The PR produces 1.7822e9 / 1.5389e9 / 0.863,
matching the updated featureXML. The tests passed anyway because the element lines are
whitelisted ("id=") and the centroid moves by 0.7%, below the 1% tolerance. Only the
centroid and the two element lines change.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_0149aXmbpvTPyiZ7DxhD6MoJ
…kind of its sample

matchesResidues_() only checked the residue kinds that carry a label in a
pattern channel. With [][Lys8,Arg10], the pattern for one K and no R (heavy
channel {Lys8}) therefore accepted a light peptide with one K and one R: its
R count was never compared. This put the other channel at a single-label
shift (+8.014 instead of +18.022 Da):
- expectedChannelMZs() (used by MS1LabeledWorkflow to attach identifications
  of undetected channels) returned the wrong channel m/z,
- resolve() completed a light singlet of such a peptide with a dummy at the
  wrong position (re-quantified there by MS1LabeledWorkflow), and accepted a
  Lys8 doublet as that peptide,
- checkIdentifications() agreed with such a doublet.
Partially labelled peptidoforms (e.g. heavy R, light K) matched the
single-label pattern the same way.

A channel now has to carry, for every residue kind its sample labels, one
label per residue of that kind, i.e. none if the peptide has none. The
sample of a channel is the one in 'algorithm:labels' whose labels include
the channel's labels (not its position, since the light SILAC sample can be
implicit). Unlabelled channels impose nothing; Dimethyl, ICPL and numeric
labels are still not counted. Residue kinds a sample does not label impose
nothing either ([][Lys8] still shifts a K+R peptide by Lys8 only).

On the PXD022659 data, this explains all four joined K+R peptides that got
a partner at a single-label shift (LEELDADKAEMR, IEERHREMENAIK, TKEELEAEKR,
and IDLGKANEPNHVELGR, whose only PSM in that run is the heavy-R/light-K
form). Run 028 has 2242 PSMs of light K+R peptides and 525 partially
labelled PSMs.

No reference output changes: the only SILAC resolver fixture
(MultiplexResolver_1) and the MS1LabeledWorkflow fixtures contain no peptide
with both K and R; MultiplexResolver_2/4 (Dimethyl) and _3 (Leu3) are not
affected. All resolver and workflow test outputs were compared with the
previous build and are identical apart from unique ids.

New class tests (fail before this change): a light K+R singlet is
completed at the combined shift and a Lys8 doublet with that identification
is a conflict; checkIdentifications() rejects it; expectedChannelMZs() gives
the combined shift for duplex and triple SILAC and with an implicit light
sample, no pattern for 2K+R beyond max_nr_labelled_aas, without K/R, or for
a partially labelled peptide; K-only/R-only, [][Lys8] and Dimethyl are
unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_0149aXmbpvTPyiZ7DxhD6MoJ
…d only by another peptide

Until now the blacklist was anonymous. The resolver made a missing channel NaN, and so never
re-quantified, whenever any reserved peak lay at its position. MS1LabeledWorkflow's
re-quantification skipped every reserved peak, whoever had reserved it. On the PXD022659 data,
59% of those vetoes came from reservations no reported feature owns (clusters dropped by
rt_min), and 16% from the peptide's own other channel.

- MultiplexFiltering records, for every reserved peak, the filtered peak (pattern, index in the
  filter result) and the mass trace it was reserved for. They are written together with the role
  value in the serial accept steps, so they are the same for any number of threads. The new
  getter getBlacklistOwners() returns them aligned with getBlacklist(). The undefined
  blacklistPeak_(peak) declaration is removed.
- FeatureFinderMultiplexAlgorithm maps each owner to the unique id of the feature of its
  channel in the reported multiplet of its cluster, or to 0 if the multiplet was not reported.
  The ids are recorded per (pattern, cluster, channel) inside generateMaps*_, not by position,
  since a channel can lack a feature and the provisional ids of aborted multiplets are reused.
  Each blacklist spectrum carries them as two IntegerDataArrays aligned with its peaks,
  "owner_unique_id_high" and "owner_unique_id_low" (the 32-bit halves of the UInt64 id). The
  arrays survive mzML. The wrong "per-pattern blacklist" comment is fixed.
- MultiplexResolverAlgorithm gets public static helpers: hasBlacklistOwners(), blacklistOwner(),
  setBlacklistOwners(). It also gets one classification rule: ownerPeptides() and
  classifyBlacklistOwner() give orphan / own / same peptide / unidentified / other peptide, and
  isForeign() decides whether an owner vetoes. Same peptide means the same sequence without the
  labels of algorithm:labels, at the same charge. With owners:
  - lookup is two-sided;
  - only foreign owners (unidentified or other peptide) veto;
  - channels added for an identification (intensity 0, no uid), including complete multiplets,
    are checked as well;
  - a log line counts the vetoes, separately for missing channels and added channels, by owner class,
    the channels whose reserved peaks belong to no other peptide, and the vetoes the anonymous check
    would have given.
  Without owner arrays, behaviour is unchanged.
- MS1LabeledWorkflow:
  - mergeFragments_ returns flank channel -> coinciding channel of the kept multiplet, and the
    blacklist owners of merged flanks are remapped to it;
  - requantifyChannel_ takes a reserved-peak filter, and requantifyMissingChannels_ skips only
    peaks with a foreign owner, using the resolver's classification;
  - a log line counts the reserved peaks it now uses, by owner.

Tests:
- resolver: owner arrays (64-bit round trip, sort, mzML), hasBlacklistOwners(), classification,
  and resolve with owners (orphan/own/same peptide -> 0, other peptide/unidentified -> NaN,
  anonymous -> NaN as before, a peak below the dummy counts only with owners, added channels in
  duplex and triplex);
- FeatureFinderMultiplexAlgorithm: owners = reported feature uid per channel, orphans for a
  multiplet dropped by rt_min, profile path, per-cluster ids incl. a channel without a feature;
- MultiplexFilteringCentroided: the same owners for 1/2/4/8 threads.

Real data (run 028, RT 2400-3600 s): of 182 missing channels, 49 are not quantifiable (103 without
owners); 38 of 295 added channels are newly not quantifiable. 203 channels lie on reservations of
the same peptide or of no reported feature. 329 channels are re-quantified (307 before) and 61 are
absent (67 before).

Reference outputs: none changed. The MS1LabeledWorkflow test outputs are byte-identical to the
previous build. Fixture 7 shows one triplex channel that the owner-aware check classifies as
lying on its own multiplet's reservation; no veto changes, and no re-quantification uses a
reserved peak. MultiplexResolver_4 uses an anonymous blacklist.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_0149aXmbpvTPyiZ7DxhD6MoJ
…d channels and re-measures them over common spectra

When no spectrum holds a peptide's complete pattern, FeatureFinderMultiplex can
report its channels as separate partial multiplets. mergeFragments_ does not
merge them (neither is larger), and the resolver completes each with a dummy on
the other's peaks, so the peptide gets no ratio. The first attempt to join them
(660aac7, dropped in 3678944) paired the right channels in most cases on
real data (PXD022659), but it kept the two FFM partial intensities. Those were
measured over different spectra and isotope counts, so only 41 % of the joined
ratios were within 1.5x of the mixing ratio.

New option -join_channels (default false until measured on the full data):
- Candidate search as in 660aac (after settling multi-assigned spectrum
  matches, before attaching IDs to undetected channels; same charge and CV,
  eluting at the identification, all channels among the missing ones, IDs of
  the same unlabelled peptide only). The m/z must now match the expected channel
  m/z within the detection tolerance (algorithm:mz_tolerance, 6 ppm) instead of
  id_mapping's 20 ppm, for the candidate and for the target's own channels.
  This removes the abundant other species at 14-18 ppm that caused most of the
  remaining wrong partners.
- The most intense channel keeps its intensity. The channels of the other
  partial multiplet(s) are re-measured against it with requantifyChannel_
  (paired peaks) over the union of the two channels' elution regions, with as
  many mass traces as both have. The joined channels' own reserved peaks are
  used: owner-aware blacklist, the same classification as the
  re-quantification. On the real data the paired ratio over the hull union was
  within 1.5x for 96 % of the joins.
- A candidate with fewer than 6 spectra of paired peaks is not joined (accuracy
  60 % with 3-5, 92 % with 6-9, 98 % with 10 or more paired spectra).
- No elution-correlation gate: on the real data it did not separate good from
  bad joins (AUC 0.48-0.60).
- requantifyChannel_ can report the number of paired spectra. FFM's centroided
  experiment is also kept when only the join needs it.

With -join_channels false (the default) the code path and every existing test
output are unchanged.

Sanity check on one real run (PXD022659 run 028 alone, -join_channels true vs
false):
- 71 joins; 8 candidates rejected for too few paired spectra.
- 24 peptide forms gained, all within 1.5x of 1:1.
- 40 existing ratios changed: within 1.5x 98 % before, 100 % after.
- 1 form lost: DLLFQALGR, which shared a light singlet with the isobaric
  LVFGFLNGR(Arg10). The singlet is now joined to LVFGFLNGR's light channel,
  the peptide of its best identification (H/L 0.87; the FFM intensities would
  give 2.9).

Tests (all with -join_channels true):
- MS1LabeledWorkflow_8 and _9: the fixtures of 660aac7, regenerated
  byte for byte by their generators.
  - 8: LVNELTEFAK is joined. H/L is now 0.956 (re-measured); 660aac kept the
    FFM intensities: 0.935.
  - 9: the composition-identical LVNELTEFAK/VLNELTEFAK are not joined.
    YVNDLAGHEK is joined to its exact light channel, not to the 10x envelope
    15 ppm above it. H/L 0.955 (660aac: 0.928).
  - Against the 660aac references, only the joined channel's intensity and the
    ratios derived from it differ.
- New MS1LabeledWorkflow_10, channels detected over very different elution
  regions:
  - TLSDYNIQK 1:1 (FFM hulls 4 s vs 26 s): FFM intensities would give H/L 3.0,
    re-measured 0.954.
  - ALVAYYQK 5:1: the narrow light channel is the reference, and the heavy one
    is re-measured from peaks it reserved itself: 0.191 instead of 0.60. Without
    the owner-aware filter it would not be joined.
  - VSFELFADK: light and heavy share only 5 spectra, so they are not joined.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_0149aXmbpvTPyiZ7DxhD6MoJ
…ified peptides that have no multiplet

An identified peptide without a multiplet in the run (none detected, or its identifications fit none) was kept for
protein inference only. With -targeted_quantification true (default false) it is measured from the MS1 peaks at the
m/z it has in every channel, after the re-quantification and while the handles still name their channels:

- Candidates: unassigned identifications with a target best hit whose labels fit a pattern (expectedChannelMZs), of a
  peptide (label-stripped sequence, charge, CV) that no resolved multiplet quantifies within algorithm:rt_typical of
  its elution region (abundances add up per peptide and charge, so nothing is measured twice).
- Extraction: nearest peak within algorithm:mz_tolerance for isotopes 0-2 of every channel in the detection's
  centroided spectra, ID RT +/- algorithm:rt_typical, same CV. Peaks reserved for a multiplet of another identified
  peptide are left out; peaks of unidentified multiplets and orphans are used.
- Boundaries: sum of all channels' first two isotopes, smoothed and split at minima with ElutionPeakDetection's
  smoothData/findLocalExtrema (detectPeaks itself fails on a split part of zeros only), trimmed to the positive
  smoothed region; the peak containing the ID, else the nearest within id_mapping:rt_tolerance.
- Reference = the identified channel. It needs M0 and M1 in >= 3 spectra without a strong peak one isotope below
  (another envelope, the detection's zeroth-peak rule) and an isotope pattern that fits the sequence (Pearson >=
  algorithm:averagine_similarity). Its intensity is the trapezoid area of its isotope traces (PeakIntegrator, as the
  detection integrates), its RT the intensity-weighted mean of its monoisotopic peaks.
- Other channels from paired peaks against it (pairedIntensity_, the kernel requantifyChannel_ now uses as well),
  reported if paired in >= 2 spectra and co-eluting (Pearson of the isotope-summed profiles >=
  algorithm:peptide_similarity); else 0 if nothing is there, not quantifiable (no handle) if something is.
- One consensus feature per elution peak (m/z = lightest channel, setUniqueId, FAIMS_CV), carrying every
  identification of the peptide in that peak, moved out of the unassigned ones, with map_index = its own channel.
  The feature and these identifications get quantification_method = "targeted" (only the identifications' value
  survives linking).

MultiplexResolverAlgorithm gets peptideKey() (the key ownerPeptides() uses, now shared) and a
classifyBlacklistOwner() overload for a peptide without a multiplet.

Tests: MultiplexResolverAlgorithm_test sections for both. New fixture MS1LabeledWorkflow_11 (synthetic SILAC duplex)
with TOPP tests 11_targeted (log regex, consensusXML, QPX psm view) and 11_default. Its cases cover: a weak doublet
(two IDs, one feature, H/L 0.95); an already quantified peptide; a decoy; an ID on another envelope's second isotope
(conflict), rejected by the lower-isotope check; light only (heavy 0); a heavy buried under another identified
peptide (not quantifiable); an unidentified doublet's peaks used (H/L 0.94); a non-co-eluting heavy (not
quantifiable). Throwaway builds without the lower-isotope check, with unidentified owners skipped, with no reserved
peak skipped, or without the co-elution gate each change exactly the case meant for it. No existing reference
changed; the outputs of all existing MS1LabeledWorkflow test commands are byte-identical to the previous commit.

Real data (PXD022659 run 028 alone, same options): identified forms quantified 38.7% -> 67.7% (+5194 cells, none
lost); targeted cells 92.6% within 1.5x of the run median (detected 96.5%); on the 2465 targeted cells MetaMorpheus
also quantifies, 93.9% vs MetaMorpheus' 83.2%. Runtime 7:39 vs 7:27 min.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_0149aXmbpvTPyiZ7DxhD6MoJ
… targeted conflicts

Resolver (MultiplexResolverAlgorithm):
- New parameter algorithm:use_blacklist_owners (default false). Without it the owner
  arrays FeatureFinderMultiplex now always writes are ignored, so MultiplexResolver,
  pyOpenMS resolve() and MS1LabeledWorkflow -requantify false keep the old semantics
  (a dummy left at 0 in owner mode only means "not occupied" and must be measured).
  MS1LabeledWorkflow sets it from -requantify and hides it from its resolver section.
- isForeign() includes SAME_PEPTIDE: another multiplet of the same peptide is
  quantified itself, so it vetoes a missing channel instead of being re-quantified
  into it (counted twice). Merged flanks and joined partners are OWN and unaffected.

MS1LabeledWorkflow:
- Re-quantification and join use a reserved peak only if the measured channel
  reserved it itself or no reported feature did (mayUseReserved_). A missing channel
  is no longer measured from the multiplet's own isotopes (triple SILAC Lys4 medium
  on light M+4) nor from a same-peptide multiplet.
- Targeted quantification: an ID whose channel lies on a quantified channel of another
  peptide's multiplet (near its elution region) is not measured; of targeted peaks of
  different peptides that read the same peaks only the best-scoring ID's is kept; an
  unidentified multiplet kept for match between runs whose peaks a targeted feature
  read is replaced by it.

Tests: new TOPP tests MultiplexResolver_5(_owners), MS1LabeledWorkflow_9_default,
_9_join_tolerance, _11_conflicts, _11_targeted_mbr, _12_reserved (new triple SILAC
fixture: own-isotope dummy, orphan re-quantification, merged-flank remap); resolver
class tests for the parameter and SAME_PEPTIDE. Six existing workflow log regexes
contained ';', which CMake splits into alternative regexes (only one half was
enforced); ';' replaced by '.'. No existing reference output changed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_0149aXmbpvTPyiZ7DxhD6MoJ
… MBR replacement, conflict pass

MS1LabeledWorkflow -targeted_quantification (second review round, findings 1-3, 6, 7, 9, 12):
- #1/#7: the peaks of an unidentified multiplet are used only if it can be the
  peptide (same charge and CV, every channel at one of the peptide's channels);
  otherwise they are left out like another peptide's, so the channel is not
  quantifiable. The owners a targeted feature records are only those of reserved
  peaks that entered a reported intensity (the reference, or a channel measured
  > 0), so an unidentified multiplet kept for match between runs is replaced only
  when it is the targeted peptide. Unrelated co-eluting multiplets stay.
- #6: a non-identified channel's peak at an isotope (k >= 1, up to the
  isotopes the detection assigns to a channel) of another channel whose
  monoisotopic peak is in the spectrum is left out (e.g. Lys4 medium on the
  light M+4), so such a channel is not quantifiable (NaN) instead of measured
  from the other channel's isotopes.
- #2: a non-identified channel on a quantified channel of another peptide's
  multiplet near its elution region is not quantifiable (its peaks are left out),
  as the identified channel already was.
- #3: the conflict pass between targeted peaks uses only measured channels
  (intensity > 0), in both directions; the identified channel always is one.

Tests: new TOPP tests MS1LabeledWorkflow_12_targeted (fixture 12 targeted, medium
on light M+4 not quantifiable), _13_targeted and _13_targeted_mbr with a new
synthetic duplex fixture 13 (unrelated unidentified doublet at a heavy m/z, kept
for match between runs and identified by linking; another peptide's tail at a
heavy m/z; a NaN channel at another targeted peptide's m/z; a worse-scoring
identification that sorts first in map order and only reads the kept peak's
identified channel (#9); a wrong isotope pattern (#12)). Each new test fails
with the previous code; each fix fails at least one of them when reverted, except
the reported-intensity filter of the recorded owners. No existing reference
output changed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_0149aXmbpvTPyiZ7DxhD6MoJ
…ns not quantifiable, join on by default

Owners of reserved peaks (MultiplexFiltering, FeatureFinderMultiplexAlgorithm):
- A peak that another filtered peak reserved before keeps a record of the first writer and its mass trace
  (sparse map next to the last writer). getBlacklistOwners() returns both (BlacklistOwner{first, last},
  BlacklistWriter per writer). FFM takes the first writer's feature if its multiplet was reported, else the
  last one's, else none. So a later pattern whose RT band reaches back over a reported multiplet's peaks and
  that is dropped no longer turns them into orphans. Blacklist values, detection and thread determinism are
  unchanged (owner arrays identical with 1 and 4 threads; with rt_band 0 identical to before).
- Class test: rt_band 5, a doublet whose light channel outlasts the heavy one, followed by a dropped singlet on
  its tail: the overlapping peaks keep the doublet's light uid. The thread test compares both writers.

Re-quantification (MS1LabeledWorkflow):
- requantifyChannel_ returns NaN (not quantifiable) instead of 0 when the channel would have a value with the
  reserved peaks it skipped (pairedIntensity_ on all peaks at its position), e.g. a triplex medium channel on
  the light channel's own M+4. The log counts these separately from the absent channels. Fixture 12: the
  medium channels of SAGLEVDNVLGTSLEAPYNAPLLEK and TPELGSVDNALAYNGLSVEPLTAEK change from 0 to not
  quantifiable (reference updated).

-join_channels is true by default:
- Help text and documentation updated; TOPP_MS1LabeledWorkflow_9_default passes -join_channels false.
- The 7_partial and fixture 12 references change only in the order of a consensus feature's meta values: the
  join strips the labels of a copy of each identified partial multiplet's hit, which registers the MS1Label
  meta value names before feature_id.

Tests:
- TOPP_MS1LabeledWorkflow_12_no_requantify: -requantify false runs the resolver without owners (FAIL regex
  "Blacklist with owners"; reference with LVNELTEFAK's light channel not quantifiable).
- New fixture MS1LabeledWorkflow_14, TOPP_MS1LabeledWorkflow_14_join: a joined heavy channel is re-measured
  without the peaks an unidentified multiplet reserved at its position (H/L ~1, not ~1.25), and an
  identification on an envelope 12 ppm off its light channel is not joined to the exact heavy partial
  multiplet next to it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_0149aXmbpvTPyiZ7DxhD6MoJ
…hannel's peak; pin the owner remap, other-peptide and conflict rules

Another channel's isotope at a channel's position (measureTargeted_):
- A non-identified channel's peak at an isotope (k = 1..max of algorithm:isotopes_per_peptide - 1) of another channel is no longer
  left out on the m/z alone. The expected part of it (that channel's monoisotopic peak in the spectrum times I_k/I_0 of the
  identified sequence's isotope distribution) leaves it out only if it is at least 20 % of the peak; a smaller part is subtracted.
  So a triple Dimethyl heavy channel, 4 ppm from the medium's M+4 (~2 %), is measured again (it was not quantifiable whenever the
  medium was present); a Lys4 channel on the light M+4 of a 2.6 kDa peptide without medium signal stays not quantifiable.
- New fixture MS1LabeledWorkflow_15 (triple Dimethyl), TOPP_MS1LabeledWorkflow_15_targeted: SVEDLAFGNYQR 1:1:1 with the medium's
  unresolved M+4/M+5 in the heavy peaks gives H/L ~1.

Tests for rules that no test checked any more:
- Other-peptide reserved peaks in the targeted path: in fixture 15, FTDNTDLFR's heavy m/z is the light M+1 of the identified triplex
  GDVTALFEQR; those reserved peaks are left out (heavy not quantifiable, not measured from them).
- Owner remap of merged flanks: TOPP_MS1LabeledWorkflow_12_owners checks the owner counts of the fixture 12 log (without the remap
  the medium channel of TPELGSVDNALAYNGLSVEPLTAEK is vetoed instead, with the same consensusXML).
- Reverse half of the targeted conflict pass: TOPP_MS1LabeledWorkflow_13_swapped runs fixture 13 with the scores of NVYDLGSEK and
  AHQQQQHR swapped (MS1LabeledWorkflow_13c.idXML); NVYDLGSEK's not quantifiable heavy channel at AHQQQQHR's identified channel does
  not drop it.
- Test comments of fixtures 11 and 12 updated. No existing reference changes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_0149aXmbpvTPyiZ7DxhD6MoJ
…the identified channel, same-centroid overlap rule

measureTargeted_ estimates the part of a lower channel's isotope in a channel's peak from that
channel's monoisotopic peak. Three problems with it:

- F1: the lower channel's monoisotopic peak was taken raw, so it could hold a third channel's
  isotope. In triple Dimethyl R-peptides of 1.95 kDa and up, the light M+4 sits in the medium M0,
  so the heavy lost an extra L*(I4/I0)^2 or was left out (2.5 kDa 1:1:1: heavy NaN; 1:0:0.5:
  H/L 0.478). Now the channels of each spectrum are corrected in ascending m/z, and each
  monoisotopic estimate is taken without the isotopes of the channels below it. This is the
  triangular case of the overlap system, so one pass solves it. It also holds when the lower
  channel is the identified one.
- F2: the identified channel was never corrected, so H/L depended on which channel was
  identified (fixture 15 heavy ID: 1.018 vs 1.000 for the light ID). The expected part is now
  subtracted from the identified channel's peaks too, before they become the reference. If
  another channel's isotope makes up at least targeted_other_isotope_fraction_ of them, they stay
  the reference. The other channels' paired intensities cancel a constant reference error. But
  the identified channel's own intensity is then reported not quantifiable, as a non-identified
  channel would be, unless min_targeted_reference_spectra_ clean spectra are below that fraction.
  Dropping the reference spectra instead would lose the whole feature; reporting the value would
  carry an unbounded estimate error. A new log line counts such features.
- F3: an overlap was corrected only within algorithm:mz_tolerance (6 ppm), a mass-accuracy
  window. The Dimethyl4/Lys4 channel on the light M+4 (0.0117 Da) stayed uncorrected below
  ~1.95 kDa, although at usual MS1 resolution (FWHM 14-30 ppm) it is unresolved. Now an isotope
  is part of a channel's peak if that peak is also the nearest peak to the isotope's m/z within
  twice the tolerance, i.e. the same centroid. Twice the tolerance is the window MultiplexFiltering
  uses to look for peaks of another envelope (and the workflow's lower-envelope check). A resolved,
  visible isotope has a centroid of its own and is not taken off its neighbour.

Docs: quantifyTargeted_ describes the overlap rule, the ascending correction and the identified-
channel rule; the -targeted_quantification help mentions the subtraction and the 20 % rule.

Tests: fixture 15 regenerated (generator reproduces the old and the new files byte for byte).
- Isotopes are merged within the FWHM at a resolution of 120,000 at m/z 200, instead of 7 ppm.
  The 7 ppm window sat between SVEDLAFGNYQR's two Dimethyl offsets (4.1, 8.2 ppm) and dropped
  the light M+4 although it is above the noise level.
- Ten isotopes per species instead of six.
- New light-ID cases:
  - SVEDLAFGNYQSVEDLAFGNYR 2.5 kDa 1:1:1 (chain: 17 % in both the medium and the heavy)
  - SVEDLAFGNYQGEDVTALFEQLR 1:0:0.25 and SVEDLAFGNYQGEDVTALFEQR 1:0:0.5, with the light M+4 at
    the medium's m/z
  - TALFEQLSVEDLAFGNYQGDR 1:2:1 (heavy 26 % medium M+4)
- New tests 15_heavy_id and 15_medium_id (+_out1) run the same data with peptides identified as
  heavy or medium. The values agree with the light IDs within 0.3 %. TALFEQLSVEDLAFGNYQGDR's
  identified heavy is reported not quantifiable, M/L 2.

Reference changes (MS1LabeledWorkflow_15_out.consensusXML; no other reference changed, all other
outputs of the 89 MS1LabeledWorkflow tests are identical to fa3a1ee):
- SVEDLAFGNYQR medium 1314428 -> 1314363. The new fixture merges the light M+4/M+5 into the
  medium M0/M1 (+1.8 %, which fa3a1ee keeps: 1338196); the new rule subtracts it.
- SVEDLAFGNYQR heavy 1314363 -> 1314387. The medium estimate is now without the light M+4
  (fa3a1ee subtracted an extra L*r4^2, -0.05 %); +0.002 % from the light M+8 now generated.
- GDVTALFEQR (detected) medium +0.99 %, heavy +0.006 %, the same with both binaries. The
  generator merges the light M+4 (10 ppm) into the medium M0, and the detection does not
  correct overlaps.
- New features for the four new peptides, protein abundances accordingly. Log counts: 6 features
  (7 measured, 1 absent, 4 not quantifiable), was 2 (2/1/1).

Fail-before:
- With the fa3a1ee binary, all six fixture-15 tests fail.
- Mutants:
  - raw monoisotopic estimate: 15_targeted, 15_medium_id (+out1), 15_heavy_id_out1,
    12_targeted (+out1)
  - identified channel uncorrected: 15_heavy_id (+out1), 15_medium_id_out1
  - identified channel always reported: 15_heavy_id (+out1)
  - old 6 ppm criterion: the three fixture-15 _out1 tests

Duplex Lys8/Arg10 (no channel within k <= 5 isotopes of another): the run-028 window with
-targeted_quantification is identical except ids/dates.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_0149aXmbpvTPyiZ7DxhD6MoJ
…ts peaks in the conflict pass; fall back to its measured peaks if the subtraction removes them

Since the identified channel can be reported not quantifiable (NaN), two
fixes in MS1LabeledWorkflow's targeted quantification:

- One signal, one peptide: the conflict pass registered and checked only
  channels > 0. Two identifications on the same peaks whose identified
  channels were both NaN (e.g. heavy-identified isomers on a heavy that
  is mostly the medium's M+4) were both kept with identical values. A
  peak now reads its identified channel whatever its reported value (it
  is the reference of the other channels) besides its measured ones.

- The subtraction of the other channels' isotopes is clamped at 0 and
  also applies to the identified channel. An unrelated peak at a lower
  channel's m/z, taken for that channel, could remove the identified
  channel's peaks in every spectrum, and the feature was lost with the
  channels the light-ID run measures. If the subtraction leaves the
  identified channel fewer than three reference spectra although its
  measured peaks have them, the subtracted part cannot be right: its
  peaks are used as measured (reference, isotope gate, RT, lower-envelope
  check, co-elution profile), and its own intensity is not quantifiable.
  Nothing changes for features that keep their reference spectra.

Fixture 15 (triple Dimethyl) gains SVEDLAFGNYQGEDVTALR 1:0:1 with an
unrelated co-eluting peak at the absent medium's m/z (light ID; heavy ID
in _heavy.idXML) and, in _heavy.idXML, a worse-scored heavy isomer of
TALFEQLSVEDLAFGNYQGDR. References: one new feature (L only, as with the
light identification) and the protein that comes with it; in the
heavy-ID run the isomer stays unassigned. Existing features unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_0149aXmbpvTPyiZ7DxhD6MoJ
…verage

develop's only new commit is the squash of #10781, whose tree equals 78bfeaa,
the #10781 head this branch is built on; so this branch's tree is kept as is.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_0149aXmbpvTPyiZ7DxhD6MoJ
…oxygen reference

'@ref run:' made doxygen look up 'run:' (Doxygen_Warning_test failed on CI).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_0149aXmbpvTPyiZ7DxhD6MoJ
…nel intensities, absent only without a peak (targeted)

A channel measured from peaks paired with a reference (targeted quantification,
re-quantification of missing channels, re-measurement of joined channels) is
accepted only if its peaks show its isotope pattern in at least two spectra
paired with the reference: its first two isotopes, and no peak one isotope
below above 30 % of its monoisotopic peak (MultiplexFiltering's zeroth-peak
check). Otherwise the channel is not quantifiable (NaN), never 0. The reported
value stays the estimate over all paired peaks.

A peak one isotope below a channel is taken as the peptide's own only if it is
isotope 0 to maxIsotope_() of another channel, as MultiplexFiltering exempts
only the isotopes of the pattern. Without that bound, the light M+7 next to the
Lys8 channel's M-1 switched the check off, also for the identified channel of
the targeted quantification.

Targeted quantification: a channel without a value that is not interfered is
reported absent (0) only if none of its isotopic peaks is seen within the
elution boundaries, otherwise not quantifiable. The default re-quantification
keeps its meaning of 0. The join keeps its minimum of six spectra with paired
peaks on the count without the pattern requirement.

Tests: new fixture MS1LabeledWorkflow_16 (Lys8/Arg10 duplex with targeted and
re-quantified cases, plus a Dimethyl case for the exemption). In fixture 15,
SVEDLAFGNYQGEDVTALR's medium channel, at whose m/z an unrelated peak sits, is
now not quantifiable instead of absent: three regexes change and the three
references lose that one element.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_0149aXmbpvTPyiZ7DxhD6MoJ
…ied channel, correct the -requantify help

The bound of the lower-isotope exemption (a peak one isotope below a channel
is the peptide's own only if it is isotope M+0 to M+maxIsotope_() of another
channel) also applies to the identified channel's clean elution peak in the
targeted quantification, but no test covered that half: keeping the old
unbounded exemption for the identified channel alone passed every test.
New test TOPP_MS1LabeledWorkflow_16_heavy_id (fixture 16 with
MS1LabeledWorkflow_16_heavy.idXML): LSDEFVNGAYK is identified in its Lys8
channel, whose peaks are the M+1/M+2 of an unrelated envelope whose M0 lies
one isotope below, at the light M+7. It is not quantified for want of a clean
elution peak of the identified channel (before: L 1.2e6, H 7.4e5);
TNLGEFAVDR's light identification gives the one feature. The test fails with
the previous binary and with that mutation, and passes now.

-requantify help: the isotope pattern names the exemption (a peak one isotope
below that is an isotope of another channel does not count), and the channel
is paired with the most intense detected channel instead of "the reference
channel", which could be read as 'ratios:reference_channel'. The comment on
the join's rejected pairs includes re-measured channels without a value.

Correction to the message of the previous commit: in the join, a re-measured
channel that does not show its isotope pattern gives no NaN channel; the
candidate is not joined, and both partial multiplets stay as they are.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_0149aXmbpvTPyiZ7DxhD6MoJ
…clarify the absent / not quantifiable wording

- Fixture 16: VDTYQLAGNR's heavy channel now shows its isotope pattern paired
  with a clean light spectrum in exactly one spectrum (one heavy M1 peak added
  7 s before the apex; the mzML differs in that spectrum only). It stays not
  quantifiable with the required two pattern spectra; with one, it would be
  measured (H/L 0.50), so TOPP_MS1LabeledWorkflow_16_targeted now pins
  min_pattern_spectra_. No regex or reference changes.
- -requantify help and class doc: a re-quantified channel is absent (0) only if
  its first two isotopic traces are not seen together in two spectra; only
  otherwise is it not quantifiable for lack of its isotope pattern (or because
  those traces lie only on reserved peaks). The previous wording also put the
  absent case under the not-quantifiable clause.
- Class doc: peaks reserved by another multiplet make a channel not
  quantifiable without measuring it (not "only" cause of NaN).
- Final NaN log line: "the channel's peaks" instead of the ambiguous "its peaks".

Correction to the previous commit's message: in the join, a re-measured channel
without a value (e.g. without its isotope pattern) gives no NaN channel; the
candidate concerned (whose channel failed, or against whose channel the
target's failed) is not joined to this target, and the target is joined to its
remaining candidates if their re-measurement passes, otherwise it stays as it is.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_0149aXmbpvTPyiZ7DxhD6MoJ
…ed paired-spectra count in the join

The join re-measures a candidate's channel (or the target's) with the shared
pattern gate, but no test covered it: joining a channel that fails the gate
with its ungated value, or counting min_join_paired_spectra_ on the pattern
spectra instead of all paired spectra, passed every test.

New fixture MS1LabeledWorkflow_17 (synthetic SILAC duplex, light
identifications) and test TOPP_MS1LabeledWorkflow_17_join (+ _out1):
- AVFDNLGTEYK, light only: an unrelated envelope one isotope below the heavy
  channel co-elutes with the light one, and a signal at the heavy m/z right
  after it is the join candidate. The re-measured heavy channel has 14 paired
  spectra but no pattern spectrum (its peaks there are the envelope's M+1 and
  M+2): not joined (before: joined, H/L 1.19 from the envelope).
- TFGDNLVSAER 1:0.063, channels alternating so that each is detected on its
  own: the heavy channel has 9 paired spectra, 3 of them with its pattern:
  joined, H/L 0.063. Counting only the pattern spectra (3 < 6) rejects it.

No change to the program; all other tests and references are unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_0149aXmbpvTPyiZ7DxhD6MoJ
…ten lines, word the lower-isotope rule as implemented

- -targeted_quantification: re-flow the help to nine lines plus 'false:' (it had grown to eleven, and TOPPBase shows at most ten
  per option, so --help replaced the lines on which identifications are not measured by "..."); the text is unchanged.
- -join_channels: name the second reason a candidate is not joined, a re-measured channel that is absent or not quantifiable
  (e.g. its peaks do not show its isotope pattern), as the log line and the doxygen already do.
- The "not quantifiable" log line of the re-quantification, the docs of lower_isotope_fraction_, min_pattern_spectra_ and
  pairedIntensity_, and the fixture 16 comment: a pattern spectrum has no peak one isotope lower that exceeds 30 % of the
  channel's monoisotopic peak (as the -requantify help says), not "no stronger envelope one isotope below".

No change in behaviour or quantitative output; the 16_requant regex stops before the changed part of the log line.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_0149aXmbpvTPyiZ7DxhD6MoJ
…xemption and the targeted absent rule on all isotopes read

- The exemption of a peak one isotope below a channel (an isotope M+k of another channel) holds for
  0 <= k <= n, n + 1 the maximum of 'algorithm:isotopes_per_peptide'. Only k = 3 (exempt) and k = 7 (not
  exempt) were tested, so a bound of k < n, or one hard-coded from 3 to 6, passed. The Dimethyl case of
  fixture 16 (medium M-1 on the light M+3, k = 3) now also runs with isotopes_per_peptide 3:4 (n = 3:
  still exempt, the medium is measured) and 3:3 (n = 2: not exempt, the medium is not quantifiable).
- In targeted quantification a channel is absent (0) only if none of its isotopic peaks read (M+0 to
  M+2) is seen within the elution peak. Only M0 was tested. Fixture 16 gets two light-identified
  peptides (new MS1LabeledWorkflow_16_no_mono.idXML) whose heavy channel shows an unrelated envelope
  on its M+1/M+2, resp. M+2/M+3, and nothing at its M0: both heavy channels are not quantifiable
  (they were reported as absent).
- The added peaks lie at m/z 672-693, RT 122-178, apart from the other cases; the FASTA gets the two
  proteins. All other outputs of fixtures 16 and 17 are unchanged (only the whitelisted spectra_data
  line differs); no existing reference or regular expression changed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_0149aXmbpvTPyiZ7DxhD6MoJ

@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 for high- and medium-priority issues only (no nits) and checks whether the PR has tests and measurements. I read the code at 4e8bd11 against claude/issue-10782-silac-coverage (81788e3), so only this PR's change on top of #10783. Please double-check anything before acting on it. A maintainer will follow up.

I could not build OpenMS or run the TOPP tests here, because the vcpkg sources and Arrow ≥ 24 are not available. Instead, I copied lowerIsChannel_, pairedIntensity_ and the targeted 0/NaN bookkeeping into small standalone g++ programs and used them to check the isotope bound, the boundaries of the gate and the finding below.

Verdict: no high-priority issue. The pattern gate, the lower-isotope bound and the join change do what the description says. I found one medium-priority problem: the new targeted rule "absent only without a peak" is not applied to M+2 peaks that belong to another detected peptide.

Checked and found sound:

  • The gate (pairedIntensity_, MS1LabeledWorkflow.cpp:1671).
    • A pattern spectrum needs the first two isotopes, at least one isotope paired with the reference, and a lower peak no larger than 0.3 × M0. The test is "exceeds", as in MultiplexFiltering::checkForSignificantPeak_.
    • A value is accepted with 2 or more pattern spectra (:1742).
    • The sums are unchanged, so every value that is kept is identical to before, which matches "bit-identical".
    • In the harness, a lower peak of exactly 0.3 × M0 passes, 1 pattern spectrum gives NaN and 2 give a value.
  • The bound (:1610).
    • k <= maxIsotope_() matches the satellites that MultiplexFiltering exempts in its zeroth-peak check (isotopes 0 .. isotopes_per_peptide_max_ - 1, MultiplexFiltering.cpp:167, :246-253).
    • Harness results at 6 ppm, z = 1–4:
      • Never exempt with the default 3:6: Lys8 (k = 7), Arg10 (k = 9), and two-label Dimethyl8 against light (k = 7).
      • Exempt with 3:6: Lys4 and Dimethyl4 (k = 3), Arg6/Lys6 (k = 5, residual 0).
      • Arg6 loses the exemption at 3:5 or lower.
    • lowerPeak_ reads in the same 2 × tolerance window that lowerIsChannel_ checks. So an isotope of another channel that falls outside the exemption window is never read as the lower peak either.
  • Status mapping.
    • The re-quantification gives NaN only for a channel that has a value but fails the gate. It still gives 0 only when the first two isotopes are not seen together in two spectra.
    • The log counters split the cases without overlap.
    • NaN handles are removed before export (:2728), and NaN targeted channels are never inserted (:2460), so no NaN reaches consensusXML, mzTab or QPX.
    • The join rejects NaN (:1247), so a joined multiplet never carries a gated channel. The minimum of 6 spectra still counts all paired spectra (result.paired).
  • The exemption list. In the re-quantification it includes the resolver's dummies at their expected m/z (MultiplexResolverAlgorithm.cpp:566). In the join it covers only the channels present, which the description lists as a known limitation (it cannot occur in duplex).
  • Expected-output churn in fixture 15 is explained.
    • Each of the three references loses exactly one element: the it="0.0" medium of SVEDLAFGNYQGEDVTALR.
    • The new seen rule turns that channel from 0 into NaN, because the unrelated peak sits on its M0.
    • The regex counts move by one, from absent to not quantifiable.
  • 0 vs NaN for the same evidence. When only the M0 is seen, the re-quantification still reports 0 (DGVNAYLTEFR) and targeted mode reports NaN (AFDNLVGSTK). This is deliberate and documented.
  • CI. build-and-test (ubuntu-24.04-arm, g++) is green. The other build-and-test jobs were still running when I looked.

Medium: targeted mode reports a channel as absent when its only peak is another detected peptide's peak at its M+2

Where: measureTargeted_ reads M+0 to M+2 of every channel.

  • A peak that belongs to another peptide is set to 0 in intensity[c] (MS1LabeledWorkflow.cpp:1971).
  • It is recorded in reserved[c] only for the first two isotopes (:1973, if (other && k < 2)).
  • The new rule takes seen from intensity[c] and interfered from reserved[c] (:2114-2117). So such a peak at M+2 counts as neither.

The comment at :2111-2113 assumes the left-out peaks are covered by reserved. That held for #10783's M0/M1 rule. It no longer holds now that seen also reads M+2.

Scenario: a light-identified peptide whose heavy channel shows nothing at its M0 and M1 within the elution peak, while another envelope sits on the heavy's M+2 (the LGYDVFNTSEAR case of _16_no_mono).

  • Envelope not detected: NaN. _16_no_mono pins this.
  • Envelope detected as another peptide's multiplet: 0 (absent). The same applies to any reserved peak when the blacklist has no owners, because occupied then returns true for every reserved peak (:2353).

The channel shows the same evidence in both cases but gets opposite statuses. The 0 contradicts the documented rule "absent (0) only if none of its isotopic peaks is seen within the boundaries". Before this PR, both cases gave 0. The difference comes from widening seen to M+2 without widening reserved. The case is narrow: it needs targeted mode, which is off by default, and empty M0/M1 positions.

My standalone copy of this bookkeeping confirms it:

  • M+2 peak not reserved: NaN.
  • The same M+2 peak reserved by another peptide: 0.
  • The same peak at M+1, reserved: NaN.

Suggested mitigation: record left-out peaks for every isotope read. reserved is used only in the interfered check (:2114), so nothing else changes. Sketch, not compiled:

          if (other) { reserved[c].back() = true; } // any isotope read: a left-out peak means the channel's absence cannot be told

Also update the comment on reserved (:1933). If 0 is the intended answer when M0 and M1 are empty, the other consistent option is to drop M+2 from seen. That would change the _16_no_mono expectation, so the two cases need to agree one way or the other. A _16_no_mono variant where the M+2 envelope is detected and identified as another peptide would pin whichever rule you choose.

Tests

  • Good:
    • Two new synthetic fixtures with 11 new tests, roughly one per rule. The CMake comments give the "was" value for each case.
    • The regexes I checked fail on #10783's logic as the description says. For example, _16_no_mono expects "0 absent, 2 not quantifiable", and _16_heavy_id expects the heavy identification to be dropped.
    • The 3:4 / 3:3 pair pins the bound exactly: a k < n or a k <= n + 1 mutant fails one of them.
  • Gap: the exemption is never exercised in the default path.
    • It is tested only in targeted mode (_16_dimethyl*). Every re-quantification and join test uses Lys8/Arg10, where the exemption never applies.
    • For Lys4, Dimethyl4 or Arg6 data, the default re-quantification now depends on it. With averagine, the light M+3 is 0.16 of the light M0 at 1.5 kDa and 0.32 at 2 kDa. So from about L:M 2:1 (1.5 kDa) or 1:1 (2 kDa) on, the light M+3 exceeds 30 % of the medium M0. Without the exemption, the medium would then be NaN. The same happens if the channel_mzs passed in requantifyMissingChannels_ ever lost the light.
    • Suggested test: default settings with [Dimethyl0][Dimethyl4] on a 1:0.2 duplex. The light should be detected (M0–M3 recorded) and the medium missed by the detection (e.g. only its M0/M1 recorded). Expect the medium re-quantified at M/L 0.2 and no "not quantifiable: their peaks do not show the channel's isotope pattern" line.
  • Gap from the finding above: the detected-interferer variant of _16_no_mono.

Measurements

Yes, on real data, and thorough for Lys8/Arg10:

  • the PXD022659 dilution series (7 points × 3 runs) and the 1:1 three-run set, with before/after numbers per point;
  • false values at 0 % heavy, and the coverage cost in both modes;
  • runtime and memory (CPU time ratio 1.00, ±0.5 % memory).

Missing:

  • Labels where the exemption applies (Lys4, Dimethyl, Arg6). Every measurement uses Lys8/Arg10, where the bound only removes the exemption. The cheapest check is one Dimethyl or Lys4 run with default settings, before and after. The new log line counts the re-quantified channels that turn NaN, and the cells in the output show what is lost.
  • Correct 0s in targeted mode.
    • Under the new rule, a channel is absent only if no peak is seen at its M0–M2 anywhere in the elution peak. Reported 0s at 70–30 % heavy fell to 2–5 % of their former count.
    • The 0 % heavy runs would show what this costs in true absences: the number of targeted heavy channels reported as 0 vs NaN in those three runs, #10783 vs this PR.
  • False 0s in the default re-quantification at 1:1, counted the same way as targeted mode's 538 → 28 (optional). The re-quantification still reports 0 when only the M0 is seen, so this count would show whether the default path needs the same rule.

Generated by Claude Code

… targeted channel not quantifiable

The targeted quantification leaves out the peaks of other peptides or
channels (on another multiplet, reserved by another feature, or mostly
another channel's isotope), but recorded such a peak as occupying the
channel only for its M0 and M1. A left-out peak at M+2, e.g. a peak of
another peptide's detected multiplet, therefore counted neither as seen
nor as occupying the channel, which was reported absent (0), while the
same peak of an undetected envelope made it not quantifiable. The peak
is now recorded for every isotope read (M+0 to M+2): a channel is absent
only if none of these positions holds a peak, its own or another's,
within the elution peak.

Tests, on a new synthetic fixture MS1LabeledWorkflow_18 (its cases need
detected features, which would shift the unique ids in fixture 16's
reference):
- TOPP_MS1LabeledWorkflow_18_occupied: a targeted heavy channel with
  nothing at its M0/M1 whose M+2 is the light M0 of a detected,
  identified duplex of another peptide: not quantifiable (was absent).
- TOPP_MS1LabeledWorkflow_18_dimethyl_requant: default re-quantification
  of a [Dimethyl0][Dimethyl4] 1:0.2 duplex whose medium was missed and
  whose M-1 is the light M+3 (0.66 x the medium M0): the exemption of
  another channel's isotope keeps the medium's pattern, M/L 0.2, and no
  channel is reported not quantifiable for want of its pattern.
Both with a reference consensusXML.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_0149aXmbpvTPyiZ7DxhD6MoJ

Copy link
Copy Markdown
Contributor Author

Answers to the remaining items of the initial review (the M+2 finding is answered in its thread).

Test: the exemption in the default path

New TOPP_MS1LabeledWorkflow_18_dimethyl_requant (+ _out1):

  • Setup: default settings, -labels "[Dimethyl0][Dimethyl4]", GSLDVFTEPNYGAR at 1:0.2. The light (M0–M+3) is detected. The medium (M0/M1 only) is missed and re-quantified. The medium M−1 lies 0.0058 Th from the light M+3 (k = 3), which is 0.66 × the medium M0 in every pattern spectrum.
  • Expected: "Re-quantified 1 channel(s)", M/L 0.2000, and no "not quantifiable: their peaks do not show the channel's isotope pattern" line (FAIL_REGULAR_EXPRESSION).
  • Pins unchanged behaviour: it passes with [FEATURE] MS1LabeledWorkflow: owner-aware blacklist, join of separately detected channels, targeted quantification #10783 too.
  • Mutants: lower_is_channel = false in requantifyChannel_, or an empty channel_mzs in requantifyMissingChannels_, fail this test and _7_partial.
  • Correction: the re-quantification exemption was already pinned by _7_partial (default settings, a Lys4 medium whose M−1 is the light M+3). The join uses the same requantifyChannel_.

Real data with labels where the exemption applies

  • Data: PXD003327, E. coli triple SILAC Lys4/Arg6 + Lys8/Arg10, so the exemption applies at both k = 3 (Lys4) and k = 5 (Arg6).
  • Known mix: K 1:2:4 and R 4:2:1.
  • Run: Chris_Ecoli_1-2-4, the authors' mzML.
  • Settings: default settings with -labels "[][Lys4,Arg6][Lys8,Arg10]".
  • IDs: (A) the authors' search (PD msf, Percolator q ≤ 0.01); (B) an independent SimpleSearchEngine search at 1 % FDR.
  • Cell: all three channels > 0. 1.5x: all ratios of the cell within 1.5x of the expected value.
IDs / input channels the gate makes not quantifiable cells #10783 → this PR lost / gained within 1.5x: kept / lost cells
A, profile 18 452 → 440 (−2.7 %) 12 / 0 88.4 % / 33.3 %
B, profile 15 346 → 336 (−2.9 %) 10 / 0 89.9 % / 30.0 %
A, MS1 centroided 20 460 → 441 (−4.1 %) 19 / 0 90.5 % / 47.4 %
  • What was lost: each lost cell lost its weakest channel (the heavy of R peptides at 1:4, the light of K peptides). Its old value was biased: R-peptide H/L median 0.41, against a nominal 0.25 and a class median of 0.31.
  • Accuracy: centred on the class medians (which removes a label offset of the data), kept cells go 95.0 → 95.2 % within 1.5x; the lost cells were 50–58 %. Only 1–2 kept cells change value.
  • Exemption at work: the exempted medium channel loses only 2 values. A mutant without the exemption loses 13 more cells, and those were all within 1.5x (class-centred). In 9 of the 452 cells, the light isotope on the medium M−1 exceeds 30 % of the medium M0; the PR keeps all 9.
  • Caveat: one run, so the lost-cell shares rest on n = 10–19.
  • Binary: 4e8bd11 logic. 914abeb changes only targeted mode, which these default-settings runs do not use.

Targeted mode: true 0s at 0 % heavy

Heavy channels of light-identified targeted features in the three pure-light runs, mean per run. At 0 % heavy every 0 is correct and every value > 0 is false.

reported 0 NaN > 0 (false)
#10783 12,167 1,317 79
this PR (914abeb) 4,389 9,148 31

So the rule costs about 7,800 true absences per pure-light run, which become NaN: 90 % → 32 % of these heavies are reported as 0. At 1:1, where a 0 is wrong, false absents go 538 → 27 (C_099). This is the price of "absent only if nothing is seen at M+0 to M+2". The PR description now states it.

Default re-quantification: 0s at 1:1 (optional item)

  • Count: re-quantified channels reported as 0 in the three 1:1 runs: 173 / 166 / 166, identical in [FEATURE] MS1LabeledWorkflow: owner-aware blacklist, join of separately detected channels, targeted quantification #10783 and this PR. The 0 of the default path keeps its meaning, so this PR changes none of them.
  • All false: at 1:1 every one of them is a false absent, unless the partner position itself is wrong (misidentification, label state).
  • Not weak features: their detected channel has a median intensity of 1.9e7, against 2.1e7 for re-quantified channels that got a value.
  • Comparison: the default path thus reports about 6x more false 0s per run than targeted mode now does (27).
  • Not changed here: applying the targeted rule would change the meaning of develop's -requantify 0, so I left it out of this PR and listed it under "Still open".

Other updates

  • The description is updated with these numbers, the new tests and the local test count.
  • Local tests: 382/382 related tests pass.
  • CI: "Build and Test" was started by hand on 914abeb.

Generated by Claude Code

… owners and targeted quantification per CV)

MS1LabeledWorkflow_19 is fixture 8 acquired at two FAIMS compensation voltages (-45 V and -60 V, one MS1
spectrum per CV at every RT, both with the same RT), with the identifications at -45 V. A peptide's
heavy channel at -60 V is not joined to its light partial multiplet at -45 V, the missing channels at
-45 V are re-quantified from the -45 V spectra only and not vetoed or skipped because of peaks reserved
at -60 V, and the targeted quantification measures at the CV of the identification. The samecv input
(the same peaks with two heavy channels at -45 V) is the positive control: the join then gives fixture
8's values and the targeted quantification measures the heavy channel.

Eight tests: _19_faims_split (+_out1), _19_faims_owners, _19_faims_samecv (+_out1),
_19_faims_targeted (+_out1), _19_faims_samecv_targeted. Every test fails for at least one scratch
mutant that drops a CV check: the join candidate CV check, the CV match of the blacklist spectrum
lookup, the CV filters of the re-quantification and of the targeted measurement, the candidate's CV,
and both CV checks of MultiplexResolverAlgorithm (owner check and plain blacklist check). The inputs
were generated from fixture 8's peaks by a stand-alone script that is not part of the repository.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_0149aXmbpvTPyiZ7DxhD6MoJ
…Workflow: limits of blacklist owners and channel joins

Only the first and the last filtered peak that reserved a peak are recorded: a reported multiplet that
reserved it in between loses it when the clusters of both are dropped, and the peak then counts as
reserved by no reported feature. That needs at least three writers of one peak, in practice only with
algorithm:rt_band > 0. Stated at MultiplexFiltering::getBlacklistOwners() and applyBlacklistEntries_(),
in the provisionalOwners() comment, in FeatureFinderMultiplexAlgorithm::getBlacklist() (whose rule for
peaks reserved by several patterns is corrected: the first one if its multiplet was reported, else the
last one) and briefly in the description of algorithm:use_blacklist_owners.

joinChannelsOfIdentifiedPeptides_: a partner is joined to one partial multiplet only; another
identified partial multiplet of the same channels that it spans keeps its own multiplet, in which the
partner's channel is not quantifiable, so the summed channel abundances miss the partner channel's share
of it (or, if the partner was the reference, count its share of the identified channels twice).

No behaviour change.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_0149aXmbpvTPyiZ7DxhD6MoJ
…klist owners compactly

The owner bookkeeping of the blacklist cost memory in proportion to the number of reserved peaks, which grows
strongly with algorithm:rt_band > 0 (a pattern reserves its mass traces over the RT band, so many peaks are
reserved several times):

- MultiplexFiltering: the first owner of a peak reserved by more than one filtered peak was kept in an
  unordered_map (one node per such peak, plus a hash lookup on every overwrite). blacklist_owner_ now encodes
  the owners itself: -1 not reserved, >= 0 the only filtered peak that reserved the peak, <= -2 the index
  (-2 - value) of a record {first, first_value, last} in blacklist_owner_records_. The record is created when
  another filtered peak reserves the peak for the first time, so the first owner and its value are the same as
  with the map; later writers only update record.last. O(1) per write, no hash map.
- filtered_peaks_ and BlacklistWriter store the peak index as unsigned instead of size_t (BlacklistWriter
  shrinks from 24 to 12 bytes). Owners and records are indexed by int, so applyBlacklistEntries_() throws
  Exception::InvalidSize before the filtered peaks, or the records, would exceed INT_MAX (one check per
  filtered peak; documented).
- New getBlacklistOwners(Size spectrum_index) returns the owners of one spectrum. FeatureFinderMultiplexAlgorithm
  reads them spectrum by spectrum after generating the maps (centroided and profile branch), instead of holding
  a full copy of all owners (getBlacklistOwners()) during clustering and map generation. getBlacklistOwners()
  stays as a convenience for the class test.

What is recorded and reported does not change: only the first and the last writer of a peak, as documented.
Outputs are unchanged: on an RT slice (25-37 min, MS1 only) of PXD022659 run 099 with the FeatureFinderMultiplex
parameters of the runtime measurement plus -test -out_blacklist, featureXML, consensusXML and the blacklist
mzML (including owner_unique_id_high/low) are byte-identical to before at rt_band 0 and 5, and so are the logs
apart from timings. Peak RSS on that slice (1 thread, without -out_blacklist as in the runtime measurement):
rt_band 0: develop 197.3, before 213.6, now 206.1 MiB; rt_band 5: develop 241.0, before 288.3, now 259.5 MiB.

MultiplexFilteringCentroided_test additionally checks that getBlacklistOwners(Size) matches
getBlacklistOwners() and throws for an index past the last spectrum.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_0149aXmbpvTPyiZ7DxhD6MoJ
… of a peak

MultiplexFilteringCentroided_test gets a section that reserves peaks of two spectra by hand
(applyBlacklistEntries_() through a derived tester) for three filtered peaks A, B and C, and checks
getBlacklistOwners() against hand-computed owners: a single writer is first and last owner; A rewriting its
own peak adds no record, and the mass trace it leaves is the one kept for the first owner; of three writers,
A (first) and C (last) are kept and B is dropped; a second record in the second spectrum; the number of
records after each writer; getBlacklistOwners(Size) and its IndexOverflow; alignment with getBlacklist()
across a white peak. Every expected writer has a nonzero mass trace, so none of them equals a value-initialized
BlacklistWriter. A list of the wrong size fails its size check and skips only the checks of its entries, not
the independent checks after it.

It replaces the check in the threads section that compared getBlacklistOwners(s) with
getBlacklistOwners()[s], which could not fail since the latter is built from the former.

MultiplexFiltering.h: the doc of applyBlacklistEntries_() put the last owner in blacklist_owner_; once a
peak has a record, the record holds it.

Each of these mutants of MultiplexFiltering.cpp fails the new section: the record's first value taken from
the new entry; record.last not updated; a record also on an own rewrite; no records at all; every record
addressed as the first one; the first owner's mass trace read from the current value; the per-spectrum
owners stopping at the first white peak; record.first set to the new owner. Six of them pass the rest of
the test.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_0149aXmbpvTPyiZ7DxhD6MoJ
…he join's doc

joinChannelsOfIdentifiedPeptides_: the one observed case of a partner that spans two identified partial
multiplets is a light elution split in m/z because its centroids scatter by more than the detection's m/z
tolerance (8.1 ppm between the two partials, tolerance 6 ppm), not a split within that tolerance as the
doc said.

No behaviour change.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_0149aXmbpvTPyiZ7DxhD6MoJ
@coderabbitai

coderabbitai Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

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: e85c6da6-f0d6-4b90-8e40-2022dbc18232
Commits

Reviewing files that changed from the base of the PR and between 3aa7bc2 and 3d608e3.

Files selected for processing: 22
  • src/tests/topp/CMakeLists.txt
  • src/tests/topp/MS1LabeledWorkflow_15_heavy_out.consensusXML
  • src/tests/topp/MS1LabeledWorkflow_15_medium_out.consensusXML
  • src/tests/topp/MS1LabeledWorkflow_15_out.consensusXML
  • src/tests/topp/MS1LabeledWorkflow_16.fasta
  • src/tests/topp/MS1LabeledWorkflow_16.idXML
  • src/tests/topp/MS1LabeledWorkflow_16_dimethyl.idXML
  • src/tests/topp/MS1LabeledWorkflow_16_heavy.idXML
  • src/tests/topp/MS1LabeledWorkflow_16_input.mzML
  • src/tests/topp/MS1LabeledWorkflow_16_no_mono.idXML
  • src/tests/topp/MS1LabeledWorkflow_16_out.consensusXML
  • src/tests/topp/MS1LabeledWorkflow_17.fasta
  • src/tests/topp/MS1LabeledWorkflow_17.idXML
  • src/tests/topp/MS1LabeledWorkflow_17_input.mzML
  • src/tests/topp/MS1LabeledWorkflow_17_out.consensusXML
  • src/tests/topp/MS1LabeledWorkflow_18.fasta
  • src/tests/topp/MS1LabeledWorkflow_18.idXML
  • src/tests/topp/MS1LabeledWorkflow_18_dimethyl.idXML
  • src/tests/topp/MS1LabeledWorkflow_18_dimethyl_out.consensusXML
  • src/tests/topp/MS1LabeledWorkflow_18_input.mzML
  • src/tests/topp/MS1LabeledWorkflow_18_out.consensusXML
  • src/topp/MS1LabeledWorkflow/MS1LabeledWorkflow.cpp
Files with no reviewable changes: 3
  • src/tests/topp/MS1LabeledWorkflow_15_heavy_out.consensusXML
  • src/tests/topp/MS1LabeledWorkflow_15_out.consensusXML
  • src/tests/topp/MS1LabeledWorkflow_15_medium_out.consensusXML

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

MS1LabeledWorkflow now uses isotope-pattern evidence during re-quantification, channel joining, and targeted quantification. Channel outcomes distinguish absent channels from channels that are not quantifiable. TOPP tests and fixtures cover these checks and outcomes.

Changes: MS1 labeled quantification

Layer / File(s) Summary
Re-quantification isotope-pattern checks
src/topp/MS1LabeledWorkflow/MS1LabeledWorkflow.cpp
Re-quantification tracks paired spectra and spectra meeting the isotope-pattern requirement. Results distinguish pattern failures from absent or reserved-peak channels.
Channel-join re-measurement
src/topp/MS1LabeledWorkflow/MS1LabeledWorkflow.cpp
Channel joining rejects candidates when re-measurement yields no positive intensity or too few paired spectra.
Targeted channel classification
src/topp/MS1LabeledWorkflow/MS1LabeledWorkflow.cpp
Targeted quantification checks isotope patterns and lower-isotope interference across channels. It classifies channels with observed signals but failed checks as not quantifiable, rather than absent.
Workflow regression tests and fixtures
src/tests/topp/CMakeLists.txt, src/tests/topp/MS1LabeledWorkflow_15_*_out.consensusXML, src/tests/topp/MS1LabeledWorkflow_16.*, src/tests/topp/MS1LabeledWorkflow_16_*, src/tests/topp/MS1LabeledWorkflow_17.*, src/tests/topp/MS1LabeledWorkflow_17_out.consensusXML, src/tests/topp/MS1LabeledWorkflow_18.*, src/tests/topp/MS1LabeledWorkflow_18_*
TOPP expectations and workflow fixtures cover isotope-pattern checks, channel classification, re-quantification, and joining behavior.

Possibly related issues

  • OpenMS/OpenMS#10782 — The issue covers missing SILAC ratios in targeted quantification and channel joining; this PR updates both paths with isotope-pattern checks and revised channel classification.

Possibly related PRs

  • OpenMS/OpenMS#10783 — It adds channel joining, targeted quantification, and owner-aware re-quantification in the same workflow paths changed here.
  • OpenMS/OpenMS#10781 — It changes upstream multiplex channel detection; this PR adds downstream paired-channel and isotope-pattern checks.

Suggested labels: major

Suggested reviewers: jpfeuffer

Change: Bug fix

Merge Risk: Minimal · up to 3d608

No actionable merge-blocking issue was established; the change is ready to merge after normal checks.

Pre-merge checks: Passed 5
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: requiring isotope-pattern evidence for paired channel intensity estimates in MS1LabeledWorkflow.
Docstring Coverage Passed Docstring coverage is 90.00% 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.
Full details: Docstring Coverage

Explanation

Docstring coverage is 90.00% 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 10 functions across 1 files. (16 skipped: 16 unsupported.)

Finishing Touches
Generate docstrings
  • Commit to this branch
  • Create a new PR
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 isotope trace,
Two paired scans must show the pattern in place.
A missing peak is not the same
As a signal that fails the naming game.
The channels sort, the tests agree,
And carrots wait for QA’s decree.

Base automatically changed from claude/issue-10782-silac-coverage to develop November 2, 2026 17:05
#10783 was squash-merged into develop. The conflicts are the lines this
branch changes in #10783's files (MS1LabeledWorkflow.cpp, the three
fixture-15 references, src/tests/topp/CMakeLists.txt). They are resolved
with #10783's head as the base, so the result differs from develop by
exactly this PR's own changes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_0149aXmabHtbvizd9Prmobpf
@timosachsenberg
timosachsenberg merged commit 84a5b3f into develop Nov 3, 2026
32 checks passed
@timosachsenberg
timosachsenberg deleted the claude/silac-paired-intensity-gating branch November 3, 2026 06:49
timosachsenberg pushed a commit that referenced this pull request Nov 3, 2026
… MBR linking; report targeted ratio counts

Targeted features took part in the ID-based alignment and in linking. On
PXD022659 that widened the alignment's maximum difference (147 -> 545 s at
50 % heavy) and with it the RT tolerance of the linking, and a targeted
feature could draw an unidentified multiplet kept for match between runs
into its own linked feature, possibly one of another peptide ~10 min away.
With -match_between_runs this changed or lost about 1 % of the peptide
ratios reported without targeted quantification.

- alignAndLink_(): targeted features are split off before the alignment,
  transformed with the transformations of the detected multiplets, and
  linked among themselves after those have been linked. Alignment, linking
  and match between runs are therefore those without targeted
  quantification. The documented exception remains: a targeted feature
  replaces the kept multiplet it is measured from.
- The promotion of an unidentified multiplet through a targeted
  identification can no longer occur; TOPP_MS1LabeledWorkflow_11_targeted_
  mbr_promoted now expects 3 targeted peptide ratios (run B has no
  VLDELTLAR value, as without targeted quantification).
- Targeted ratio counts reach the outputs (only when targeted
  quantification measured something, so other outputs do not change):
  MS1Label:peptide_ratio_targeted_count on the features (mzTab opt_global
  column), the protein-group array fraction_group_level_ratio_targeted_count
  and the QPX pg cv_param ratio_targeted_count. New tests check the QPX
  value for the one-protein fixture (0 with min_ratio_count 1, 2 with 2).

Merge of develop (#10786): the targeted references of fixtures 16 and 18
change in the two ways this PR documents (normalized ratios by one factor,
abundance arrays of groups whose only evidence is a targeted feature with a
non-quantifiable channel removed). The other targeted references gain the
targeted counts; the MBR/FAIMS ones also their new linking (ratios checked
against the old references: unchanged except the promoted case above).

All 128 tests selected by ctest -R MS1Labeled pass, as do
ProteinGroupArrowExport_test and ConsensusMapArrowExport_test.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
timosachsenberg pushed a commit that referenced this pull request Nov 3, 2026
… tolerance and the identified channel's own 30 % check

Synthetic fixtures (isotope centroids at their fine-structure positions):
- MS1LabeledWorkflow_22_heavy: fixture 22's spectra with the two
  targeted peptides identified in their heavy channel. A peak at the
  heavy M-1 that is never exempt (nine isotopes above the light, beyond
  M+5) at 0.2 x the heavy M0 keeps the identified channel (L/H 2); at
  0.4 x no spectrum is clean and the identification is not quantified.
  Pins the bound of the identified channel's own clean-spectrum check in
  targeted mode to 0.2 < t < 0.4; no test reached that check before.
- MS1LabeledWorkflow_23 (triple SILAC, re-quantification): an
  unrelated peak at 0.4 x the M0 of a re-quantified channel in every
  spectrum. 9 ppm below the heavy M-1 it is read (window of twice the
  m/z tolerance): heavy not quantifiable. Exactly at the medium M-1
  and 9 ppm from the light M+3 position, with no light M+3 centroid,
  it is not the light M+3 (identity within the tolerance itself, not
  twice) and not exempt: medium not quantifiable. 15 ppm below the
  heavy M-1 it is not read: H/L 0.5.
Also drops two double blank lines in the MS1LabeledWorkflow tests, and
names the baseline of earlier values in the fixture 20-22 comments (the
exemption by theoretical position, or no isotope-pattern check).

develop (84a5b3f) fails 10 of the 132 MS1LabeledWorkflow tests:
20_requant, 20_targeted, 20_foreign, 21_join_triplex and 23, each with
its _out1. 22_heavy passes there (the check predates #10786).

Mutants of MS1LabeledWorkflow.cpp, each killed: the old theoretical
window, the identity check within twice the tolerance and the old
window as an alternative (now also by 23), no exemption, k up to
max_isotope + 1, the join's channel list without the missing channels
or cleared, the re-quantification's list of detected channels only, a
join that ignores the identified multiplet's failed channel,
lower_isotope_fraction_ 0.0, 0.1, 0.5 and 0.54, the M-1 read within
the tolerance itself (23, 16_dimethyl_isotopes3) or within three times
it (23), and the identified channel's own check at 0.0 or 0.5 instead
of the bound (22_heavy).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_0149aXmbpvTPyiZ7DxhD6MoJ

Copy link
Copy Markdown
Contributor Author

A review after the merge found 8 points. None gives a wrong value: each turns values into NaN (not quantifiable) or is in the docs, the description or the tests. The code, docs and tests are in #10808, which also has the evidence. The description above is corrected. My earlier answer above repeats some of these statements (what was lost, the exemption at work, the 6x); the description holds the corrected version.

(M0 is a channel's monoisotopic peak, M+k its k-th isotope, and M−1 the position one isotope below its M0.)

  1. Lower-isotope exemption. It checked another channel's theoretical isotope position but read the actual centroid, and real M+3 centroids sit about 0.002–0.004 Da lower. In triple SILAC, some accurate heavy values of peptides of about 1.7–2.1 kDa became NaN when they were re-quantified, joined or measured in targeted mode. Fixed in [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, which decides per peak as MultiplexFiltering does.
  2. Lys8 comment. It said the light M+7 cannot explain a strong peak at the heavy M−1. For large peptides at a high light:heavy ratio it can. Comment corrected in [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 (no behaviour change).
  3. Description: "only re-quantified values, and only to NaN … nothing is added". This is false for the join: over 21 runs, 2 values change and 4 features are added. Description corrected; the -join_channels help is clarified in [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.
  4. Description: the exemption "never applies" for Lys8/Arg10 and "still does" for Lys4/Dimethyl. It depends on the label pair and the peptide mass; e.g. the triplex heavy is exempt against the medium M+3 above about 2 kDa. Description corrected, also the "13 more cells" line: that exemption mostly kept heavy channels (11 heavy, 8 medium).
  5. Description: "Existing log lines are unchanged". Three lines changed. Description corrected.
  6. Test gap: a join rejected by the identified multiplet's own channel. Test added in [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.
  7. Test gap: the join's exemption list, and the missing channels in the re-quantification's list. Tests added in [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, which also fixes the "Still open" join item.
  8. Test gap: the 30 % threshold was pinned only from above. Tests added in [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; it is now pinned from both sides (between 0.2 and 0.4).

The description also had three older slips, now corrected:

  • the light M+9 lies 0.025/z (not 0.013/z) from the Arg10 M−1;
  • "538 → 27" false 0s is one run (C_099), not a mean;
  • the "6x" now compares per-run figures (168 against 24–29).

Generated by Claude Code

timosachsenberg added a commit that referenced this pull request Nov 3, 2026
…only adds ratios); count ratios from targeted and re-quantified values; co-elution check for weak re-quantified channels (#10802)

* [WIP] MS1LabeledWorkflow: targeted values only add ratios; incomplete targeted evidences leave the abundances

Work in progress: not compiled or tested yet; the references of the new
TOPP tests (MS1LabeledWorkflow_11_one_protein_min1/min2) are still
missing, and those of the existing targeted tests are not regenerated.

- MS1LabeledRatioQuantifier: evidences of targeted quantification (the
  runs in the feature's meta value MS1Label:targeted_runs) only stand in
  where nothing else was measured. A peptide ratio uses them only if the
  peptide has no other evidence in that fraction group; a protein group
  ratio only if its other peptide ratios do not reach min_ratio_count;
  the normalization factors only if a (fraction group, channel) has no
  other peptide ratio. A ratio reported without targeted quantification
  therefore stays the same with it.
- MS1LabeledWorkflow: after linking, the runs in which targeted
  quantification measured a multiplet are read from its identifications
  and recorded in MS1Label:targeted_runs (removed again after the
  ratios). Targeted evidences with a channel that is not quantifiable are
  left out of the peptide and protein abundances (taken out before
  PeptideAndProteinQuant reads the map, given back afterwards).
- Without -targeted_quantification nothing changes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_0149aXmabHtbvizd9Prmobpf

* [TEST] MS1LabeledWorkflow: references for targeted values as a fallback

Compiled and tested: all 104 tests selected by ctest -R MS1Labeled pass
(class tests and TOPP tests).

- New references MS1LabeledWorkflow_11_one_protein_min1/min2: PROT_X's
  ratio is the detected YVNDLAGHEK's alone with a minimum of 1 (count 1;
  the develop binary gives count 3 with the targeted peptides mixed in),
  and includes the two targeted peptide ratios with a minimum of 2
  (count 3). Its light abundance drops from 2.99e7 to 2.68e7: the two
  light-only targeted features whose heavy is not quantifiable leave it.
  Both runs fail with the develop binary (their log lines are missing).
- Nine targeted references change, and only in two ways, checked
  against the outputs of the develop binary built in the same
  environment (which match the old references up to the whitelisted
  lines):
  - normalized ratios (protein groups and peptides), by one factor per
    (fraction group, channel): the normalization now uses only the
    peptide ratios measured without targeted quantification. Fixture 12
    moves most (factor 1.96 for channel 3), where a targeted H/L of 0.02
    had moved the median.
  - the abundance arrays of protein groups whose only evidence is a
    targeted feature with a channel that is not quantifiable (fixture 11:
    PROT_F, PROT_H; 12: PROT_A, PROT_C, PROT_D; 13: PROT_P1, PROT_PM,
    PROT_PN; 15: PROT_A, PROT_B, PROT_E, PROT_S, PROT_Q). Their ratios stay.
  No raw ratio, no other abundance and no feature changes. The
  whitelisted lines (InferenceEngineVersion, spectra_data) are kept from
  the old references.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_0149aXmabHtbvizd9Prmobpf

* [TEST,DOC] MS1LabeledWorkflow: one expression per log assertion; the targeted fallback is per channel

- The PASS_REGULAR_EXPRESSION of MS1LabeledWorkflow_11_one_protein_min1/
  min2 contained a ';', which CTest reads as a list separator, so the
  protein-group count was not checked. It is now '.'.
- A peptide ratio uses targeted evidences where the peptide has no other
  evidence of that channel in that fraction group (as implemented); the
  class doc, the code comment and the tool doc say so explicitly now.
  New case in MS1LabeledRatioQuantifier_test: a triplex peptide detected
  as L/M with its heavy missing and measured by targeted quantification
  as L/H keeps its detected M/L and gets the targeted H/L.

All 104 tests selected by ctest -R MS1Labeled pass.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_0149aXmabHtbvizd9Prmobpf

* [FIX] MS1LabeledWorkflow: a multiplet identified only by targeted features counts as targeted in all runs

With -match_between_runs, an unidentified multiplet of another run can
take over the identification of a targeted feature in linking. Its
evidence exists only because of targeted quantification, but it counted
as detected, entered the normalization and the detected peptide ratios of
its protein groups, and could move ratios that are reported without
targeted quantification. A multiplet whose identifications are all
targeted now counts as targeted in all of its runs.

The remaining exception with match between runs is documented in the
tool doc and the -targeted_quantification help: a targeted feature that
replaces an unidentified multiplet kept for match between runs gives its
run the targeted value instead of the one linking would have given the
multiplet (fixture 11 with _apex: VLDELTLAR 0.935 instead of 0.962).

Tests:
- New TOPP test MS1LabeledWorkflow_11_targeted_mbr_promoted (fixture 11
  plus MS1LabeledWorkflow_11_apex_noVLDELTLAR.idXML, i.e. _apex without
  VLDELTLAR): run B's unidentified VLDELTLAR doublet takes over run A's
  targeted identification. It now counts as targeted (4 targeted peptide
  ratios instead of 3), and YVNDLAGHEK's normalized ratio in run B stays
  1.0 as without -targeted_quantification (1.00015 before this fix).
- MS1LabeledRatioQuantifier_test: a (fraction group, channel) with
  targeted ratios only is normalized by them.

All 106 tests selected by ctest -R MS1Labeled pass; no existing
reference changes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_0149aXmabHtbvizd9Prmobpf

* [DOC,TEST] MS1LabeledWorkflow: state where match between runs still moves ratios; pin the promoted normalized ratio

The PXD022659 benchmark posted on the PR (7 dilution points x 3 runs)
confirms that without -match_between_runs no ratio reported without
targeted quantification changes with it (0 changed, 0 lost). With match
between runs, about 1 % of the peptide ratios still change or are lost,
through two mechanisms in linking: the documented replacement of a kept
multiplet by the targeted feature measured from it, and a targeted
feature drawing an unidentified multiplet of another peptide into its
linked feature (which develop does as well). The tool doc and the
-targeted_quantification help now state both instead of only the
replacement.

New test TOPP_MS1LabeledWorkflow_11_targeted_mbr_promoted_normalized
checks YVNDLAGHEK's normalized ratios exactly ([1.0, 1.0, 1.0, 1.0]);
FuzzyDiff's tolerance accepted the 1.00015 of run B before the fix. It
fails on the output without the fix.

All 107 tests selected by ctest -R MS1Labeled pass.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_0149aXmabHtbvizd9Prmobpf

* [FIX] MS1LabeledWorkflow: targeted features stay out of alignment and MBR linking; report targeted ratio counts

Targeted features took part in the ID-based alignment and in linking. On
PXD022659 that widened the alignment's maximum difference (147 -> 545 s at
50 % heavy) and with it the RT tolerance of the linking, and a targeted
feature could draw an unidentified multiplet kept for match between runs
into its own linked feature, possibly one of another peptide ~10 min away.
With -match_between_runs this changed or lost about 1 % of the peptide
ratios reported without targeted quantification.

- alignAndLink_(): targeted features are split off before the alignment,
  transformed with the transformations of the detected multiplets, and
  linked among themselves after those have been linked. Alignment, linking
  and match between runs are therefore those without targeted
  quantification. The documented exception remains: a targeted feature
  replaces the kept multiplet it is measured from.
- The promotion of an unidentified multiplet through a targeted
  identification can no longer occur; TOPP_MS1LabeledWorkflow_11_targeted_
  mbr_promoted now expects 3 targeted peptide ratios (run B has no
  VLDELTLAR value, as without targeted quantification).
- Targeted ratio counts reach the outputs (only when targeted
  quantification measured something, so other outputs do not change):
  MS1Label:peptide_ratio_targeted_count on the features (mzTab opt_global
  column), the protein-group array fraction_group_level_ratio_targeted_count
  and the QPX pg cv_param ratio_targeted_count. New tests check the QPX
  value for the one-protein fixture (0 with min_ratio_count 1, 2 with 2).

Merge of develop (#10786): the targeted references of fixtures 16 and 18
change in the two ways this PR documents (normalized ratios by one factor,
abundance arrays of groups whose only evidence is a targeted feature with a
non-quantifiable channel removed). The other targeted references gain the
targeted counts; the MBR/FAIMS ones also their new linking (ratios checked
against the old references: unchanged except the promoted case above).

All 128 tests selected by ctest -R MS1Labeled pass, as do
ProteinGroupArrowExport_test and ConsensusMapArrowExport_test.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* [FEATURE] MS1LabeledWorkflow: report the ratios resting on re-quantified channels; optional co-elution check for them

Re-quantified channels (-requantify, MaxQuant's re-quantify) are measured where the detection
found no pattern. On PXD022659 they double the peptide ratios at 10 / 5 % heavy, but are less
accurate there than detected ones (80 / 74 % vs 94 / 86 % within 2x) and add 3.7x the false
peptide ratios in a pure light sample.

- Counts: per peptide ratio the evidences whose channel or reference channel was re-quantified
  (MS1Label:peptide_ratio_requantified_count on the features, also an mzTab opt_global
  column), per protein group ratio the peptide ratios all of whose evidences were
  (fraction_group_level_ratio_requantified_count, QPX pg cv_param ratio_requantified_count).
  Written only where a channel was re-quantified. The re-quantified channels are recorded on
  the identifications (which keep their run through linking) and moved to the multiplet after
  linking, by run name and label like the targeted runs (the columns change when fractions are
  combined); both records are removed before the output.
- -requantify_min_correlation (advanced, default -1 = off): a re-quantified channel whose
  elution profile (summed isotopic peaks per spectrum) correlates with the reference's by less
  is not quantifiable. On PXD022659, 0.5 removes 42 % of the false protein ratios at 0 % heavy
  and 25-40 % of the wrong ones at <= 10 % heavy, but also 2-5 % of the correct ones at
  70-30 % heavy, and the abundances get slightly worse; hence off by default.

Tests: seven references with re-quantified channels gain the counts (no other change); new
TOPP tests check the QPX count and the log line on fixture 7 and the correlation path; a new
class-test section pins the counting rules. All 132 tests selected by ctest -R MS1Labeled pass,
as do ProteinGroupArrowExport_test and ConsensusMapArrowExport_test.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* [FEATURE] MS1LabeledWorkflow: targeted quantification and a co-elution check for weak re-quantified channels by default

- -targeted_quantification now defaults to true: its values only add ratios, and the targeted and
  re-quantified counts let users filter them.
- -requantify_min_correlation now defaults to 0.5 and applies to re-quantified channels weaker than
  -requantify_correlation_ratio (new, default 0.3) times the reference channel only; it is no longer
  applied when joining channels (those were detected). The elution correlation uses
  Math::pearsonCorrelationCoefficient, as the targeted quantification does.

On PXD022659 (7 points x 3 runs, without match between runs), protein ratios within 2x of the
expected H/L, old defaults -> new defaults (wrong ones in brackets): 70 % 2,570 (5) -> 3,817 (11);
30 % 2,694 (16) -> 3,682 (41); 10 % 1,890 (219) -> 1,983 (307); 5 % 1,044 (256) -> 1,094 (243);
1 % 149 (209) -> 163 (173); false protein ratios at 0 % heavy 122 -> 107. With match between runs
alike. The weak-only check costs no correct ratio at 70-30 % heavy (checking all re-quantified
channels cost 4-5 %); summed abundances are better at 70-30 % heavy and 1-3 points worse at
5-1 %. Runtime +14 % (targeted quantification).

Tests: TOPP_MS1LabeledWorkflow_11_targeted now runs with the defaults; the former _11_default test
is _11_untargeted with -targeted_quantification false (reference renamed), and the FAIMS split and
same-CV tests pin -targeted_quantification false (their point is the join; the targeted FAIMS case
has its own test). No reference content changes: the synthetic fixtures co-elute. All 132 tests
selected by ctest -R MS1Labeled pass.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude <[email protected]>
Co-authored-by: timosachsenberg <[email protected]>
timosachsenberg pushed a commit that referenced this pull request Nov 3, 2026
… tolerance and the identified channel's own 30 % check

Synthetic fixtures (isotope centroids at their fine-structure positions):
- MS1LabeledWorkflow_22_heavy: fixture 22's spectra with the two
  targeted peptides identified in their heavy channel. A peak at the
  heavy M-1 that is never exempt (nine isotopes above the light, beyond
  M+5) at 0.2 x the heavy M0 keeps the identified channel (L/H 2); at
  0.4 x no spectrum is clean and the identification is not quantified.
  Pins the bound of the identified channel's own clean-spectrum check in
  targeted mode to 0.2 < t < 0.4; no test reached that check before.
- MS1LabeledWorkflow_23 (triple SILAC, re-quantification): an
  unrelated peak at 0.4 x the M0 of a re-quantified channel in every
  spectrum. 9 ppm below the heavy M-1 it is read (window of twice the
  m/z tolerance): heavy not quantifiable. Exactly at the medium M-1
  and 9 ppm from the light M+3 position, with no light M+3 centroid,
  it is not the light M+3 (identity within the tolerance itself, not
  twice) and not exempt: medium not quantifiable. 15 ppm below the
  heavy M-1 it is not read: H/L 0.5.
Also drops two double blank lines in the MS1LabeledWorkflow tests, and
names the baseline of earlier values in the fixture 20-22 comments (the
exemption by theoretical position, or no isotope-pattern check).

develop (84a5b3f) fails 10 of the 132 MS1LabeledWorkflow tests:
20_requant, 20_targeted, 20_foreign, 21_join_triplex and 23, each with
its _out1. 22_heavy passes there (the check predates #10786).

Mutants of MS1LabeledWorkflow.cpp, each killed: the old theoretical
window, the identity check within twice the tolerance and the old
window as an alternative (now also by 23), no exemption, k up to
max_isotope + 1, the join's channel list without the missing channels
or cleared, the re-quantification's list of detected channels only, a
join that ignores the identified multiplet's failed channel,
lower_isotope_fraction_ 0.0, 0.1, 0.5 and 0.54, the M-1 read within
the tolerance itself (23, 16_dimethyl_isotopes3) or within three times
it (23), and the identified channel's own check at 0.0 or 0.5 instead
of the bound (22_heavy).

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

2 participants