Repository navigation
[FIX] Percolator features: protein terminus in enzN/enzC; in-process parity (CalcMass, -cpos) - #10717
Conversation
…in the enzyme features OpenMS marks a protein terminus as '[' / ']' (PeptideEvidence), the enzyme rules (adapted from Percolator's converters) as '-': it was mapped to '-' only for the Peptide column, after enzN/enzC were computed, so a protein-terminal peptide never had enzN or enzC set. The terminus is now mapped before. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01EERt1z5XLKf5zx7xXpXGg9
|
CI red: Cause. The fixture (
The fix itself stays: the enzyme features were wrong for protein-terminal peptides. What has to change is the parity tests' realistic fixture, which needs one that trains without the fallback. Generated by Claude Code |
…olatorAdapter -cpos 0 selects Cpos by cross-validation
With correct enzN/enzC (previous commit), the realistic sections of the Percolator parity tests no longer pass on
the fallback both implementations took on their fixture (training failed, both reset to the default vector), and
in-process and executable training diverged (r 0.955 / 0.90). Two in-process differences from the executable:
- Percolator::rescorePSMs() trained on the CalcMass column, which the executable reads as metadata (as the
parity test's own helper does). It now passes it only as RescoreInput::calc_masses.
- PercolatorAdapter -cpos 0 ("set by cross validation") left the library default c_pos 0.1 in-process; the
executable selects Cpos by cross-validation without -p. It now passes c_pos 0, which does the same.
With both, the adapter parity test matches exactly (r = 1.0; each fix alone: 0.78 / 0.89). The library parity
test's realistic section compared in-process with c_pos 0.1 against the executable without -p; it passes -p 0.1.
Percolator_test's rescorePSMs check counted targets at q <= 0.01 (> 100); without CalcMass as a feature 93 reach
it, all 300 reach q <= 0.05. The check counts targets at q <= 0.05 now; the q-value difference from the
executable on that data is #10718.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01EERt1z5XLKf5zx7xXpXGg9
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Normalize terminal flanks and verify enzyme features src/openms/source/FORMAT/PercolatorInfile.cpp, src/tests/class_tests/openms/source/PercolatorInfile_test.cpp |
Terminal flank markers are normalized before enzyme-feature calculations and peptide formatting. Tests cover N- and C-terminal markers for Trypsin/P, Lys-C, and Lys-C/P. |
Align in-process training inputs and parameters src/openms/source/ANALYSIS/ID/Percolator.cpp, src/topp/PercolatorAdapter.cpp, src/tests/class_tests/openms/source/Percolator_subprocess_parity_test.cpp, src/tests/class_tests/openms/source/Percolator_test.cpp |
CalcMass is excluded from numeric training features, and the in-process backend always sets c_pos from -cpos. Tests set the subprocess -p value and update target and decoy q-value count expectations. |
Possibly related PRs
- OpenMS/OpenMS#10713: This PR changes the same enzyme-feature code path and tests terminal flank handling.
Suggested reviewers: jpfeuffer
Priority:
Change: Bug fix
Merge Risk: 
Minimal · up to a11dd
-
No actionable merge-blocking risk is established by the reviewed changes.
Pre-merge checks: 
4 · 
1
-
Failed checks: 1 warning Passed checks: 4 passed-
Full details: Title check
-
Explanation
The title names the two main parts of the change: protein-terminus handling for the enzN/enzC Percolator features, and in-process parity via CalcMass and -cpos. The raw summary shows the terminus normalization in PercolatorInfile.cpp, the CalcMass exclusion in Percolator.cpp, and the c_pos assignment in PercolatorAdapter.cpp, so the title matches the changeset. It is long at 93 characters, and the parenthetical tokens are dense, but it is specific and accurate.
-
-
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.
A rabbit checks the flank markers in a row,
Then watches enzyme-feature values flow.
CalcMass steps outside the training set,
While c_pos follows the value it gets.
Tests count targets, decoys, and the trail,
The rabbit hops along the Percolator trail.
Comment @coderabbitai help to get the list of available commands.
…otein N-terminal in enzN (#10730) 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]>
… and develop; the coded matchIons overload skips series codes other than 0 and 1; precursorCharges 'search' mode tested Review (CodeRabbit): the static rescoreWithPercolator() default-constructs PercolatorTraining, whose calc_mass_feature defaulted to true while the tool parameter and OpenMS develop (OpenMS#10717) default to false, so library callers trained with CalcMass as a feature. The coded FragmentIonLikelihoodModel::matchIons overload counted any series code other than 0 as a suffix ion where HyperScore's codeSeries() rejects it; such ions are skipped now, as parseIonName() skips unknown names. FragmentIndex_test covers precursorCharges() with search_outside_range true (recorded charges outside the range are searched, an unknown charge gives the range). ProSEAlgorithm_test, FragmentIndex_test, FragmentIonLikelihoodModel_test, HyperScore_test and the TOPP ProSE tests pass (247). Co-Authored-By: Claude Fable 5.1 <[email protected]>
…estriction with mono correction The merge of develop (9695fe5) resolved two hunks to this branch's older version, because #10740's last commit a5cbb87 was never in it: PercolatorTraining::calc_mass_feature went back to true (library callers of rescoreWithPercolator() trained on CalcMass again, unlike the tool and develop since #10717), and the coded matchIons overload lost the guard that skips series codes other than 0 and 1. Both are develop's again, and two tests pin them: PercolatorTraining{}.calc_mass_feature is false, and ions with a series code of 2 are not scored. restrictIndexToSpectra_() is false with precursor:mono_correction: the single-use index was restricted to windows around the recorded precursors, which the correction then moved by up to two 13C spacings, so a precursor moved from the second trace found no peptide when the isotope range did not reach -2 (the library default). The mono-correction TOPP test now requires at least one moved precursor; it accepted zero. Review comments by @timosachsenberg on #10804. Co-Authored-By: Claude Fable 5.1 <[email protected]>
Description
1. A protein terminus counts as a cleavage site in enzN/enzC
The .pin enzyme features (
enzN,enzC) never counted a protein terminus as a cleavage site. This affects-out_pinof ProSE and PercolatorAdapter and the in-process Percolator rescoring.[/](PeptideEvidence::N_TERMINAL_AA/C_TERMINAL_AA).-and count it as enzymatic.stampPinFeaturesOnHits()mapped[/]to-only for thePeptidecolumn, afterenzN/enzCwere computed. So a peptide at a protein's N-terminus gotenzN = 0, and one at its C-terminusenzC = 0.The mapping now happens before the features are computed. Found while reviewing #10713.
2. In-process Percolator: two differences from the executable
With correct enzN/enzC, the "realistic idXML" sections of
Percolator_subprocess_parity_testandPercolatorAdapter_parity_testfailed: in-process vs executable r = 0.955 / 0.90, threshold 0.99.Why they had passed before:
THIRDPARTY/CometAdapter_4_out.idXML, fully tryptic) had 37 N-terminal and 30 C-terminal PSMs with the wrong enzN/enzC = 0.Now training succeeds, which exposed two in-process differences:
CalcMasswas a training feature inPercolator::rescorePSMs(). The executable reads it from the .pin as metadata, as the parity test's own helper does. It is now passed only asRescoreInput::calc_masses. This affects in-process PercolatorAdapter and ProSE rescoring.-cpos 0("Set by cross validation") was ignored in-process. The in-process path kept the library defaultc_pos = 0.1, while the executable selects Cpos by cross-validation when no-pis given. The adapter now passesc_pos = 0, which cross-validates.With both,
PercolatorAdapter_parity_testmatches exactly (r = 1.000000); each fix alone gives r = 0.78 / 0.89. The library-layer section compared in-process withc_pos 0.1against the executable without-p; it now passes-p 0.1.3.
Percolator_testThe
rescorePSMscheck counted targets at q ≤ 0.01 (more than 100). WithoutCalcMassas a feature, 93 of 300 reach that, and all 300 reach q ≤ 0.05. The check now counts targets at q ≤ 0.05 (more than 250) and decoys at q ≤ 0.01 (fewer than 10). On that data, in-process q-values differ from the executable's even after these fixes; that is tracked separately in #10718.Tests (local Release build on Linux, without GUI, OpenTIMS and Thermo RAW; Percolator 3.06 from THIRDPARTY):
PercolatorInfile_test: features with[before /]after, by a Percolator rule and a ProteaseDB rule. Fails without fix 1.StopWatch_test, which failed once under-j4load and passes alone.-Search:rescore false.Checklist
🤖 Generated with Claude Code
https://claude.ai/code/session_01EERt1z5XLKf5zx7xXpXGg9
Summary by CodeRabbit
-cposvalue even when it is zero.