Repository navigation
[FEATURE] ProSE: fit the mass-accuracy kernel center during calibration; calibration:enabled gains 'auto' - #10365
Closed
timosachsenberg wants to merge 5 commits into
Closed
timosachsenberg wants to merge 5 commits into
timosachsenberg wants to merge 5 commits into
Conversation
…brate high-resolution searches by default Collect the signed ppm errors of the matched ions of the calibration pass' confident PSMs and fit the kernel of scoring:method=mass_accuracy from them: the main search centers the Gaussian on their median and uses 1.4826 * MAD as its width instead of the fixed scoring:mass_error_sd. The calibration pass itself keeps scoring with the configured kernel. The kernel the main search used is recorded in the search parameters, in all single-file, chunked and chunk-major multi-file paths. calibration:enabled gains 'auto', now the default: the pass runs for high-resolution fragment tolerances (<= 0.1 Da / <= 100 ppm) and is skipped otherwise, following the resolution proxy of the scorer selection. HyperScore::computeMassAccuracy takes an optional kernel center and HyperScore::matchedFragmentErrorsPpm exposes the matched ions' errors; both are bound in pyOpenMS. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01UGKGwMtvsf72yELV4xNmAQ
… not fitted The calibration pass now fits the kernel center and width, so the earlier entry's sentence contradicted the new one. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01UGKGwMtvsf72yELV4xNmAQ
This was referenced Sep 30, 2026
…ernel only widens The independent 20-file benchmark of this PR showed that running the calibration pass by default costs rescored yield on unlabelled HCD and timsTOF data (HF-X -3.5%, Lumos LFQ -4.0%, timsTOF -2.5%): the base's calibration tightens the precursor window to the 0.5-99.5% quantiles of the most confident isotope-error-0 PSMs, and real PSMs outside that window never become candidates. calibration:enabled therefore defaults to false again; 'auto' stays available. The fitted kernel width (1.7-3.5 ppm on Orbitrap and Astral files) was rescoring-neutral but cost 3-38% of the native TDC yield per file: it is fitted on the intense, accurate fragments of the most confident PSMs and then penalizes the weaker true fragments of borderline PSMs. The main search now uses the fitted width only when it is wider than scoring:mass_error_sd; the fitted center is always used. Tests cover the default, the kept configured width with a fitted center, the widening to a wider fit, and the chunked and multi-file provenance. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01UGKGwMtvsf72yELV4xNmAQ
…rnel # Conflicts: # CHANGELOG
…references Every search now records scoring:mass_error_kernel, scoring:mass_error_sd_resolved and scoring:mass_error_shift_resolved in its search parameters. Only these three UserParam lines are 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 #10379, the standalone port of this PR onto #10379 also changes this PR's behaviour, based on the 20-file benchmark of #10364:
As this PR stands, Generated by Claude Code |
timosachsenberg
pushed a commit
that referenced
this pull request
Oct 2, 2026
…ibrate high-resolution searches by default Collect the signed ppm errors of the matched ions of the calibration pass' confident PSMs and fit the kernel of scoring:method=mass_accuracy from them: the main search centers the Gaussian on their median and uses 1.4826 * MAD as its width instead of the fixed scoring:mass_error_sd (floored at 0.1 ppm; at least max(calibration:min_psms, 50) matched ions). The calibration pass itself keeps scoring with the configured kernel. The kernel the main search used is recorded in the search parameters (scoring:mass_error_kernel, scoring:mass_error_sd_resolved, scoring:mass_error_shift_resolved) in the single-file, chunked and chunk-major multi-file paths. calibration:enabled gains 'auto', now the default: the pass runs for high-resolution fragment tolerances (<= 0.1 Da / <= 100 ppm, the resolution proxy of the deisotoping choice) and is skipped otherwise; 'true' and 'false' keep their meaning. HyperScore::computeMassAccuracy takes an optional kernel center and HyperScore::matchedFragmentErrorsPpm exposes the matched ions' errors; both are bound in pyOpenMS. Standalone version of #10365 on develop (previously stacked on #10335). The four ProSE idXML references gain the three kernel lines (ProSE_4, which calibrates, records its fitted kernel); hits are unchanged. The parameter is no longer a true/false flag, so a bare -Search:calibration:enabled is not read as 'true' by TOPPBase any more: the Bruker DDA calibration TOPP tests pass 'true' explicitly, and the uncalibrated Bruker DDA baseline pins 'false' to keep measuring what its PSM floor was set for. 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 2 of the ProSE/ANDES gap review: the mass-accuracy kernel is fitted per run instead of assuming a Gaussian centered at zero, andcalibration:enabledgains a resolution-awareautomode.What changes
runCalibrationPass_also collects the signed ppm errors of the matched fragment ions of its confident PSMs (same score crop and precursor band as the tolerance estimates) and fits the kernel ofscoring:method=mass_accuracyfrom them: center = median, width = 1.4826 × MAD (floored at 0.1 ppm), requiring at least max(calibration:min_psms, 50) matched ions. The main search centers its Gaussian on the fitted center and uses the fitted width only when it is wider thanscoring:mass_error_sd; the fit never narrows the kernel. The calibration pass itself keeps scoring with the configured kernel, so the fit is not circular.calibration:enabledgainsauto: the pass runs for high-resolution fragment tolerances (≤ 0.1 Da / ≤ 100 ppm, the resolution proxy the scorer selection already uses) and is skipped otherwise.trueandfalsekeep their meaning, andfalsestays the default.scoring:mass_error_kernel=calibratedorconfigured,scoring:mass_error_sd_resolved,scoring:mass_error_shift_resolved) in all three search paths: single file, chunked, and chunk-major multi-file (per file).HyperScore::computeMassAccuracytakes an optional kernel center (mass_error_shift_ppm, default 0, so existing calls are unchanged); newHyperScore::matchedFragmentErrorsPpmexposes the matched ions' signed errors. Both are bound in pyOpenMS.Why
ANDES's rank-based scorer is insensitive to the fragment error distribution; ProSE's Gaussian kernel is only as good as its center. Real runs carry a residual calibration offset (−2.6 to +3.1 ppm across the 20 benchmark files below), so a kernel centered at zero penalizes every true fragment by the offset. Fitting the center from the run's own confident PSMs removes that.
Why the defaults changed after the first revision
The first revision made
autothe default and used the fitted width as is. The independent 20-file benchmark below measured both:autoremains available.Behaviour change
None with default parameters. With
calibration:enabled=trueorautoandscoring:method=mass_accuracy, the main search uses the fitted center and a width that is never narrower thanscoring:mass_error_sd. An explicitscoring:mass_error_sdremains the kernel whenever no calibration ran or the fit had too few ions.Tests
HyperScore_test: kernel center, matched-error helper, Da/ppm parity, empty and out-of-tolerance cases, exceptions.ProSEAlgorithm_test: the default is off andautofollows the fragment tolerance resolution; the fit recovers a synthetic ~4 ppm shift with a narrow width; with a wider configured width the main search keeps that width and the fitted center, with a narrower configured width it widens to the fit; the recorded kernel and provenance in single-file, chunked and multi-file runs; an uncalibrated run keeps the configured kernel.test_HyperScore_mass_accuracy.py: centered kernel and error helper through the binding.scoring:mass_error_kernel,scoring:mass_error_sd_resolved,scoring:mass_error_shift_resolved); every identification, score and annotation line is unchanged.FragmentIndex_test,HyperScore_test,ProSEAlgorithm_testand allTOPP_ProSE_*tests pass locally on this branch (merged with the currentcodex/native-cid).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.pr65_autostill uses HyperScore on high-resolution files, so its changes measure auto calibration, not the new mass-accuracy kernel. The separate kernel comparison below sets calibration=true and mass_accuracy on both sides and verifies identical calibrated tolerances. Do not enable auto calibration universally on the strength of the labelled-data gains: the matrix includes substantial unlabelled HCD losses. Onlumos_lfq_5192, the mass window tightens from ±20 ppm to approximately −3.50/+3.11 ppm; 1,726/1,919 lost baseline assignments across the three seeds lie clearly outside that window, considering every isotope offset and a 0.05-ppm guard beyond rounded log bounds. Most of these exclusions involve a nonzero isotope correction. The diagnostic and its limits are saved indiagnostics/calibration_losses.json.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.