Skip to content

[FEATURE] ProSE speed rounds: calibration pass scored as the main loop, recalibration model once per spectrum, parallel FDR filter, thread budget at the CPU count (output unchanged) - #10806

Merged
timosachsenberg merged 399 commits into
developfrom
claude/prose-speed-rounds-20261103
Nov 6, 2026

Conversation

@okohlbacher

@okohlbacher okohlbacher commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Stacked on #10805 (base branch claude/prose-mz-recalibration-20261103, against develop since #10804 was merged on 5 Nov 2026; develop is merged into this branch too, diffs unchanged); the diff is this PR's four commits, all in ProSEAlgorithm. The core-class pieces of the same rounds (EnzymaticDigestion, TheoreticalSpectrumGenerator, PercolatorInfile) are #10807, on develop; the timings below were measured with both.

Changes (search results unchanged)

  • The calibration pass scores its 10 % subset as the main loop does: ion-series theoretical spectra and the string-free scorer overloads, the per-thread scoring scratch, the subset in precursor-mass order in dynamic chunks, the TIC per spectrum in parallel. Its hits are collected in the subset's order, so the result does not depend on the thread count or the chunking.
  • The recalibration model is resolved once per spectrum (MzRecalibration_::at(rt)), the per-peak arithmetic unchanged bit for bit; the reversed noise sequences of the ion priors are built with AASequence::fromResidues() instead of a ResidueDB lookup under a critical section per residue.
  • The FDR:PSM filter runs spectrum by spectrum in parallel, so the removed hits are destroyed on the worker threads (one thread destroyed them before, about 1 s per run).
  • When the thread count reaches the logical CPUs the reader borrows threads from the budget (its loan counted) and the release helpers run inline; the idXML consumer keeps a helper thread of its own. The collapse at 128 threads on 64 cores was OpenMP spin-waiting under oversubscription.

Every round was profiled (phase timers, /proc sampling, gdb stack samples), timed under the 28 Oct protocol and reviewed by Codex, Kimi, Vibe and a Claude fact-checker; the PSM counts are the same in every execution (65,323 on the DDA set, 1,144,594 on HeLa, 299,969 on Astral) and the idXML files identical apart from dates (20 DDA files at 64 and at 1 thread, 27 HeLa files, per round; also at 128 threads).

Timing (wall, peak RSS; the baseline is the stack without these rounds)

set before after
27 HeLa diaPASEF runs, 64 threads (ibminode06, 64 cores) 193.4 s, 39.2 GiB 176.9 s, 38.8 GiB
27 HeLa runs, 128 threads 173.0 s, 51.6 GiB 170.6 s, 51.4 GiB
20 DDA runs, 64 threads (sum of the seven groups) 9.75 s 9.11 s
20 DDA runs, 128 threads 19.1 s 14.8 s
20 DDA runs, 16 threads 16.2 s 15.9 s
20 DDA runs, 1 thread 141.0 s 137.9 s
6 Astral runs, 64 threads (dax) 22.9 s, 13.9 GiB 21.4 s, 14.5 GiB

Repeats differ by up to 0.5 % (A/A: 9.16 vs 9.11 s, 177.5 vs 176.9 s). What remains: Percolator's serial steps per file (about 20 % of the HeLa wall), the memory-latency-bound bucket walk of FragmentIndex::queryPeaks (half of the busy time), the mzML reader on the SMT siblings, glibc's arena lock in the parallel frees.

CI

The pull-request trigger of build-and-test covers only PRs against develop, so it was dispatched by hand on this branch: https://github.com/OpenMS/OpenMS/actions/runs/41604258304, green on all six jobs (Linux g++ and clang++, Linux arm, Windows cl.exe, macOS, header check). After the develop merge of #10805's branch (5 Nov) this branch got it merged as 1819b50 (no conflicts, diff unchanged): https://github.com/OpenMS/OpenMS/actions/runs/41994070841, green on all six jobs.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features
    • ProSE now supports mass-to-charge recalibration during searches, correcting precursor and fragment measurements across retention-time segments.
    • Search results retain observed precursor and fragment m/z values, while calibration settings and error summaries are included in output.
    • Offset recalibration is enabled by default in the ProSE tool and can be disabled.
  • Documentation
    • Updated ProSE documentation to describe recalibration, its settings, and the reported measurements.

okohlbacher and others added 30 commits October 24, 2026 22:09
…networks, warm starts, cross-fitting

The experimental MLP learner of PercolatorReset (learner "mlp") is rewritten for speed and fixed for power:
- float32 mini-batch forward/backward passes as small Eigen matrix products (8.7x per epoch); every network of every
  cross-validation task (fold, C pair) and of the final model is one parallel job (one thread per network: results do
  not depend on the number of threads); scoring in blocks.
- Options::mlp_warm_epochs (default 3): the networks continue from the previous round for this many epochs instead of
  30 fresh epochs per round; a stem keeps its fold over the rounds (hash of salt and sequence).
