Skip to content

refine: drop Pass-2 PSMs that an isotope mis-pick explains better - #101

Merged
ypriverol merged 1 commit into
fix/refine-decoy-balancefrom
fix/refine-isotope-artefact-guard
Oct 4, 2026
Merged

ypriverol merged 1 commit into
fix/refine-decoy-balancefrom
fix/refine-isotope-artefact-guard

Conversation

@ypriverol

Copy link
Copy Markdown
Contributor

Stacked on #100 (paired Pass-2 decoys); merge that first.

Problem

Deamidation (+0.984016 Da) is 19 mDa away from one precursor isotope step (+1.003355 Da). When an unmodified peptide's precursor is picked on its M+1 peak, the deamidated form of the same peptide fits the precursor within tolerance. Decoys cannot model that artefact, so Percolator accepts it. On Astral with #100 applied, 8,042 deamidated PSMs pass at 1%:

  • 14% have a precursor residual near 0, as a real deamidation would;
  • 61% sit at +12 to +26 mDa, where an M+1 mis-pick lands.

Fix

A Pass-2 PSM is dropped when replacing its isotope-like variable mods by whole isotope steps gives a smaller precursor error. "Isotope-like" means a mod within 50 mDa of ±1–2 isotope steps. In the default tier that is deamidation only. Oxidation, acetyl and pyro-Glu are unaffected, and unit tests check both cases. The rule reads only the precursor mass, so it applies to targets and decoys alike. The [REFINE] log line reports how many PSMs it dropped.

Measured (Astral HYE, Percolator 3.7.1, PSMs at 1% q, seeds 1 / 2 / 3)

arm total Pass-2 (modified)
no --refine 41,437 / 41,323 / 41,360 —
--refine, #100 50,013 / 49,913 / 49,978 9,879 / 9,835 / 9,854
--refine, #100 + this PR 44,804 / 44,655 / 44,798 3,940 / 3,922 / 3,918

Accepted deamidations (seed 1), by precursor residual after removing whole isotope steps:

near 0 at the mis-pick position (+12 to +26 mDa)
#100 1,147 4,869
this PR 1,031 43

117,970 Pass-2 winners are dropped. Pass-2 target and decoy rows stay balanced (327,488 / 328,442).

Net effect: --refine now adds about +3,400 PSMs (+8%) over the no-refine control, down from an apparent +20,000 on main. About 10% of near-zero deamidations are also lost: a true deamidation with a −10 mDa precursor error is indistinguishable by mass from a mis-pick. That is the cost of a mass-only rule.

Still open

  • With --refine, Pass 1 is about 500 PSMs below the no-refine control (40,864 vs 41,437), so Pass-2 rows still displace some correct unmodified PSMs.
  • Entrapment still cannot see Pass 2, so the +8% is the decoy-based estimate, not a ground-truth one.

Deamidation (+0.984 Da) sits 19 mDa from one precursor isotope step
(+1.003 Da). When an unmodified peptide's precursor is picked on its M+1
peak, the deamidated candidate fits the precursor within tolerance, and
decoys cannot model the artefact. On Astral, 61% of accepted
deamidations sat at the mis-pick position.

A Pass-2 PSM is now dropped when replacing its isotope-like variable
mods (within 50 mDa of 1-2 isotope steps) by whole isotope steps gives a
smaller precursor error. The rule reads only the precursor mass, so it
applies to targets and decoys alike. The [REFINE] log line reports how
many were dropped.
@qodo-code-review

Copy link
Copy Markdown

ⓘ Qodo reviews are paused because the subscription is no longer active. Ask your workspace admin to reactivate the subscription to resume reviews. Manage billing

@coderabbitai

coderabbitai Bot commented Oct 4, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: d703f926-595a-41f7-a56a-3b144b81b0e0

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autopilot · 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.

@ypriverol
ypriverol merged commit 1c52161 into fix/refine-decoy-balance Oct 4, 2026
1 check passed
ypriverol added a commit that referenced this pull request Oct 5, 2026
…) (#102)

Deamidation (+0.984 Da) sits 19 mDa from one precursor isotope step
(+1.003 Da). When an unmodified peptide's precursor is picked on its M+1
peak, the deamidated candidate fits the precursor within tolerance, and
decoys cannot model the artefact. On Astral, 61% of accepted
deamidations sat at the mis-pick position.

A Pass-2 PSM is now dropped when replacing its isotope-like variable
mods (within 50 mDa of 1-2 isotope steps) by whole isotope steps gives a
smaller precursor error. The rule reads only the precursor mass, so it
applies to targets and decoys alike. The [REFINE] log line reports how
many were dropped.
@ypriverol
ypriverol deleted the fix/refine-isotope-artefact-guard branch October 15, 2026 16:05
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.

1 participant