Repository navigation
[FEATURE] ProSE: self-trained per-run fragment ion priors as Percolator features - #10366
Closed
timosachsenberg wants to merge 4 commits into
Closed
timosachsenberg wants to merge 4 commits into
timosachsenberg wants to merge 4 commits into
Conversation
Add FragmentIonLikelihoodModel, a per-run likelihood model of fragment ion presence and intensity rank per ion series, precursor charge, fragment charge and relative cleavage position, with pseudo-count back-off so that a few thousand PSMs suffice. ProSE trains it per file when annotate:self_trained_ion_priors is set: the confident target PSMs (target- decoy competition q <= annotate:ion_prior_train_fdr of the native score) provide the signal counts, their reversed sequences matched against the same spectra the noise counts. Every hit then receives the additive features ion_prior_llr, ion_prior_explained and ion_prior_topk_observed, which are listed in extra_features for Percolator; the training set is recorded as ion_prior:trained and ion_prior:training_psms. Runs without decoys or with fewer than annotate:ion_prior_min_psms confident PSMs get zeros and a warning. Native scores and candidate selection are unchanged, and nothing is pre-trained or shipped. The annotation runs after PeptideIndexing and before FDR in all three search paths (single, chunked, chunk-major multi-file), so each file of a multi-file run learns its own fragmentation pattern. Includes class tests for the model and the ProSE integration, a pyOpenMS binding with a test, a CHANGELOG entry and the ProSE tool documentation. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01UGKGwMtvsf72yELV4xNmAQ
…uracy entry The new bullet had been inserted inside the mass_accuracy entry, so that entry's last three lines read as part of the ion-prior bullet. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01UGKGwMtvsf72yELV4xNmAQ
This was referenced Sep 30, 2026
…erences Every search now records annotate:self_trained_ion_priors in its search parameters. Only this UserParam line is added to ProSE_1_out (also used by the multi-file and chunked tests), ProSE_2_out, ProSE_4_out and ProSE_10_out; every identification, score and annotation line is unchanged. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01UGKGwMtvsf72yELV4xNmAQ
Contributor
Author
|
Closing as superseded by #10378, the standalone port of this PR onto #10378 keeps this PR's class, tests and binding. On top it adds a clang build fix, fragment charges that follow the deisotoping decision, a cross-fitted model, and bounds checks. Its benchmark on the 20-file suite of #10364 and the entrapment checks are in its description. Generated by Claude Code |
timosachsenberg
added a commit
that referenced
this pull request
Oct 2, 2026
…or features Add FragmentIonLikelihoodModel, a per-run likelihood model of fragment ion presence and intensity rank per ion series, precursor charge, fragment charge and relative cleavage position, with pseudo-count back-off so that a few thousand PSMs suffice. ProSE trains it per file when annotate:self_trained_ion_priors is set: the confident target PSMs (target- decoy competition q <= annotate:ion_prior_train_fdr of the native score) provide the signal counts, their reversed sequences matched against the same spectra the noise counts. Every hit then receives the additive features ion_prior_llr, ion_prior_explained and ion_prior_topk_observed, which are listed in extra_features for Percolator; the training set is recorded as ion_prior:trained and ion_prior:training_psms. Runs without decoys or with fewer than annotate:ion_prior_min_psms confident PSMs get zeros and a warning. Native scores and candidate selection are unchanged, and nothing is pre-trained or shipped. The annotation runs after PeptideIndexing and before FDR in all three search paths (single, chunked, chunk-major multi-file), so each file of a multi-file run learns its own fragmentation pattern. The model sees the singly charged fragments native scoring matches. Standalone version of #10366 on develop (previously stacked on #10335). The search parameters record annotate:self_trained_ion_priors; the four ProSE idXML references gain that line. Includes class tests for the model and the ProSE integration, a pyOpenMS binding with a test, a CHANGELOG entry and the ProSE tool documentation. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01D1N3pC2AqJt57Q3v87bWxz
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Follow-up to #10335, stacked on
codex/native-cid(the base should move todeveloponce that PR merges). Implements item 7 of the ProSE/ANDES gap review: self-trained fragment ion priors as Percolator features, without shipping a trained model.What changes
FragmentIonLikelihoodModel: a per-run likelihood model of fragment ion presence and intensity rank. Every theoretical ion is placed in a context (prefix/suffix series × precursor charge bucket 1-2 / 3 / ≥4 × fragment charge 1 / ≥2 × 10 relative-position bins); its outcome is absence or one of 7 intensity-rank bins. Two count tables are kept: the ions of confident peptides (signal) and the ions of their reversed sequences matched against the same spectra (noise).finalize()turns both into smoothed probabilities with pseudo-count back-off (full context → series and charges → series → flat prior), so a few thousand PSMs suffice and unseen contexts stay finite.score()yields three additive features per PSM: the summed log-likelihood ratio of its ion outcomes, the explained presence (Σ P(present) over matched ions / over all ions) and the observed fraction of the top-k ions the run predicts as most likely.annotate:self_trained_ion_priors(off by default),annotate:ion_prior_train_fdr(0.01) andannotate:ion_prior_min_psms(100). After PeptideIndexing and before FDR, each file's best target hits at target-decoy competition q ≤ threshold of the native score train the model; every hit then receivesion_prior_llr,ion_prior_explainedandion_prior_topk_observed, appended toextra_featuresso PercolatorAdapter picks them up. The training set is recorded asion_prior:trained/ion_prior:training_psms. Without decoys, or with too few confident PSMs, the features are 0 (the columns stay complete) and a warning is logged. All three search paths are covered; multi-file runs train per file.Why
ANDES's strong-mode rescoring gains much of its yield from fragmentation-aware features. Shipping a trained intensity model is out of scope for OpenMS and instrument-dependent. A model learned from the run's own confident PSMs, with reversed sequences as the null hypothesis, gives Percolator a fragmentation-pattern feature that adapts to the instrument, activation and charge regime of every file, with no external dependency and no pre-trained tables.
Tests
FragmentIonLikelihoodModel_test: intensity ranks, rank bins, contexts, ion-name parsing (incl. z+1 and cross-link names), the training/finalize contract, the flat prior without observations, back-off to unseen contexts, feature semantics (true peptide vs reversed sequence, unseen peptide and charge, Da/ppm parity, top-k bounds, empty inputs) and exceptions.ProSEAlgorithm_test: features on every hit with provenance, unchanged native search, best hits score higher than their alternatives; zero fallbacks for too few confident PSMs, an unreachable q-threshold and a search without decoys; chunked and multi-file runs (per-file and chunk-major) with identical per-file results for identical input files.test_FragmentIonLikelihoodModel.py: training, scoring and the static helpers through the binding.annotate:self_trained_ion_priorssearch-parameter entry; every identification, score and annotation line is unchanged.FragmentIonLikelihoodModel_test,ProSEAlgorithm_test,HyperScore_test,FragmentIndex_testand allTOPP_ProSE_*tests pass locally on this branch (merged with the currentcodex/native-cid); the binding file compiles.Checklist
🤖 Generated with Claude Code
https://claude.ai/code/session_01UGKGwMtvsf72yELV4xNmAQ
Generated by Claude Code
Independent 20-file benchmark
Independently benchmarked each PR patch on common base
c1b2f202742270273a045ef4b56e7aa346e9871f, using all 20 frozen files (8,000 DDA MS2/file), the same FASTAs, and Percolator 3.09.0 seeds 1/42/137 at q ≤ 0.01. PRs are applied separately, not stacked. Sources, applied Git tree IDs, effective patches, exact requested/resolved parameters, commands, logs, output checksums and all seed counts are in the reproduction supplement.For all 20 files, #10366 has identical native candidate/score TSVs and byte-identical normalized PINs after removing only its three added prior columns. The measured changes therefore come from rescoring features. Gains are modest and dataset-dependent; keep the existing opt-in scope pending stronger validation.
Measured heads: #10365
160412c13122c1ae2205580eeec5b43018f7a006, #103665f66ab7ee2b7e3487081838964b9491e7696a4b8, #10368 initial9a3d57796d3ef685f66f9962e49e4c3c90e5ac58and latestd21f55b2575c523b4f8be13f407a62b276819496. Follow-up heads #1036579e08f2948f6000787d4eef992bb6b33572f5419/ #103666a29032936bb6e4d49c4fa40e712f4bbefd1cee0differ only in CHANGELOG; runtime/test sources are identical. #10368's subnormal-intensity correction was rebuilt and rerun on all 20 files.Reproduce using the pinned ZIP pr-ablation-reproduction.zip,
SHA256 `ec8e4813196141bd6394690fe3a3bac96841f9c0c0e29b577f58a43fa919ab09`. Verify its manifest, then follow the README's commands (`prepare_sources.py`, `build.py`, `run.py`, `evaluate.py --require-complete --write`, and `intensity_control.py`). The original input bundle remains pinned at `a5705ec8e1cb19d40ebfa7bb16f6b5651aa1dc65`. [Per-file/seed results](https://raw.githubusercontent.com/OpenMS/OpenMS/d3e79df9b54c1d6be37e49e4eddcade16f9b556c/benchmark-reproduction/prose-andes/pr-ablation-20260930/per_file.tsv),`` per-group results,[comparison with pinned ANDES/Sage](https://raw.githubusercontent.com/OpenMS/OpenMS/d3e79df9b54c1d6be37e49e4eddcade16f9b556c/benchmark-reproduction/prose-andes/pr-ablation-20260930/cross_engine.tsv).`` No raw data or result table is silently substituted.Counts are nominal-q yields, not independently validated true positives. Seeds are algorithmic repeats. The prior model trains within the same file before Percolator cross-validation; out-of-fold prior training / independent FDR validation remains untested. The native harness recompiles the affected algorithms against pinned pyOpenMS support; this is not a full TOPP/binding build. Timings under concurrent load are not a speed benchmark.
Full comparison: #10364.