- Options::mlp_crossfit (default true): every stem is scored by the fold ensemble that did not train on it, no final
  fit. Without it the final ensemble memorizes its training decoys (at the 1 % threshold 28 training vs 53 estimating
  decoys on a HeLa run; SVM 59 vs 54), the positive sets are selected against those and lose power (HeLa -5 %, one run
  collapsed to 0 peptides).
- Options::mlp_norm_min_decoys (default 1000): the fold ensembles' scores are normalized as Percolator's folds (the
  score at train_fdr against the fold's training decoys -> 0, their median -> -1; training-decoy labels only) if every
  fold has at least this many training decoys.
- A round after the first with fewer than 3 positive stems now stops the training and keeps the previous round's
  model (it threw before; also for the SVM, whose results are otherwise unchanged).
Tests: thread independence, masking (cross-fitted and not), decoy symmetry of the cross-fitted ranking, MLP FDR
simulation, option checks.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…earner

reset:mlp_members, mlp_hidden, mlp_epochs, mlp_warm_epochs, mlp_crossfit, mlp_norm_min_decoys (Percolator and ProSE,
forwarded by ProSE with rescore_method reset). With learner mlp the run records RESET:learner_settings and the log
names the settings. Defaults (learner svm, rescore_method percolator) are unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ked buffer size, refresh raises its errors)

- buildFeatureMatrix: the values of a hit that is not a row are only checked (no per-thread scratch
  row); the per-thread buffer of the PIN columns is checked against max_size().
- refreshPinMetaValues raises the first error by spectrum (an error stops its spectrum, as stamping)
  instead of skipping hits; in rescorePSMs the matrix has computed the same numbers before.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
(cherry picked from commit eb41d20ecb324cd1bddd5e827bb30e23a53ca6f3)
…ng in parallel on top of the in-process feature matrix

Conflict resolution (keeps nopin's design, as the int12 brief requires):
- Percolator::rescorePSMs: nopin's buildPSMRescoreInput (dense feature matrix straight from the hits, no PIN
  meta values) replaces the stamping + row read-back that rowsscale had parallelised (rows put in order, file
  identifiers in the row loop, stamped-value cleanup by CSR index). These rowsscale parts (B, D, M, N and the
  related review fixes) apply to code that no longer runs on the default path and are dropped; so is the parallel
  release of the per-row feature vectors after rescore(): ri.features is empty with the dense matrix.
- PercolatorInfile.{h,cpp} and PercolatorInfile_test.cpp: nopin's versions. PinFeatureMetaValueMap stays the int11
  map (public stamping API used by -out_pin/store), so rowsscale's CSR layout (4afc024, 7a57a9c and its review
  fixes) is not taken.
- Kept from rowsscale: pool reserveRows in rescore(), normalizer sums/finiteness by feature, taskloops of the initial
  direction moves / folds / q-values / post-processing incl. the 64-task cap (patch 14-rowsscale-postprocessing), and
  capturePreFdrStats_ in parallel (ProSEAlgorithm.cpp).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…threads, parallel partitioning, TRON workspaces

Conflict resolution:
- Scores.cpp: both constant blocks kept (rowsscale's kMinPairTaskSize/kMaxLoopTasks/loopGrain, cvscale's kLargeSet).
- Vendored patch numbers: cvscale's 14-cv-tron-workspace-hold collided with 14-rowsscale-postprocessing; renamed to
  19-cv-tron-workspace-hold (15-18 are taken by cvalgo/newton/reset/reuse). UPSTREAM.md lists both descriptions in
  application order (13, 14, 19).
- Patches 13, 14 and 19 regenerated in application order (each = the diff of the vendored upstream files between
  consecutive states, built with git apply --3way from int10; exec/perf/int12/scripts/regen_chain.sh): 13 and 14 were
  both generated against int10 and overlap in Scores.cpp. The chain check (reverse 19..02 = int10's reversed tree,
  forward again = this tree, upstream-whitelisted files) passes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…|lda (default tron)

Conflict resolution:
- CrossValidation::trainFoldChains team size: cvscale chose all threads for TRON from kLargeTrainingSet (2^18) PSMs on
  (numChainTeamThreads), newton all threads for Newton/LDA from kSolverAllThreadsPsms (2^17) on. Both kept: Newton/LDA
  from 2^17 as in newton, otherwise numChainTeamThreads as in cvscale (the default TRON path is cvscale's exactly; the
  team size does not change a result).
- Patches 13, 14, 16, 19 regenerated in application order (int12/scripts/regen_chain.sh); chain check passes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…/iterations/tron_epsilon/warm_start/single_cneg

Conflict resolution (newton and cvalgo both extend the Percolator training options):
- ProSEAlgorithm: cvalgo's PercolatorTraining struct carries the solver as well (new member `solver`, from
  'rescore_solver'); rescoreWithPercolator_ takes the struct only (newton's separate `solver` argument and the
  rescore_solver_ member are folded into it). Parameters unchanged: rescore_solver (newton) and rescoring:* (cvalgo).
