Skip to content

[FEATURE] ProSE precursor:isotope_mimic: annotate or remove candidates whose isotope-like modifications an isotope-step precursor error explains - #10635

Closed
timosachsenberg wants to merge 2 commits into
developfrom
claude/andes-isotope-mimic
Closed

timosachsenberg wants to merge 2 commits into
developfrom
claude/andes-isotope-mimic

Conversation

@timosachsenberg

@timosachsenberg timosachsenberg commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Requested by Timo · project thread

Description

Before: Deamidation (+0.984 Da), N→D and Q→E lie 19 mDa from one 13C step. With isotope errors searched, the deamidated candidate matches an unmodified peptide's precursor at a neighbouring isotope offset within tolerance, and often outscores the unmodified form. Decoys cannot model this error, and neither can entrapment, because the peptide is right and only its modification state is wrong. On the #10364 suite with Deamidated (N/Q), 65% of accepted deamidated PSMs are such mimics (andes: 61% on Astral).

After: -Search:precursor:isotope_mimic off|annotate|remove (default off, which is byte-identical to develop). A candidate is an isotope mimic when replacing its variable modifications that lie within 0.05 Da of one or two isotope steps by whole steps gives a smaller precursor error.

  • annotate: PSM meta value isotope_mimic (1/0). It is not a Percolator feature; see the benchmark.
  • remove: mimics are neither scored nor part of the candidate pool, so the unmodified candidate matched at the other isotope offset takes their rank. This is how andes#102 drops them. The number removed is logged.

The mode is recorded in the search parameters unless it is off. Closed search only.

How: New public statics ProSEAlgorithm::isotopeGap(), isotopeMimicShift() and isIsotopeMimic(). remove acts in scoreSpectraAgainstIndex_ before scoring; annotate in postProcessHits_. Tests: class tests for the statics and for the three modes in a search, and TOPP test ProSE_13_isotope_mimic. On the existing test data, remove replaces IALSRPNVEVVALN(Deamidated)DPFITNDYAAYM(Oxidation)FK at isotope error −1 by the unmodified peptide at 0.

Commits: 6ceb7553 added the flag as annotate:isotope_mimic together with a Percolator feature. e1df7302 adds the removal, renames the option, and drops the feature.

Ported from bigbio/andes#102 and bigbio/andes#152.

Benchmark

Verdict: remove reproduces andes:

  • Mis-picked deamidations among accepted PSMs fall from 65% to 1.8%.
  • PSMs rise by +1.9% on the suite databases (10 files up, 1 flat, 1 down) and +2.1% on the entrapment databases.
  • Entrapment FDP goes from 1.33% to 1.43%; estimated true PSMs rise by 2.0%.

The first head's Percolator feature had the opposite effect: PSMs −0.3%, and accepted mimics rose by 41%.

Setup.

  • Builds: base 74048ef5 (merge-base); first head 6ceb7553; second head e1df7302. Release, TOPP ProSE.
  • Data: [BENCHMARK] Reproducible ProSE / ANDES / Sage suite: 20 measurements across six instrument models #10364 suite (frozen protocol, inputs hash-checked against inputs.json): Velos CID, HF-X, Astral and Lumos HCD LFQ, 3 files each, 8,000 MS2 per file.
  • Search: the frozen native_dedup parameters (Trypsin/P, 2 MC, length 7–40, z 2–5, ±20 ppm, isotope errors −2..1, fragment 0.5 Da for Velos and 20 ppm otherwise, 50 candidates, top 10, deduplicate) plus variable Deamidated (N) and (Q), at most 2 variable modifications per peptide.
  • Rescoring: external Percolator (THIRDPARTY binary, version 3.06.0) with -Y -U, seeds 1/42/137; target PSMs at q ≤ 0.01.
  • Entrapment: one shuffled, mass-matched protein per target (r = 1), combined FDP = 2·N_E/N.
  • Arms:
    • off: option off.
    • on: first head with the flag as a Percolator feature.
    • drop: flagged rows removed from the off PIN before Percolator, a simulation of andes.
    • remove: second head with precursor:isotope_mimic remove.

PSMs at q ≤ 0.01 (suite databases; group mean of the 3-seed means; All = sum over the 12 files; files up/flat/down vs off with |z| ≥ 2):

group no deamidation off on (first head) drop (simulated) remove
Velos CID 2977.6 2913.9 2925.6 (+0.4%) 2954.4 (+1.4%) 2993.2 (+2.7%, 2/1/0)
HF-X HCD 4597.6 4452.6 4445.6 (−0.2%) 4525.4 (+1.6%) 4527.3 (+1.7%, 3/0/0)
Astral HCD 3049.8 2610.8 2568.0 (−1.6%) 2740.8 (+5.0%) 2740.2 (+5.0%, 3/0/0)
Lumos HCD LFQ 5553.6 5583.8 5578.9 (−0.1%) 5593.8 (+0.2%) 5600.2 (+0.3%, 2/0/1)
All 12 48535.3 46683.0 46554.0 (−0.3%, 0/12/0) 47443.3 (+1.6%, 8/3/1) 47583.0 (+1.9%, 10/1/1)

