Repository navigation
[FIX] FeatureFinderMultiplex: compare the M-1 peak with the satellites by its experiment index - #10813
Conversation
…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
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
timosachsenberg
left a comment
There was a problem hiding this comment.
AI-generated initial review
This is an automated, AI-generated first review. It looks only for high- and medium-priority issues (no nits) and checks whether the PR has tests and measurements. Please double-check anything before acting on it; a maintainer will follow up. I reviewed 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.cppat 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-treeagainst 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:
MultiplexFilteredPeakstores 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(), socheckSatellite()expects experiment indices. - Only the zeroth-peak check passed a white index, because its
it_rtisexp_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, becausemz_idxcomes fromfindNeareston 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
sbefore it readsboundaries_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_peptidestops 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_12and_13, and their temp files_22to_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
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: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.
isotopes_per_peptide3: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.FeatureFinderMultiplexAlgorithmwith 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 spacecheckForSignificantPeak_()returns and which experiment the iterators passed tofilterPeakPositions_()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 inMultiplexFilteringProfile_test). A 3+ singlet pattern first blacklists six peaks below a 2+ doublet.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_12and_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.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):rt_min4 s: droppedThe 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 2andknock_out true, otherwise defaults:MS1LabeledWorkflow on the same data, with two identification sets (tool defaults except
-max_nr_labelled_aas 2,-proteinFDR 1.0and-ratios:normalize false):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: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
Generated by Claude Code
Summary by CodeRabbit
Bug Fixes
Tests