- Percolator::train/rescore: setSolver and setTrainingOptions both called.
- CrossValidation::trainCpCnPair: the start weights are the pair's previous weights for Newton/LDA (newton) or for TRON
  with warm_start and no nested CV (cvalgo); 0 otherwise (default TRON: unchanged). With both options set, tron_epsilon
  is the tolerance of the last step (Newton's earlier steps keep 1e-4), as pOptions.epsilon is shared.
- UPSTREAM.md: both descriptions; patches 13-16, 19 regenerated in application order; chain check passes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…o int12: -Search:rescore_method reset

Conflict resolution:
- Percolator parameters/members: newton's 'solver' and RESET's 'algorithm'/'reset:*' both kept.
- ProSEAlgorithm: rescoreWithPercolator_ takes both the training options (PercolatorTraining, incl. the solver) and
  RESET's extra Percolator parameters (Param); parameters rescore_solver, rescoring:*, rescore_method, reset:* all kept;
  the run's search parameters record Percolator:solver (non-default) and the RESET values.
- RESET on nopin's dense rows: Percolator::rescoreReset_ moves RescoreInput::feature_matrix into the new
  PercolatorReset::Input::feature_matrix (no per-row copy: the reset branch read the int10 per-row vectors, which
  buildPSMRescoreInput no longer fills); PercolatorReset::run reads every row through Input::row() (rowCount()/row()
  as RescoreInput), the row-vector layout still works (tests, library callers); malformed dense input is rejected.
  New test: dense and row layouts give identical RESET output (SVM and MLP) and the dense checks.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…|joint|static|own (default per_file)

Conflict resolution (reuse was written against int10's stamping rescorePSMs):
- Percolator: nopin's const buildPSMRescoreInput (dense feature matrix, no stamping) and rescorePSMs are kept; reuse's
  stamping implementation (PinMetaValueCleanup, buildRowsOfStampedHits, non-const buildPSMRescoreInput) is not taken.
  reuse's scorer API is added on top: rescorePSMs(..., score_type, const PSMScorer& scorer, bool best_hit_only = false);
  the conv/nopin signature rescorePSMs(..., score_type, best_hit_only) calls it with an empty scorer. A scorer replaces
  rescore() (and RESET); its row count is checked against ri.rowCount() (taken before RESET moves the matrix).
  Percolator::score() keeps reuse's no-terminate shift and parallel region (auto-merged).
- ProSE rescore_reuse code reads nopin's dense rows: training rows appended to dense RescoreInput matrices,
  calibration decoys and the shift sample copied per row, the shift check and the cross-fitted scores read ri.row(r)
  (reuseRawScore takes a row pointer).
- ProSE parameters: reuse's rescoringPercolatorParameters() now also applies the training options (rescoring:*,
  rescore_solver) and the RESET parameters; rescoreWithPercolator_ takes (training, extra, reuse). The reused models
  are Percolator models trained with the training options; with rescore_method 'reset' a reuse mode other than
  per_file is ignored with a warning (every file is rescored by RESET). Best-hit-only write-back (conv) also with a
  reuse scorer.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…record

The merge of the RESET and rescore_reuse records in rescoreWithPercolator_ lost the brace that closes the RESET
block (6a31f0b did not compile).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…rom the whole run

The training draw of rescore_reuse (a seeded hash-uniform value per spectrum) is ProSEAlgorithm::reuseTrainingDraw()
(same expression as before, so the same spectra). New test: at several sampling fractions and two seeds the drawn
spectra are spread over the whole run (each tenth of it about its share, the sample reaches its end), seeded and
reproducible, other seeds/files draw other spectra, calibration spectra are never drawn (user rule on capped
training, REPL_BRIEF.md).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…m from all rows

New PercolatorSampler_test (links OpenMS_Percolator): sampleTrainingRowIndices (Percolator subset_max_train, ProSE
rescoring:subset_max_train) keeps about max_train rows spread over the whole input (each tenth of the rows about a
tenth of the sample, up to its end: not a prefix), the PSMs of a spectrum together, seeded and reproducible; no cap
keeps all rows.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… (review round 1, Codex MAJOR)

The newton merge left trainSvm() zeroing the weights before every TRON solve, so the start weights that cvalgo's
warm_start puts into trainCpCnPair were discarded (warm and cold runs identical). Now only the Newton/LDA fallback
to TRON starts from 0; with the TRON solver the weights are used as given (0 unless warm_start: the default training
is unchanged). Patches 16 and 19 regenerated (the fix belongs to the solver dispatch of patch 16); chain check OK.
New Percolator_test section (failing before the fix: warm == cold at a loose tolerance): warm starts change the
result at tron_epsilon 0.3, repeat runs are identical, the default is cold.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ration and training draws disjoint

- Percolator: the scorer entry point is rescorePSMsWithScorer() (Codex r1 MINOR: as an overload of rescorePSMs(), a
  function pointer passed as scorer converted to the bool best_hit_only of the other overload and was ignored).
- ProSE rescore_reuse: the calibration draw is ProSEAlgorithm::reuseCalibrationDraw() (same expression as before);
  the spread test now checks that calibration and training draws are disjoint at every fraction, cover every
  spectrum at fractions 1, and that the calibration spectra (~5 %) are spread over the run (coordinator request).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…out (review round 2, Kimi MINOR 1)

Comment and docstring only (no code change; bundle int12-c2 stays representative).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…_fold)