Entrapment databases (all 12 files; deamidated = accepted deamidated PSMs per seed):

arm PSMs combined FDP est. true PSMs deamidated at mis-pick (−26..−12 mDa)
off 44206 1.33% 43616 7392 63.7%
on (first head) 44135 1.35% 43541 10091 72.2%
drop (simulated) 44847 1.38% 44226 1987 1.5%
remove 45138 (+2.1%, 8/4/0) 1.43% 44493 (+2.0%) 1986 1.6%

Per group, FDP from off to remove (estimated true PSMs in brackets):

group FDP off → remove est. true PSMs
Velos 1.73 → 1.53% +1.0%
HF-X 1.52 → 1.53% +3.1%
Astral 1.18 → 1.22% +5.4%
Lumos LFQ 1.05 → 1.39% +0.2%

The implementation does slightly better than the simulation: +1.9% vs +1.6%, and +2.1% vs +1.5% on the entrapment databases. Removing mimics before the top-N pruning lets further candidates in, which the PIN-level simulation cannot do.

What the mimics are (off):

  • 64–75% of the accepted mimics are matched at isotope offset −1: the precursor is the unmodified peptide's monoisotopic peak. The rest are M+1 picks.
  • The unmodified form of the peptide is among the spectrum's candidates for 85–97% of them.
  • Their decoy rate is 1.8% and their entrapment FDP 1.9%, close to background.
  • Excluding them after rescoring loses 13.4% of PSMs.
  • As a Percolator feature the flag gets a positive weight, so Percolator prefers the mimic. That is why the second head drops the feature.
  • Searching deamidation at all costs 4.0% PSMs on this suite (Astral −14%). remove recovers about half of that.

andes:

  • andes#101 on the full Astral HYE file: accepted deamidations at the mis-pick position 4,869 → 43; Pass-2 PSMs 9,879 → 3,940; total −10% (the dropped mimics had been counted as gains before).
  • Like-for-like (andes 72ee0a5 vs 3dded7b, --refine, the same three Astral files, same Percolator): mis-picks 47% → 0%; Pass-2 PSMs −41%; total +0.3%.
andes claim OpenMS remove verdict
61% of accepted deamidations are isotope mis-picks 48–79% (Astral 63%) → 1.8% reproduced
decoys cannot model it decoy rate and entrapment FDP of mimics are close to background (correct backbone) reproduced
dropping them removes the artefact mis-picks → ~0; PSMs +1.9% at FDP 1.33 → 1.43% (est. true +2.0%); andes: total +0.3% reproduced; in OpenMS the yield also rises, because the unmodified candidate competes in the same search

Option off and cost:

  • Second head, option off vs merge-base: PIN, Percolator results and idXML (apart from date and version string) are identical on all 12 files. annotate gives exactly the off counts.
  • Search time is unchanged: median of 3 interleaved runs, Astral 17.79 → 17.75 s and HF-X 13.69 → 13.56 s; peak RSS is the same.
  • Tests: ctest -R ProSE passes all 63 tests, including ProSEAlgorithm_test and the new TOPP_ProSE_13_isotope_mimic.

Scripts, per-file and per-seed tables, hashes and the reproduction recipe: benchmark-reproduction/andes-ports/pr10635 on branch claude/andes-benchmarks.

Checklist

  • Make sure that you are listed in the AUTHORS file
  • Add relevant changes and new features to the CHANGELOG 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.)

How can I get additional information on failed tests during CI

Click to expand If your PR is failing you can check out

Advanced commands (admins / reviewer only)

Click to expand
  • /reformat (experimental) applies the clang-format style changes as additional commit. Note: your branch must have a different name (e.g., yourrepo:feature/XYZ) than the receiving branch (e.g., OpenMS:develop). Otherwise, reformat fails to push.


Generated by Claude Code

…modifications an isotope-step precursor error explains

Deamidation (+0.984 Da), N->D and Q->E sit 19 mDa from one 13C step: an
unmodified peptide whose precursor was picked on its M+1 peak matches the
'modified' candidate within tolerance, and decoys cannot model this. With
annotate:isotope_mimic, ProSE annotates each PSM with isotope_mimic = 1
when replacing its variable modifications within 0.05 Da of one or two
isotope steps by whole steps gives a smaller precursor error, and adds it
to the Percolator features. Default false.

Ported from bigbio/andes #102/#152 (on Astral, 61% of accepted
deamidations were isotope mis-picks).

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01F73hZDwadLuUofLxkDHyVS
@coderabbitai

