Skip to content

[FIX] FeatureFinderMultiplex: compare the M-1 peak with the satellites by its experiment index - #10813

Merged
timosachsenberg merged 1 commit into
developfrom
claude/github-issue-6-investigation-8wcb95
Nov 3, 2026
Merged

timosachsenberg merged 1 commit into
developfrom
claude/github-issue-6-investigation-8wcb95

Conversation

@timosachsenberg

@timosachsenberg timosachsenberg commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Description

FeatureFinderMultiplex searches its peak patterns (one per set of label mass shifts and charge) one after another. Each pattern blacklists the peaks it explains; later patterns search the white spectrum, the spectrum without blacklisted peaks. For each channel of a candidate multiplet, MultiplexFiltering::filterPeakPositions_() checks the position one isotope below the channel's monoisotopic peak M0, the M-1. A peak there above 0.3 × M0 rejects the candidate in that spectrum, unless it is one of the candidate's own satellites (e.g. an isotope of a lighter channel).

The M-1 peak is found in the white spectrum, but its white index was compared with the satellites' experiment indices (their indices in the spectrum with all peaks, exp_centroided_). They agree for the first pattern; from the second on, every peak an earlier pattern blacklisted below the M-1 shifts them apart:

  • False rejection: a real satellite at a heavier channel's M-1 is not recognised, and the multiplet is dropped in that spectrum. That M-1 is, for example, the light M+5 for Arg6/Lys6, about the light M+3 for Lys4/Dimethyl4, and about the medium M+3 for Lys8/Arg10 after a Lys4/Arg6 medium channel.
  • False exemption: a peak at the M-1 that is no satellite passes when its white index happens to be a satellite's experiment index.

Since when. Since the exemption was added (e77805f, January 2019), so every release from 2.5.0 up to and including 3.6.0 is affected, in centroided and profile mode.