With subset_max_train capping the training set, the in-sample mode (upstream
--subset-max-train, still the default of the Percolator class) runs the
cross-validation on the sample and scores every row with the average of the
three fold models, so a sampled row is scored by two models that trained on it.

subset_mode out_of_fold: every spectrum (spectrum file, scan: Percolator's own
fold key) is assigned to one of the three folds first and a seeded random
sample of whole spectra (at most subset_max_train rows) is drawn from the
entire input (InProcessSampler: drawOutOfFoldSample, a hash of seed and
spectrum: independent of row order and threads). The cross-validation keeps
these folds (patch 20-cv-fixed-folds: CrossValidation::setFixedFolds ->
Scores::createXvalSetsBySpectrum), so each fold's model trains only on the
sampled spectra of the other folds (positive selection, Cpos/Cneg choice and
initial direction inside that training set). Every row, sampled or not, is
scored by its own fold's model only, and the folds are merged as the
cross-validation merges its test folds (per-fold q-values and rescaling), then
TDC, q-values and PEPs as before. The cap is global (one sample, as upstream).
A sample without targets or decoys in some fold falls back to training on all
rows. Without a cap, or in_sample, nothing changes.

getSvmWeights() returns the three fold models after such a rescore;
getCappedTrainingInfo() records folds, sample and the training rows of each
fold model. Tests: no row scored by a model that trained on it (and every row
by its fold's model), whole-spectrum sample spread over the whole input,
determinism by seed and thread count, fallback, in_sample unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
With rescoring:subset_max_train > 0, Percolator trains out-of-fold on the
capped sample by default (every PSM scored by the fold model that never saw
its spectrum); in_sample keeps the percolator executable's scheme. Recorded as
Percolator:subset_mode in the search parameters only when a cap is set, so the
default output (no cap) is unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
-out_pin passed the enzyme's name (e.g. Trypsin/P, or the default Trypsin)
to PercolatorInfile::store(), which knows only lower-case Percolator names
and treats any other name as "every site is enzymatic". Every row therefore
had enzN = enzC = 1 and enzInt = peptide length - 1. It now passes the name
Percolator knows, as the rescoring does: the helper that maps the names
(an anonymous function next to ProSEAlgorithm::rescoreWithPercolator()) is
now the public static ProSEAlgorithm::pinEnzymeName(), used by both.

The new TOPP test fails without the fix (enzInt 13/27/22 instead of 0/1/1).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…odel (review round 1); mode out_of_fold_avg

Review round 1 (Codex capfix-r1 BLOCKER/MAJOR, Kimi capfix-r1 MAJOR/MINOR):
- Sanity check: Percolator's validateDirection counts the targets of all test
  folds (the held-out folds) and resets all models at once. Out-of-fold, each
  fold's model is checked against its default direction on its own training
  set and replaced alone (RecordingSanityCheck::validateFolds_).
- The fold models are taken as checked, before CrossValidation's merge
  rescales them by their test sets (held-out labels).
- Cneg candidates: each fold's from its own training set's target/decoy ratio
  (the sample's ratio counts the held-out labels); mergeCpCnPairs' nested
  path looks them up per fold (patch 20).
- Nested cross-validation: each fold draws its nested sets from a generator
  state of its own per step; the shared stream let other folds' draws (whose
  training sets hold this fold's PSMs) change a fold's nested sets (patch 20).
- The scorers are merged at train_fdr (the CV's selection FDR), as the CV
  merges its test folds; the scoring loop honours num_threads.
- Warning without scan numbers (every row its own spectrum); sampler
  documented as a random-priority prefix within a row budget.
- ProSE records Percolator:subset_mode only for the out-of-fold modes, so
  in_sample with a cap stays byte-identical to before.

New subset_mode out_of_fold_avg (coordinator): sampled rows by their fold's
model only; rows of unsampled spectra, which no model has seen, by the average
of the fold models (as in_sample scores them). Every row is scored
out-of-sample, and the targets and decoys of a spectrum share their scorer (a
spectrum is sampled or not as a whole). The four scorers are merged as the
folds (rescaled per scorer).

Tests: relabelling targets of fold-0 spectra as decoys leaves fold 0's model
unchanged (sampled spectra; the other models change) and every model unchanged
(unsampled spectra), with default, nested_xval_bins 3, warm starts, Newton and
LDA (failed before the Cneg and nested-seed fixes); out_of_fold_avg scorers per
row, per spectrum, unseen by their scorer, scores affine in their scorer;
fallback with a two-spectrum sample.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…minus is an enzymatic site)

The PIN columns enzN/enzC compare the flanking residues of the first evidence with the
enzyme's rule. OpenMS marks a protein terminus as '[' / ']'; Percolator writes '-' and
counts it as an enzymatic site, but the mapping to '-' happened after the features: a
peptide at a protein N-terminus got enzN = 0, one at a C-terminus not after a cleavage
residue enzC = 0 (stamping, the in-process feature matrix and .pin files alike).

The fix of 97dd260f48 (claude/percolatorinfile-terminus-enzyme-b-5edf-20261022), ported to
pinHitColumns_ and kept behind a switch because it changes the default output: an enzyme
name with the suffix "+termini" (e.g. "trypsinp+termini") maps the terminus marks first.
Without the suffix the features are unchanged.

Test (failing first: all six checks of the new section fail with the modifier ignored,
oracle/build/failfirst.out): SAMPLE at both termini, at the N- or C-terminus only, and at
neither, stamped and in the feature matrix, with and without the modifier.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… spectrum as positive candidate

With train_best_positive (ProSE's rescoring, PercolatorAdapter -train_best_positive),
Percolator's Scores::generatePositiveTrainingSet sorts the training set by spectrum and
label with an unstable sort and keeps the first PSM of each group: not the best-scoring
one in general. With 10 hits per spectrum most kept targets are weaker hits above the
training FDR, and most positives are missing in the first iterations (Velos file of the
20-file benchmark, fold positives in iteration 1: percolator executable 296/373/438, this
tree 130/153/162, best-scoring PSMs 642/734/867; exec/perf/oracle.md).

New Percolator parameter best_positive: 'first' (default, Percolator's choice, unchanged
results) or 'score' (CrossValidation::setBestPositiveByScore: stable sorts by score and then
by spectrum and label; generateTrainingSetsOfSortedSet keeps the first PSM of each group of
a set sorted by score). Vendored change as patches/20-best-positive-by-score.patch
(UPSTREAM.md); chain check OK.

Test PercolatorBestPositive_test (failing first with the option ignored: line 122, both
paths): 40 spectra x 10 target hits, both the fallback and the sorted-set path keep one
positive per spectrum, the best-scoring one with 'score'.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…yme_termini (default off)

Search:rescoring:best_positive first|score (Percolator best_positive), rescoring:use_pi0
true|false (Percolator use_pi0; the percolator executable with -Y uses pi0 = 1) and
rescoring:fixed_enzyme_termini false|true (enzyme name with PercolatorInfile's "+termini",
for the rescoring and -out_pin). Defaults keep the output byte-identical.

Effect on the 20-file benchmark (5 Percolator seeds, driver on ProSE's own feature matrix,
exec/perf/oracle.md): best_positive score +1.22 % PSMs, doubled-DB FDP 1.099 -> 1.039 %;
with use_pi0 false +1.03 %, 1.015 %.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…after a per-fold reset, small remainder, no-OpenMP build)

- Codex r2 MAJOR: when the per-fold sanity check replaces a fold's model, its
  test set is scored with the replacement before the CV merge, which rescales
  each model by its test set before getAvgWeights averages them (the average
  scorer of out_of_fold_avg). The saved fold models do not depend on it.
- Codex r2 MINOR: out_of_fold_avg uses the average scorer only if the unsampled
  rows hold at least 100 targets and 100 decoys (its rescaling at train_fdr),
  else they stay with their folds' models.
- No-OpenMP gate (clang -fopenmp-simd parses num_threads()): score_threads is
  declared without OpenMP too.
- Docs: sampler inclusion probability (Codex NIT), per-fold sanity comment
  (Kimi NIT-2); test: relabelling unsampled spectra changes none of the four
  out_of_fold_avg models (Kimi NIT-4).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ning_curve)

User request: choose the training size by a learning curve. Spectra get their
folds as in out_of_fold; validation spectra (the end of the random order, at
most subset_curve_validation = 250,000 rows and 20 % of the rows) are set aside
and never trained on. Nested whole-spectrum samples of subset_curve_start
(100,000), twice, four times ... as many rows, up to subset_max_train (if > 0,
else subset_curve_max = 4,000,000; or all rows but the validation spectra), are
each trained out-of-fold (all isolation fixes). Fold k's measure: targets at
q <= train_fdr ((decoys + 1) / targets) among the validation spectra of the
OTHER folds under fold k's model, so no fold-k label decides fold k's size or
model. Fold k stops at the first doubling that adds less than
subset_curve_min_gain (0.2 %) and keeps that model. Every row is scored by its
fold's chosen model, merged as out_of_fold. ProSE: rescoring:subset_mode
learning_curve, rescoring:curve_start, rescoring:curve_min_gain; the curve is
recorded as Percolator:subset_curve. Default output unchanged.

Refactor: rescore()'s training block is a local function (train_rows), called
once as before or once per curve size.

Tests: stop rule (first size below the threshold; later sizes not evaluated
for a stopped fold; a threshold of 10 stops all folds at the second size),
determinism by seed and threads, relabelling targets of fold-0 spectra
anywhere (samples, validation) leaves fold 0's curve, size and model
unchanged while the other folds' curves change; sampler: validation spectra
fixed across caps, disjoint from and nested samples, whole spectra.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ess (Linux)

When a process ends, the kernel releases its address space before the waiting parent is told:
for a search that leaves 0.5-1 GB of (mostly free malloc) memory this is 40-80 ms after the last
output, on one core (astral_B1 t16: 67 ms of 2.38 s; hfx_B1 t64: 50 ms of 1.13 s). After the tool
has returned its exit code, main() starts a helper process that shares the address space
(CLONE_VM, no SIGCHLD to this process, untraced) and blocks on a pipe whose write end only this
process holds. The process then ends exactly as before (destructors, stdio flush, exit code);
since the kernel drops the address space of an ending process before closing its files, the
helper sees the end of the pipe when this process no longer uses the memory, ends, and the memory
is released with it, after the parent of ProSE has seen the exit.

The helper uses raw system calls only (it shares the memory but not the thread state, e.g. errno),
blocks all signals and closes every inherited file (close_range, or close in a loop) so that no
reader of the output waits for it. Not used: other systems and architectures than Linux
x86_64/aarch64, sanitizer builds, Valgrind (LD_PRELOAD vgpreload; it does not run such
processes); if pipe() or clone() fail, the process ends as before.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…view findings

The helper process of 5a5274c131 is a change of behaviour that the user decides on: it now runs
only with the environment variable OPENMS_FAST_EXIT=1 (default off), documented in the tool page
with the reasons (a sandbox that forbids creating processes, an init process that does not reap
adopted children, a job system that waits for all processes of a job).

Codex review round 1:
- 9: both pipes are created with O_CLOEXEC, so no program started later holds the write end;
- 10: all signals are blocked by the parent around clone() (restored afterwards), so the helper
  never runs a signal handler of the tool; the raw rt_sigprocmask (and its x32 size issue) is gone,
  x32 (__ILP32__) is excluded;
- 8: the helper closes its copy of the write end explicitly and ends at once (leaving the memory
  to the tool, as before) if close_range is not available, instead of a bounded close loop;
- 11: the tool waits (at most 0.1 s) until the helper holds no file of the tool but the pipe
  (end of file on a second pipe), so a reader of the output sees its end with the tool's;
- 13: not used under a debugger or tracer (TracerPid), nor in Clang sanitizer builds
  (__has_feature).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…patch 21)