coderabbitai Bot commented Oct 19, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 33 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 4 included reviews currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 79b05881-8ae6-4a2c-834e-3d60d789e3f9
📥 Commits

Reviewing files that changed from the base of the PR and between b8f55c6 and 6ceb755.

📒 Files selected for processing: 4
  • CHANGELOG
  • src/openms/include/OpenMS/ANALYSIS/ID/ProSEAlgorithm.h
  • src/openms/source/ANALYSIS/ID/ProSEAlgorithm.cpp
  • src/tests/class_tests/openms/source/ProSEAlgorithm_test.cpp
  • 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

Comment @coderabbitai help to get the list of available commands.

Copy link
Copy Markdown
Contributor Author

build-and-test (windows-2025, cl.exe) failed while installing dependencies, before the build: choco install rsync could not reach community.chocolatey.org. That was a short Chocolatey outage (503s, about 08:50–09:08 UTC); Windows jobs on other PRs passed the same step before and after it. Nothing in this PR touches it. I re-ran the failed job.


Generated by Claude Code

…efore ranking (andes#102)

Benchmark of the first head (#10364 suite, 12 files, Deamidated N/Q): most
accepted deamidations are isotope mimics, the right peptide in the wrong
modification state, so neither decoys nor entrapment see them. As a
Percolator feature the flag made Percolator prefer the mimic over its
unmodified competitor (flagged accepted PSMs +41%, PSMs -0.3%).

annotate:isotope_mimic (true/false) becomes precursor:isotope_mimic
(off|annotate|remove, default off):
- annotate: the isotope_mimic meta value, as before, but no longer a
  Percolator feature.
- remove: isotope mimics are neither scored nor part of the candidate pool,
  so the unmodified candidate matched at the other isotope offset takes their
  rank, as andes#102 drops them. The number removed is logged.
Closed search only. The mode is recorded in the search parameters unless off.
New static ProSEAlgorithm::isIsotopeMimic(); class test for it and for the
three modes in a search; TOPP test ProSE_13_isotope_mimic.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01X1MRVABax5o7Y3ijLEcWj5
@timosachsenberg timosachsenberg changed the title [FEATURE] ProSE annotate:isotope_mimic: flag PSMs whose isotope-like modifications an isotope-step precursor error explains [FEATURE] ProSE precursor:isotope_mimic: annotate or remove candidates whose isotope-like modifications an isotope-step precursor error explains Oct 19, 2026

Copy link
Copy Markdown
Contributor Author

Pushed e1df7302, which carries out the benchmark's finding. annotate:isotope_mimic becomes precursor:isotope_mimic off|annotate|remove.

  • remove drops isotope mimics before scoring, so the unmodified candidate takes their rank, as andes#102 does.
  • The flag is no longer a Percolator feature. As a feature, it made Percolator prefer the mimic.

On the #10364 suite with Deamidated (N/Q), remove gives +1.9% PSMs (10 files up, 1 flat, 1 down). Entrapment FDP goes from 1.33% to 1.43%, and estimated true PSMs rise by 2.0%. Option off stays byte-identical to the merge-base. Details are in the PR description.


Generated by Claude Code

Copy link
Copy Markdown
Contributor Author

What precursor:isotope_mimic=remove does

The problem. Deamidation (N→D, Q→E, +0.984 Da) differs from one ¹³C isotope step (1.003 Da) by only 19 mDa, which is within precursor tolerance. Because ProSE searches isotope errors −2..+1, a spectrum of the unmodified peptide P often also matches "P + deamidation at isotope error −1". Both candidates share the backbone and nearly all fragments, and the deamidated one often wins by chance. The peptide is then right and only its modification state is wrong. Decoys and entrapment cannot model this, because the backbone is correct, so FDR control does not catch it. Without the option, about 65% of accepted deamidated PSMs on the #10364 suite are such mis-picks.

The check. A candidate is an isotope mimic when replacing its isotope-like variable modifications (within 0.05 Da of one or two isotope steps) by whole isotope steps makes its precursor error smaller.

  • Typical mimic: error ≈ −19 mDa with the deamidation, ≈ 0 when explained as an isotope step → mimic.
  • Genuine deamidation: error ≈ 0 with the modification, ≈ +19 mDa as an isotope step → kept.

What remove does. In scoreSpectraAgainstIndex_, mimics are skipped before scoring, so they take no slot in the candidate pool or the top-N list. Their rank goes to the unmodified peptide at the neighbouring isotope offset, which is in the index anyway. Example from the test data: IALSRPNVEVVALN(Deamidated)DPFITNDYAAYM(Oxidation)FK at isotope error −1 is replaced by the unmodified peptide at 0.

Effect in the benchmark.

  • Accepted deamidated PSMs fall from ~7,400 to ~2,000; the mis-pick share among them from 65% to 1.8%.
  • Total PSMs at q ≤ 0.01 rise by 1.9% (10 files up, 1 flat, 1 down), because the freed top-N slots are refilled with other candidates. Entrapment databases: +2.1%, estimated true PSMs +2.0%.
  • Option off stays byte-identical to the merge-base; runtime and memory are unchanged.

Limitation. A genuine deamidation whose precursor measurement error is more than ~10 mDa towards the isotope step is discarded as well, since the rule only compares which of the two precursor errors is smaller. This probably contributes to the small rise in entrapment FDP (1.33% → 1.43%), most visible on Lumos LFQ (1.05% → 1.39%, estimated true PSMs only +0.2%).

Closing for now

Closing this PR for now; the results are interesting and it may be picked up again later. The branch claude/andes-isotope-mimic stays, and the full benchmark (scripts, per-file tables, reproduction recipe) is in benchmark-reproduction/andes-ports/pr10635 on claude/andes-benchmarks. Open points if it is revived: the FDP rise on Lumos LFQ and whether a tolerance-aware rule (instead of "smaller error wins") keeps more genuine deamidations.


Generated by Claude Code

Copy link
Copy Markdown
Contributor Author

Note for a later revisit: genuine deamidations lost by remove, and recalibration

How many genuine deamidations does remove discard? There is no ground truth for the modification state, so this is an estimate. Assume a genuine deamidated PSM has the same precursor residual distribution as the accepted unmodified PSMs of the same file. It is then discarded when its residual falls below the rule's boundary of −k·9.7 mDa (half the 19.3 mDa deamidation/¹³C gap, k = number of deamidations). Entrapment databases, off vs remove, per seed:

group unmodified PSMs below −9.7 mDa est. genuine deamidations lost share of genuine deamidations
Velos CID 7.4% 62 8.6%
HF-X HCD 6.4% 27 5.4%
Astral HCD 5.6% 14 5.6%
Lumos HCD LFQ 3.0% 20 3.1%
All 12 files 122 5.8%

(Suite databases: 135, 5.9%.)

  • Cross-check: in the off arm, 129 accepted deamidated PSMs flagged as mimics have a residual between −12 and −9.7 mDa, the boundary region where the misflagged genuine ones should sit.
  • Net, remove still accepts more deamidated PSMs (1,986) than off accepts unflagged ones (1,794), because the mimics had been crowding genuine deamidations out of the top-N.
  • A discarded genuine deamidation is usually not a lost spectrum. It is reassigned to the unmodified peptide at the neighbouring isotope offset: right peptide, missing modification. This probably contributes to the small FDP rise.

Not a low-resolution effect. All four datasets have Orbitrap/Astral precursors; Velos CID is low-res only for the fragments, which the rule does not use. What matters is the absolute precursor error, because the boundary is fixed in mDa while measurement errors scale with mass:

group median residual 5% quantile
Velos CID −1.4 mDa −11.6 mDa
HF-X HCD −0.9 mDa −10.8 mDa
Astral HCD −2.2 mDa −11.2 mDa
Lumos HCD LFQ −0.5 mDa −5.8 mDa

With genuinely low-res precursors (ion-trap MS1, ~0.5 Da tolerance), 19 mDa cannot be resolved and the rule becomes arbitrary. There remove should stay off, or ProSE should disable it above some precursor tolerance.

Recalibration in OpenMS:

  • ProSE calibration:enabled (off in this benchmark) estimates the median shift and spread of the precursor error, but only shifts and narrows the tolerance window. It does not correct masses, and the mimic check (ProSEAlgorithm.cpp:2613) uses the uncorrected precursor m/z. Enabling it would leave the loss unchanged.
  • The TOPP tool InternalCalibration actually recalibrates the mzML, from lock masses or from the IDs of a first search, optionally with an m/z- and RT-dependent model. It costs a second search.

Effect of a per-file offset correction (share of unmodified PSMs below −9.7 mDa after subtracting the file's median residual):

group uncorrected offset-corrected
Velos CID 7.4% 5.5%
HF-X HCD 6.4% 5.3%
Astral HCD 5.6% 4.8%
Lumos HCD LFQ 3.0% 2.9%

The loss would drop from about 6% to about 4.5–5%; most of it comes from the tails of the error distribution, not the systematic offset.

Options if this is revived:

  1. Cheap: subtract cal.precursor_shift in the mimic check when calibration runs. A one-line change that recovers about a quarter of the loss.
  2. More effective: discard only when the residual lies clearly on the isotope side, i.e. its distance from the boundary relative to the calibrated spread. Candidates in the ambiguous region around −10 mDa stay and Percolator decides. This gives up some mimic suppression but protects genuine deamidations.
  3. Thorough: run InternalCalibration first. It narrows the error distribution itself, at the cost of a second search.

Generated by Claude Code

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