Repository navigation
Native rescorer: Percolator's algorithm with target-decoy competition (calibrated q-values) - #220
Conversation
The 3-fold CV assigned folds by ScanNr. With ScanNr 0 on every row, all rows fell into one fold, that fold had no training data, and --rescore-native returned almost no PSMs without a warning. Rows are now folded and grouped by their spectrum: the SpecId without its scan, rank and row suffix.
…tition The native rescorer trained a GBDT on every target PSM as a positive and computed q-values over every PIN row. On UPS1 its entrapment FDP at q 0.01 was 15.6% (Percolator -Y on the same PIN: 2.4%). Two causes: - No target-decoy competition: every rank of a spectrum entered the q-value walk, and several rows of one scan and precursor mass could be accepted. - Training every target as a positive (half of them false) teaches the model what separates false targets from decoys, so false targets outscore decoys and the target-decoy estimate undercounts them. The rescorer now runs Percolator's algorithm in process: competition groups of ScanNr and ExpMass (as -Y), 3-fold CV by spectrum, an initial best single feature, then 10 rounds of an L2 logistic regression trained on target winners at q <= 0.01 against all decoy winners, per-fold score normalisation, q-values over the winners and PEP from an isotonic fit of the decoy share. ExpMass and CalcMass are not features, as in Percolator. The QPX join gets the winning decoys, so targets that lost competition are left out as with Percolator -Y.
…the QPX section Partial sums of the Newton step are taken over fixed row chunks and added in chunk order, so the scores do not depend on the thread count.
|
ⓘ Qodo reviews are paused because the subscription is no longer active. Ask your workspace admin to reactivate the subscription to resume reviews. Manage billing |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
--rescore-nativereported q-values that were far too optimistic. On UPS1, at q ≤ 0.01 its entrapment FDP was 15.6–16.9% where Percolator-Yon the same PIN gives 2.4%; at q ≤ 0.05 it was 31% (Percolator 5.9%). This PR replaces it with Percolator's algorithm run in process. On the same PINs it now matches Percolator's calibration on UPS1, Astral and phospho, with about the same number of PSMs.Root cause
There were two defects:
The Astral and phospho benchmarks did not show this because their entrapment sequences are shuffled and look like decoys to every feature. UPS1's entrapment is a natural proteome, so a model that prefers natural false targets to decoys is caught there. Real searches also have natural false targets.
I tested one variable at a time on UPS1, with a stand-in for the same pipeline:
-YA semi-supervised GBDT is also calibrated, but it finds 26% fewer PSMs. A semi-supervised linear model keeps Percolator-level PSMs on all three datasets, so that is the one in this PR.
Change
crates/andes/src/rescore.rsnow does the following:ScanNrandExpMasstext form one group, as with Percolator-Yand the QPX join. Each group reports its best row, target or decoy, and q-values come from these winners.1 − P(target)from a classifier trained on false targets.ExpMassandCalcMassare no longer features, as in Percolator.search.rspasses the winning decoys to the QPX join. Target rows that lost competition are left out of the bundle, as with Percolator-Y. The CLI help, DOCS and README describe the method.The review finding "
--rescoreruns Percolator without-Y" was already fixed on main by #210. Nothing changes there.Measured
Same PINs (origin/main search), entrapment FDP with
docs/benchmarks/entrap_common.pyand (1 + T/E) scaling (UPS1 2.351, Astral 0.964, phospho 0.971). Each cell lists PSMs and FDP for seeds 42 / 1 / 2.-Y-Y-YTests
New tests check:
ExpMass/CalcMassare not features;Gate
cargo clippy --workspace --all-targets -- -D warningsis clean.cargo test --release --workspace --locked: 1741 passed, 0 failed, 9 ignored.Summary by CodeRabbit
New Features
Documentation