The initial direction of every fold sorts the PSMs by each of the 30 features and counts the positives in both
directions. Each count took a new snapshot of the n sorted keys, a new vector of n (score, label) pairs and a
q-value vector that grew by doubling (about 7 blocks of up to 8n bytes per count). On HeLa 25pc_50_25 (2.3 M
PSMs, 64 threads) these were ~16 GB of fresh blocks in 2.2 s, 2.1 M page faults (mcount/gdb, exec/perf/memalloc.md).

The counts now take their buffers from lists of the call and put them back when done (released at the end of the
call), and countPositivesOfPairs reserves the q-values at once. The counts and so the direction are unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…writable at once)

glibc grows the heap of a thread's arena by the pages an allocation lacks, one mprotect() at a time, and each
mprotect() holds the address-space lock for writing, which stalls the page faults of all other threads. The
preprocessing of the spectra keeps several GB of peak lists allocated in small blocks by all threads: on HeLa
25pc_50_25 at 64 threads 1.2 million mprotect() calls, 76 % system time, the phase slower at 64 than at 16 threads.
With M_TOP_PAD = 64 MiB a new heap is made writable in one call when glibc creates it (new_heap adds the pad).

Indicative (ibminode05, = ibminode06 hardware; the same setting as GLIBC_TUNABLES=glibc.malloc.top_pad=67108864):
HeLa 25pc_50_25 t64 preprocessing 2.65 -> 0.69 s, whole run 29.56 -> 27.84 s, peak RSS 15.43 -> 15.17 GiB;
astral_B1 t64 1.43 -> 1.36 s, hfx_B1 t16 1.23 -> 1.15 s. Not applied if GLIBC_TUNABLES sets glibc.malloc.*
or with OPENMS_MALLOC_DEFAULTS=0. Output unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…arge ones