Who is affected.

  • Only heavier channels (the lightest channel's M-1 lies below all its satellites) and only patterns searched after the first. Singlet searches (label-free FeatureFinderMultiplex, the seeding in ProteomicsLFQ and OpenNuXL) are unaffected.
  • With the default isotopes_per_peptide 3:6, the heavy M-1 of Lys8 and Arg10 (light M+7, M+9) is never a satellite (that needs a maximum of at least 8 / 10), so the common SILAC duplex sees only false exemptions. Label sets such as Lys4, Lys6, Arg6, Leu3, Dimethyl, ICPL and triplex SILAC can see both.
  • Tools: FeatureFinderMultiplex, MS1LabeledWorkflow, and pyOpenMS users of FeatureFinderMultiplexAlgorithm with labels.

Fix. The white index is mapped to the experiment index with exp_centroided_mapping_ before the comparison, as the satellite search already does. The header documentation now says which index space checkForSignificantPeak_() returns and which experiment the iterators passed to filterPeakPositions_() point into. The mapping is constant per pattern and the check reads no blacklist entry, so the parallel filtering from #10797 needs no change (same result with 1 and 4 threads on the test 9 data).

Tests

Class tests (MultiplexFilteringCentroided_test, and the same cases as profile data in MultiplexFilteringProfile_test). A 3+ singlet pattern first blacklists six peaks below a 2+ doublet.

case expected filtered peaks develop
Arg6, heavy:light 1:4 (light M+5 significant at the heavy M-1) 3 0
the same at 1:1 (control) 3 3
Lys8, a peak that is no satellite at the heavy M-1 0 3
the same with the singlet between the light M0 and the heavy M-1 (centroided only) 0 3
Arg6 1:4 with an RT band of 3 s whose first spectrum has no blacklisted peak (centroided only) 3 1

A further centroided section pins that a peak an earlier pattern blacklisted does not reject a later pattern whose M-1 it lies at (the M-1 is looked up in the white spectrum, not in the full one, which would let peaks already explained by an earlier pattern veto later ones): 3 peaks with the earlier pattern, 0 without it.

New TOPP tests FeatureFinderMultiplex_12 and _13. Synthetic [][Arg6] data, 44 kB each. A 3+ target T co-elutes with a 2+ peptide E, which the first pattern finds and blacklists.

  • 12, false rejection (E below T): T is found in all 25 spectra (light 6.84e8, heavy 7.07e8), as when E is above T or absent. Develop reports T only from two tail spectra (6.8e5).
  • 13, false exemption (isotopes_per_peptide 3:5, so the light M+5 is no satellite; E interleaved with T): T is rejected wherever its M-1 is significant, keeping two tail spectra (6.8e5), as when E is above T or absent. Develop accepts it everywhere (6.4e8).

Changed reference FeatureFinderMultiplex_9. The labels are [0][6.03705], so the heavy M-1 is the light M+5 + 0.017 Da. Develop rejected four peaks whose heavy M-1 is that light M+5 satellite. The fix keeps them (233 → 237 filtered peaks, none removed), and three doublets change (L/H = light/heavy intensity):

doublet develop fix
m/z 760.034, 3+ 5 spectra, L/H 9.06e6 / 7.26e6 6 spectra, enough for the ratio regression: 9.42e6 / 6.63e6
m/z 754.874, 4+ 2 spectra, 3.4 s < rt_min 4 s: dropped 3 spectra, 6.9 s: reported, 6.47e5 / 6.42e5
m/z 740.620, 4+ 4 spectra, 1.91e6 / 1.89e6 6 spectra, 1.82e6 / 1.88e6

The first and third doublet move by 0.5 s in RT. Features 64 → 66, multiplets 32 → 33; the other 30 multiplets and 60 features are unchanged.

Fail before, pass after. With the fix, the 384 tests selected by ctest -R 'Multiplex|MS1Labeled|ConsensusMap|ProteinGroupArrowExport|TOPP_ProteomicsLFQ|TOPP_OpenNuXL' pass. With develop's library, exactly 8 of them fail: both class tests (at the new checks) and the two diffs each of FeatureFinderMultiplex 9, 12 and 13. All MS1LabeledWorkflow, ProteomicsLFQ and OpenNuXL test outputs are identical with both libraries apart from run-to-run noise (dates, random ids, TSV row order, timing), so no other reference changes.

Mutation check. Of 11 variants of the fixed line, 10 fail the class tests (e.g. the old index, an off-by-one mapping, mapping through the first spectrum of the RT band, an offset from the primary peak instead of the mapping, the M-1 looked up in the full spectrum, no check, the inverted check). The remaining one is equivalent (the same spectrum index written differently).

Effect on real data

Decisions were counted with an instrumented copy of develop's filtering code that evaluates each significant M-1 check with both indices. It reproduces develop's output in every run, and the fix's where checked (test 9 byte for byte; FeatureFinderMultiplex, centroided MS1LabeledWorkflow and one dilution run up to run-specific ids).

PXD003327 (E. coli, triple SILAC [][Lys4,Arg6][Lys8,Arg10]), centroided. FeatureFinderMultiplex with charge 2:4, max_nr_labelled_aas 2 and knock_out true, otherwise defaults:

  • 346,003 significant M-1 checks; in 95 % of them the white and the experiment index differed. 14,603 were false rejections (4.2 %), all at a lighter channel's satellite, and 675 false exemptions.
  • Filtered peaks 30,498 → 31,408 (+3.0 %), features 10,413 → 10,957, multiplets 5,269 → 5,447 (4,564 identical, 468 changed, 237 lost, 415 gained). Triplets 1,446 → 1,580 (3+: 525 → 609, 4+: 102 → 135).
  • Identified multiplets within 1.5× of their label class median (same number of labelled K and R): 98.1 % of 1,034 ratios → 98.2 % of 1,073. Changed multiplets 96.1 → 96.9 %, gained ones 98.1 %.

MS1LabeledWorkflow on the same data, with two identification sets (tool defaults except -max_nr_labelled_aas 2, -proteinFDR 1.0 and -ratios:normalize false):

run detected multiplets identified peptides, all 3 channels re-quantified channels
profile, IDs 1 10,242 → 10,429 496 → 502 180 → 165
profile, IDs 2 10,242 → 10,429 382 → 388 116 → 106
centroided, IDs 1 7,642 → 7,819 517 → 525 192 → 180

Ratio accuracy is unchanged: within 1.5× of the class median are 94.5, 93.9 and 95.1 % of the peptides quantified with both libraries, and 98.4, 97.6 and 96.6 % of those whose values changed, before and after alike.

PXD022659 (dilution series with known H/L ratios, SILAC [][Lys8,Arg10], 9 runs), MS1LabeledWorkflow with the same settings:

  • 0 false rejections, as predicted, and 141 to 1,743 false-exemption checks per run.
  • 24 to 217 consensus features per run differ. Of about 66,000 peptide H/L ratios, 38 are lost, 11 gained and 856 change; 134 move by more than 0.15 in log2 H/L, 73 towards the expected ratio and 61 away from it.
  • The share of ratios within 2× of the expected value is unchanged in every run with an expected ratio (largest change 0.09 percentage points).

Runtime and memory show no measurable change (the fix adds one index lookup per significant M-1 check): summed over the 9 dilution runs, CPU 1,580 → 1,572 s, peak memory within a few MB per run. The runs were not isolated, and single runs varied by up to about ±20 % in both directions.

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 (the 384 tests described above)
  • Updated or added python bindings for changed or new classes (Tick if no updates were necessary.) (no binding changes: no public interface changed)

Generated by Claude Code

Summary by CodeRabbit

  • Bug Fixes

    • Fixed multiplex feature filtering when peaks are blacklisted by an earlier pattern. Satellite checks now correctly account for peak positions in the original spectrum, improving detection when peaks are interleaved or filtered.
    • Updated feature-finding results for affected cases, including spectra with interfering peaks and varying isotope ranges.
  • Tests

    • Added regression coverage for centroided and profile spectra, including cases with earlier blacklisting and interleaved peaks.

…s by its experiment index

MultiplexFiltering::filterPeakPositions_() rejects a candidate peak of
a pattern if there is a significant peak at the M-1 position of one of
its peptides, unless that peak is one of the candidate's satellites.
It looks the M-1 peak up in the white spectrum (without the peaks
earlier patterns have blacklisted) and passes that white index to
checkSatellite(),
whereas the satellites hold indices in the experiment
(exp_centroided_). From the second pattern on, every peak an earlier
pattern blacklisted below the M-1 shifts the two apart, so

- a real satellite at the M-1 of a heavier channel (with Arg6/Lys6 the
  light M+5, with Dimethyl4/Lys4 about the light M+3) was not
  recognised, and the multiplet was rejected in that spectrum (false
  rejection), and
- a peak at the M-1 that is no satellite was let through when its
  white index happened to be the experiment index of a satellite
  (false exemption).

Centroided and profile mode share the check. It has compared the two
index spaces since the exemption was added (e77805f, 2019).

The fix maps the white index with exp_centroided_mapping_, as the
satellite search does. The mapping stays the same for the whole
pattern and the check reads no blacklist entry, so the parallel
filtering of a spectrum (re-filter on changed BlacklistEntry reads)
needs no change.

Tests:
- MultiplexFilteringCentroided_test, MultiplexFilteringProfile_test:
  an earlier 3+ singlet blacklists six peaks below a 2+ doublet. Arg6
  shift at heavy:light 1:4 expects 3 filtered peaks (was 0), 1:1 is a
  control (3 either way), Lys8 shift with a peak that is no satellite
  at the heavy M-1 expects 0 (was 3).
- MultiplexFilteringCentroided_test also: the same Lys8 case with the
  earlier singlet between the heavy channel's light M0 and its M-1
  (the white index must be mapped, not offset from the primary peak),
  an RT band of 3 s whose first spectrum has no blacklisted peak (the
  mapping of the spectrum the M-1 was found in), and a section where a
  peak an earlier pattern blacklisted lies at a later pattern's M-1
  and must not reject it (the M-1 is looked up in the white spectrum,
  not in the experiment).
- TOPP_FeatureFinderMultiplex_12 (false rejection) and _13 (false
  exemption): synthetic SILAC [][Arg6] data, see CMakeLists.txt. With
  the develop library, the target is reported at 6.8e5 instead of
  6.8e8 (12) and at 6.4e8 instead of 6.8e5 (13).

Changed reference TOPP_FeatureFinderMultiplex_9 ([0][6.03705], so a
heavy M-1 is the light M+5 + 0.017 Da): four peaks were false
rejections, each at a heavy M-1 that is the light M+5 satellite (white
vs experiment index in parentheses).
- 3+ m/z 760.032 at RT 3905.39 (33 vs 40): the 760.034 doublet has 6
  spectra instead of 5. Its mass traces now have the 6 points the
  ratio regression needs: light 9.062e6 -> 9.416e6, heavy 7.263e6 ->
  6.627e6 (integrated 9.174e6 and 6.970e6, ratio 0.704), RT 3903.29
  -> 3903.78.
- 4+ m/z 754.875 at RT 3806.06 (58 vs 71): the 754.874 doublet spans
  6.89 s instead of 3.43 s, so it passes rt_min (4 s) and is reported
  (light 6.47e5, heavy 6.42e5). Features 64 -> 66, multiplets
  32 -> 33.
- 4+ m/z 740.622 at RT 4081.01 (66 vs 76) and 740.621 at RT 4088.97
  (42 vs 54): the 740.620 doublet has 6 spectra instead of 4, ratio
  1.034: light 1.908e6 -> 1.818e6, heavy 1.890e6 -> 1.881e6, RT
  4085.96 -> 4085.46.
No other filtered peak, feature or multiplet of test 9 changes. The
other FeatureFinderMultiplex, MS1LabeledWorkflow, ProteomicsLFQ and
OpenNuXL tests give the same output.

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

coderabbitai Bot commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Walkthrough

The filtering check now maps a peak index from the white spectrum to the original centroided spectrum before testing for a satellite. New unit and TOPP regression tests cover zeroth-peak filtering in centroided and profile spectra.

Changes: Multiplex filtering

Layer / File(s) Summary
Peak-index mapping
src/openms/include/OpenMS/FEATUREFINDER/MultiplexFiltering.h, src/openms/source/FEATUREFINDER/MultiplexFiltering.cpp
The documentation clarifies which spectra the iterators reference. The satellite check maps the white-spectrum peak index to the original centroided spectrum before calling peak.checkSatellite.
Unit regression tests
src/tests/class_tests/openms/source/MultiplexFilteringCentroided_test.cpp, src/tests/class_tests/openms/source/MultiplexFilteringProfile_test.cpp
New tests cover zeroth-peak checks with overlapping or interleaved peaks, earlier blacklisting, RT bands, and profile spectra with an interfering peak.
TOPP regression tests and fixtures
src/tests/topp/CMakeLists.txt, src/tests/topp/FeatureFinderMultiplex_12_*, src/tests/topp/FeatureFinderMultiplex_13_*, src/tests/topp/FeatureFinderMultiplex_9_output.*
Tests 12 and 13 compare generated featureXML and consensusXML with new reference fixtures. The expected outputs for test 9 are updated.

Suggested reviewers: jpfeuffer

Merge Risk: Minimal · up to 8e0a3

No merge-blocking issue is identified from the available evidence.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names the FeatureFinderMultiplex fix and its core change: the M-1 peak is compared with satellites using its experiment index instead of its white-spectrum index. The raw summary confirms th…
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: Title check

Explanation

The title names the FeatureFinderMultiplex fix and its core change: the M-1 peak is compared with satellites using its experiment index instead of its white-spectrum index. The raw summary confirms the code change in filterPeakPositions_ maps the white index through exp_centroided_mapping_ before calling checkSatellite, and the added tests and header documentation support this. The title is specific and matches the main change.

Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff 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 6 functions across 4 files. (11 skipped: 11 unsupported.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

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 peak in line
Maps white-spectrum indices fine
When earlier peaks are blackened away
Tests watch the light peaks stay
Then hops back home at close of day

CodeRabbit Verify

  • Run CodeRabbit Verify to test the changes in this pull request.
Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: b4624d6c-6a1a-4c1f-8db4-0ea7a9a7917c
Commits

Reviewing files that changed from the base of the PR and between 39e96fc and 8e0a381.

Files selected for processing: 15
  • src/openms/include/OpenMS/FEATUREFINDER/MultiplexFiltering.h
  • src/openms/source/FEATUREFINDER/MultiplexFiltering.cpp
  • src/tests/class_tests/openms/source/MultiplexFilteringCentroided_test.cpp
  • src/tests/class_tests/openms/source/MultiplexFilteringProfile_test.cpp
  • src/tests/topp/CMakeLists.txt
  • src/tests/topp/FeatureFinderMultiplex_12_input.mzML
  • src/tests/topp/FeatureFinderMultiplex_12_output.consensusXML
  • src/tests/topp/FeatureFinderMultiplex_12_output.featureXML
  • src/tests/topp/FeatureFinderMultiplex_12_parameters.ini
  • src/tests/topp/FeatureFinderMultiplex_13_input.mzML
  • src/tests/topp/FeatureFinderMultiplex_13_output.consensusXML
  • src/tests/topp/FeatureFinderMultiplex_13_output.featureXML
  • src/tests/topp/FeatureFinderMultiplex_13_parameters.ini
  • src/tests/topp/FeatureFinderMultiplex_9_output.consensusXML
  • src/tests/topp/FeatureFinderMultiplex_9_output.featureXML

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

@timosachsenberg timosachsenberg left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

AI-generated initial review

This is an automated, AI-generated first review. It looks only for high- and medium-priority issues (no nits) and checks whether the PR has tests and measurements. Please double-check anything before acting on it; a maintainer will follow up. I reviewed 8e0a3819. Its parent 995044a5 is two commits behind develop (39e96fc2).

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

  • Code trace: I read MultiplexFiltering.cpp at the PR head and followed where each index comes from (details below).
  • Reference outputs: I checked the new and changed reference files against the numbers in the description.
  • Merge and CI: git merge-tree against develop is clean. CI builds the merge commit with develop. On it, build-and-test (ubuntu-24.04-arm, g++) passed all 3,526 tests, including your new class and TOPP tests and the updated test 9. The other platforms were still running when I looked.

Verdict: I found no high- or medium-priority issue. It is a one-line fix with targeted tests, a mutation check and a real-data evaluation.

Checked and found sound

  • Index spaces are now consistent:
    • MultiplexFilteredPeak stores the primary peak with its experiment index (exp_centroided_mapping_[idx_rt].at(s)), in both the centroided and the profile path.
    • The satellite loop maps every white index before addSatellite(), so checkSatellite() expects experiment indices.
    • Only the zeroth-peak check passed a white index, because its it_rt is exp_centroided_white_.begin() + RTidx.
    • The new exp_centroided_mapping_.at(RTidx).at(mz_idx) is the same mapping the satellite search uses. It is always in bounds, because mz_idx comes from findNearest on that same white spectrum.
    • The spectrum index needs no mapping, because the white and the full experiment have the same spectra in the same order.
  • No other site mixes the two index spaces. The charge-state checks (2+ really 4+ or 6+, 3+ really 6+, 1+ really c+) only test for a significant peak and compare no index. The profile path maps s before it reads boundaries_ and the blacklist.
  • Thread safety (#10797): the mapping is rebuilt once per pattern in updateWhiteMSExperiment_() and only read during the parallel filtering, so the change adds no data race.
  • Behaviour change in test 13 (by design): when isotopes_per_peptide stops short of the label shift, a real doublet whose heavy M-1 is its own light isotope is now always rejected. Develop already did this whenever no earlier pattern had blacklisted peaks, so the fix only makes the rule consistent. Your PXD022659 numbers show it does not hurt ratio accuracy at default settings.
  • Branch behind develop: your 384-test run was on 995044a5. Since then, #10808 added MS1LabeledWorkflow tests 21–23 for the related M-1 rule. They pass on the CI merge commit (ARM), so no further reference changes are needed.
  • Test registration: FeatureFinderMultiplex_12 and _13, and their temp files _22 to _25.tmp, do not collide with existing tests.

Tests

  • Good:
    • The class tests cover five cases, both centroided and profile: false rejection, false exemption, a peak between the light M0 and the heavy M-1 (this catches a wrong "offset from the primary peak" fix), and an RT band whose first spectrum has no blacklisted peak.
    • A separate section pins that a peak blacklisted by an earlier pattern does not veto a later one.
    • TOPP tests 12 and 13 use small synthetic files (44 kB each).
    • The test 9 reference change is explained doublet by doublet.
    • My spot checks of the references match the description:
      • test 12: T at 6.839e8 / 7.065e8
      • test 13: T at 6.8e5 / 7.1e5
      • test 9: features 64 → 66, multiplets 32 → 33
  • Not reproduced: the fail-before results and the mutation check (10 of 11 mutants fail, the remaining one is equivalent). I could not build here.

Measurements

  • Good: real data on two PRIDE datasets:

    • PXD003327 (triple SILAC), through both FeatureFinderMultiplex and MS1LabeledWorkflow.
    • PXD022659 (dilution series with known ratios), so ratio accuracy is checked against ground truth.
    • Decision counts from an instrumented build, plus runtime and memory.

    That is more than this fix needs; I have nothing to add.


Generated by Claude Code

@timosachsenberg
timosachsenberg merged commit e9935dc into develop Nov 3, 2026
14 checks passed
@timosachsenberg
timosachsenberg deleted the claude/github-issue-6-investigation-8wcb95 branch November 3, 2026 20:09
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