Skip to content

[FIX] PercolatorInfile: the peptide after an initial Met counts as protein N-terminal in enzN - #10730

Merged
timosachsenberg merged 1 commit into
developfrom
fix/percolator-enzN-met-clipping
Oct 26, 2026
Merged

timosachsenberg merged 1 commit into
developfrom
fix/percolator-enzN-met-clipping

Conversation

@timosachsenberg

@timosachsenberg timosachsenberg commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #10726. Follow-up to #10717.

Problem

Since #10717 a protein terminus ([) counts as a cleavage site in enzN/enzC. In a fully specific search, the only PSMs left with enzN = 0 are then the N-terminal peptides after initial-Met clipping (flank M, evidence start 1). Target proteins nearly all start with M, reversed decoy proteins rarely do, so enzN = 0 became a near target-only label: Percolator learns it and accepts Met-clipped random matches with no decoys to pay for them (entrapment FDP up to 23.7 % at q = 0.01 in the benchmarks of #10726).

Change

PercolatorInfile::stampPinFeaturesOnHits: when the first evidence has the flank M at start 1, the peptide is protein N-terminal for enzN, by the isEnz_ rules and by the ProteaseDB rule. FragmentIndex::isProteinNTerminal_ and PeptideIndexer (allow_nterm_protein_cleavage) already treat this peptide as protein N-terminal. The Peptide column keeps the M.

This is the fix proposed in #10726; in the benchmarks there it brought the entrapment FDP back to the level before #10717, in-process and with the percolator executable on the .pin.

Tests

PercolatorInfile_test: a Met-clipped peptide (M, start 1) and an unclipped protein-N-terminal peptide ([, start 0) both get enzN = 1, with Trypsin/P (Percolator rule) and Lys-C/P (ProteaseDB rule); an M at start 2 still gives enzN = 0; the Peptide column keeps M..

No reference file changes: the PercolatorAdapter and Comet fixtures of the TOPP and parity tests have no hit whose first evidence is M at start 1, and the ProSE .pin tests compare runs with each other.

Not built locally; CI runs the tests.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Corrected enzyme-feature calculations for peptides beginning at the protein N-terminus when the initial methionine is clipped, including for Trypsin/P and Lys-C/P.
    • Preserved the original flanking methionine in peptide metadata.

…otein N-terminal in enzN

Since #10717 a protein terminus ('[') counts as a cleavage site in enzN/enzC. In a fully specific search the only
PSMs left with enzN = 0 are then the N-terminal peptides after initial-Met clipping (flank 'M', start 1). Target
proteins nearly all start with M, reversed decoy proteins rarely do, so enzN = 0 became a near target-only label:
Percolator learns it and accepts Met-clipped random matches with no decoys to pay for them (#10726).

The peptide after the initial Met is now protein N-terminal for enzN as well, as FragmentIndex (isProteinNTerminal_)
and PeptideIndexer (allow_nterm_protein_cleavage) already treat it. The Peptide column keeps the M.

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

coderabbitai Bot commented Oct 26, 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: 14478726-d52f-4dae-b349-0fcebc7f7e68
Commits

Reviewing files that changed from the base of the PR and between 6b025ae and ef608d6.

Files selected for processing: 2
  • src/openms/source/FORMAT/PercolatorInfile.cpp
  • src/tests/class_tests/openms/source/PercolatorInfile_test.cpp

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

Walkthrough

When peptide evidence starts at position 1 and has a preceding methionine, enzyme-feature stamping treats the peptide as protein N-terminal. The peptide representation retains the methionine flank. Tests cover Trypsin/P and Lys-C/P, including an internal methionine case.

Changes: Percolator N-terminal enzyme feature

Layer / File(s) Summary
Adjust N-terminal site and verify feature values
src/openms/source/FORMAT/PercolatorInfile.cpp, src/tests/class_tests/openms/source/PercolatorInfile_test.cpp
For evidence starting at position 1 with a preceding methionine, the custom digestion and built-in enzyme paths use an adjusted N-terminal site for enzN. The custom path also uses it for internal-cleavage context. Tests cover clipped and internal methionine cases and confirm that peptide metadata retains the methionine flank.

Possibly related PRs

  • OpenMS/OpenMS#10717: This PR also changes how protein-terminal sites affect Percolator enzyme features.
  • OpenMS/OpenMS#10713: This PR changes the custom digestion and built-in enzyme paths used by this feature.
  • OpenMS/OpenMS#10714: This PR changes the Percolator feature-stamping behavior used by in-process rescoring.

Priority: Normal

Change: Bug fix · Severity of issue fixed: Medium

Merge Risk: Minimal · up to ef608

No actionable merge-blocking risk was established for the intended N-terminal enzyme-feature change.

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. Analyzed 1 functions across 2 files. 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 clearly identifies the PercolatorInfile change and accurately states that peptides after an initial methionine count as protein N-terminal for enzN.
Linked Issues check Passed Directly linked issue #10726 requests that a peptide after initiator-Met removal (aa_before 'M', evidence start 1) count as protein N-terminal for enzN. The diff in PercolatorInfile::stampPinFeaturesO…
Out of Scope Changes check Passed The whole-PR diff touches only src/openms/source/FORMAT/PercolatorInfile.cpp and src/tests/class_tests/openms/source/PercolatorInfile_test.cpp. The source change is limited to the enzN site computatio…
Full details: Linked Issues check

Explanation

Directly linked issue #10726 requests that a peptide after initiator-Met removal (aa_before 'M', evidence start 1) count as protein N-terminal for enzN. The diff in PercolatorInfile::stampPinFeaturesOnHits adds n_site = '-' when aa_before == 'M' and getStart() == 1. n_site replaces aa_before in both the ProteaseDB branch (enzN via isValidProduct and the 'X'+n_site context) and the isEnz_ branch. The Peptide column still uses aa_before, so it keeps 'M'. This matches the fix proposed in #10726. The issue's suggested test covers a Met-clipped target peptide and an unclipped protein-N-terminal peptide, both with enzN = 1. PercolatorInfile_test adds these checks for Trypsin/P (Percolator rule) and Lys-C/P (ProteaseDB rule), a negative case with M at start 2 (enzN = 0), and a check that the Peptide column reads M.PEPKTIDER.S. The test uses a reversed-decoy-style fixture only indirectly (by start position and flank), not as a full target/decoy protein pair. Benchmark figures in the issue and PR were not re-run here. Tests were not run in this review; the PR states CI runs them.

Full details: Out of Scope Changes check

Explanation

The whole-PR diff touches only src/openms/source/FORMAT/PercolatorInfile.cpp and src/tests/class_tests/openms/source/PercolatorInfile_test.cpp. The source change is limited to the enzN site computation in stampPinFeaturesOnHits, which is the scope of #10726. The local variable first_evidence and the aa_before/aa_after handling only restructure that same computation. The test changes add a start parameter to the stamp helper, a stamp_hit helper that returns the hit, and new assertions for the new rule and its negative case. These support the objective and do not change unrelated behavior. The PR description states that no reference files changed, and the diff confirms no fixture or reference file changes in the reviewed range. The alternatives in #10726 (leaving enzN/enzC out of training, pseudo-reversed decoys) are not implemented, which is correct because the issue does not request them.

Finishing Touches: 💡 1
📝 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 the peptide’s start,
And marks the clipped site with care.
The methionine stays in the text,
While enzyme features use the right site.
Then off hops the rabbit, pleased.

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

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.

Percolator features since #10717: enzN = 0 now marks Met-clipped target peptides only, and ProSE rescoring loses FDR control

1 participant