The BT4 matrices of the TRON solves (X and the two active-row buffers of a workspace) take hundreds of MB on a
large data set (HeLa 25pc_50_25: 1.5 M training rows x 32 columns per fold), are zero-filled when a workspace grows,
written once per solve and read in every iteration. On HeLa at 64 threads the CV training took 3.0 M page faults;
with glibc.malloc.hugetlb=1 (huge pages for all large blocks) 0.49 M and the training 10.44 -> 9.32 s (ibminode05,
indicative). AlignedDoubles now allocates without writing, advises MADV_HUGEPAGE for the 2 MiB pages inside the
block (Linux; a hint, followed in the kernel's "always" and "madvise" THP modes), then zero-fills as before.
Values unchanged; Percolator_test and PercolatorTron_test pass.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
okohlbacher and others added 7 commits November 5, 2026 06:01
It showed no gain (-7 % PSMs on PXD000001) and targets the precursors that isotope_error_min -2, the tool's default,
already covers in the search. Feature-based correction stays available upstream (HighResPrecursorMassCorrector before
ProSE). Removes the parameter, correctPrecursors_(), the survey-scan handling for it, the Biosaur2 and
PrecursorCorrection includes and TOPP_ProSE_mono_correction; the index restriction and the survey-scan reading are as
on develop again.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… floor for high-resolution MS2

- A single-use index restricted to the spectra stays restricted with calibration: it holds the peptides of the
  calibration pass's precursor windows, the widest searched (the calibrated windows never exceed the configured ones).
  Output unchanged; on a single Astral run 4.5 of 6.1 million peptides are indexed.
- The pass searches a Da window with twice the configured tolerance, up to 0.5 Da (was 0.5 Da always), and the Da
  fragment floor is 0.02 Da (was 0.2 Da, above any high-resolution Da setting, so Da windows never tightened).
  Ion-trap windows (0.25 Da or more) keep the 0.5 Da pass, and their measured |offset| + 4 sigma (about 0.37 Da) is
  above either floor.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ion; Da-mode windows) into claude/prose-mz-recalibration-20261103

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

# Conflicts:
#	src/openms/include/OpenMS/ANALYSIS/ID/ProSEAlgorithm.h
#	src/openms/source/ANALYSIS/ID/ProSEAlgorithm.cpp
#	src/tests/class_tests/openms/source/ProSEAlgorithm_test.cpp
#	src/topp/ProSE.cpp
…ion; Da-mode windows) into claude/prose-speed-rounds-20261103

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…-mz-recalibration-20261103

#10804 was squash-merged, so this branch's history and develop carried the same
change twice and every file both touched conflicted. Resolution: this branch's
version of ProSEAlgorithm.h/.cpp and ProSEAlgorithm_test.cpp (develop changed them
only through the squash); develop's version of src/tests/topp/CMakeLists.txt and
ProSE.cpp (changed by other merges as well) with this PR's own diff applied on top.
The diff against develop is the PR's diff as before, hunk headers aside.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
…e squash of #10804) into claude/prose-speed-rounds-20261103

No conflicts; the diff against #10805's branch is this PR's diff as before.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
okohlbacher added a commit that referenced this pull request Nov 5, 2026
…uash of #10804) into claude/prose-omp-global-count-20261104

No conflicts; the diff against #10806's branch is this PR's diff as before.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
…e observed m/z

Review follow-ups of #10805:
- Fragment annotations: with calibration:recalibrate, postProcessHits_() and
  annotateFragmentPeaks_() read the peaks that applyRecalibration_() corrected
  in place. They now undo the fragment model (MzRecalibration_::uncorrect(),
  exact for offset, to 1e-13 Da for a line), so a PSM's precursor m/z and its
  annotations are both as observed, and the run summary's tolerance estimate
  has observed errors on both sides (the residuals stay in the
  calibration:*_residual_* records). The model is passed in explicitly,
  because the multi-file path keeps one calibration result per file.
- Co-isolated precursors of a chimeric search come from the same survey scans
  as the selected one: applyRecalibration_() now corrects their m/z
  (CoIsolationDetector::META_MZ) by the precursor model too and keeps the
  observed ones (observed_coisolated_mz), which their PSMs report. Their
  precursor-error feature is then a residual like that of chimeric_rank 1.
- Tool page: drop the leftover sentence that called recalibrate "off"; state
  the linear and none modes, the 5 ppm / 0.01 Da floor with the correction,
  and that the reported errors are of the observed m/z.
- search(PeakMap&) docs: the spectra come back with corrected m/z.
- Tests: uncorrect() round trips; annotations match the observed peaks and
  the PSM m/z equals the observed one (exact checks, where TEST_REAL_SIMILAR's
  1e-5 ratio would pass a 5-7 ppm shift); applyRecalibration_() on co-isolated
  precursors; TOPP_ProSE_4_recalibrate runs the tool's default end to end.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_0149aXmbmJRoyZgSEgVjDKbn
…onditionally

The fixture yields a PSM for each of its 12 spectra, enough for the
tolerance estimate (10): assert at least 10 PSMs and both estimates, instead
of skipping the median checks without them (CodeRabbit nitpick on #10805).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_0149aXmbmJRoyZgSEgVjDKbn
The fixture yields fewer than the 10 PSMs the run summary's tolerance
estimate needs (cd470f2 failed there on Linux arm). Collect the statistics of
the PSMs repeated ten times instead: the medians are the same, and the check
of the observed errors on both sides no longer depends on the fixture's yield.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_0149aXmbmJRoyZgSEgVjDKbn
…rsors) into the speed rounds

Conflicts in MzRecalibration_ and applyRecalibration_(): kept both sides,
uncorrect() next to AtRT/at(), and the co-isolated precursor keys next to
the per-spectrum AtRT model for the fragment peaks.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_0149aXmY7heshmULGihPVydG
Base automatically changed from claude/prose-mz-recalibration-20261103 to develop November 6, 2026 11:17

timosachsenberg commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Verdict: ready to merge. #10805 is in develop now. [Edit: updated after merging develop and going through the earlier review again; CI on the merged head is green.]


Generated by Claude Code

@coderabbitai

coderabbitai Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

ProSE adds optional offset and linear recalibration for precursor and fragment m/z values. It fits retention-time-dependent models during calibration, applies them across search paths, preserves observed m/z values in results, and records model and error data. The change also updates hit filtering and helper-thread accounting.

Changes: Mass recalibration

Layer / File(s) Summary
Calibration options and contracts
src/openms/include/OpenMS/ANALYSIS/ID/ProSEAlgorithm.h, src/openms/source/ANALYSIS/ID/ProSEAlgorithm.cpp, src/topp/ProSE.cpp, src/tests/topp/CMakeLists.txt
Adds none, offset, and linear recalibration settings, RT chunk configuration, model state, and run-statistics fields. The tool defaults to offset recalibration across 10 chunks. Documentation describes correction and observed-m/z reporting.
Fit calibration models
src/openms/source/ANALYSIS/ID/ProSEAlgorithm.cpp, src/tests/class_tests/openms/source/ProSEAlgorithm_test.cpp
The calibration pass collects precursor and fragment errors and fits RT-dependent offset or linear models. It estimates tolerances from residual errors and adds model fitting and scoring tests.
Apply models and report observed m/z
src/openms/source/ANALYSIS/ID/ProSEAlgorithm.cpp, src/openms/include/OpenMS/ANALYSIS/ID/ProSEAlgorithm.h, src/tests/class_tests/openms/source/ProSEAlgorithm_test.cpp, src/tests/topp/CMakeLists.txt, src/topp/ProSE.cpp
Single-file, chunked, and multi-file search paths apply successful models to spectra and retained peak lists. PSMs and fragment annotations retain observed m/z values, and model and error data are recorded in search parameters, run statistics, and YAML output.

Parallel search execution

Layer / File(s) Summary
Coordinate parallel work and thread loans
src/openms/source/ANALYSIS/ID/ProSEAlgorithm.cpp
Large hit lists use parallel score filtering. Reader and consumer thread accounting changes helper-thread selection, and asynchronous release is limited when helper teams could oversubscribe logical CPUs.

Sequence Diagram(s)

sequenceDiagram
  participant CalibrationPass
  participant CalibrationResult
  participant MzRecalibration
  participant Spectra
  participant SearchOutput
  CalibrationPass->>CalibrationResult: collect raw errors and residuals
  CalibrationPass->>MzRecalibration: fit RT-dependent models
  MzRecalibration->>Spectra: correct precursor and fragment m/z
  Spectra->>SearchOutput: search with corrected spectra
  MzRecalibration->>SearchOutput: restore observed m/z for annotations and record model metadata
Loading

Possibly related PRs

  • OpenMS/OpenMS#10805: Adds related precursor and fragment recalibration models and observed-m/z reporting.
  • OpenMS/OpenMS#10804: Establishes the calibration pass and tolerance estimates extended by this change.
  • OpenMS/OpenMS#10740: Adds ion-series scoring and deferred annotation used by this change’s calibration and annotation paths.

Suggested reviewers: timosachsenberg

Change: Feature

Merge Risk: Minimal · previous review 79e9d

This change adds optional m/z recalibration to ProSE and speeds up the calibration pass and hit filtering. No concrete merge-blocking risk was found in the supplied review. Normal CI and benchmark checks still apply.

Pre-merge checks: Passed 4 · Inconclusive 1

Failed Failed checks: 1 inconclusive

Check name Status Explanation Resolution
Docstring Coverage Inconclusive Docstring coverage is 70.59% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documenta… 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 describes performance changes in the pull request. It does not highlight that ProSE now enables offset recalibration by default, which can change output metadata.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 70.59% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 17 functions across 3 files. (2 skipped: 1 unsupported, 1 too large.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

Finishing Touches

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 mass in flight,
Then nudges peaks to make them right.
The run keeps what it first observed,
While models note each shift resolved.
I thump beside the search results bright.

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: d16a4e4b-db07-45c4-9889-3713a24e44b0
Commits

Reviewing files that changed from the base of the PR and between f27b961 and 79e9dde.

Files selected for processing: 5

  • src/openms/include/OpenMS/ANALYSIS/ID/ProSEAlgorithm.h
  • src/openms/source/ANALYSIS/ID/ProSEAlgorithm.cpp
  • src/tests/class_tests/openms/source/ProSEAlgorithm_test.cpp
  • src/tests/topp/CMakeLists.txt
  • src/topp/ProSE.cpp

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

ProSEAlgorithm.{h,cpp} on develop equal #10805's branch head, which this
branch already contains, so the conflicts resolve to this branch's version.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_0149aXmY7heshmULGihPVydG
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.

3 participants