Skip to content

[FEATURE] PIP-ECHO shape_features: score how a transfer's peak shape agrees with its precursor's identified features - #10637

Closed
timosachsenberg wants to merge 4 commits into
developfrom
claude/andes-mbr-shape-features
Closed

timosachsenberg wants to merge 4 commits into
developfrom
claude/andes-mbr-shape-features

Conversation

@timosachsenberg

@timosachsenberg timosachsenberg commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Requested by Timo · project thread

Description

Before: The transfer FDR model of PIP-ECHO scores a transfer by intensity, mass error, RT agreement, isotope envelope against the theoretical one and ion mobility. A transfer to the wrong peak of the right peptide often looks fine on all of these.

After: With PipEcho:shape_features true, three more features compare the transfer's peak with the identified features of the same precursor in the other runs (median, leaving out the acceptor's own run): the log ratio of the elution width on the aligned RT scale, the difference in tailing, and the cosine between the observed isotope envelopes. They describe the peak, not its size. A decoy transfer is compared with its donor's precursor; without a reference the features are 0, 0 and −1. Default false.

How: Whenever PIP-ECHO is on, ProteomicsLFQ snapshots two feature meta values at detection, pipecho_width and pipecho_tailing, so that -feat_dir checkpoints serve both settings. The width is the sigma of the elution fit, scaled by the local slope of the run's RT transformation before the RTs are transformed. The tailing comes from the integration boundaries around the apex. Without the option, both are dropped again at combine time. Impl::annotate_shape_features() fills new Score fields and TransferFDRModel adds them to the SVM predictors. Tests: a class test, and a TOPP test that detects without the option into -feat_dir and combines with it.

Andes paired these features with identity decoys (bigbio/andes#172) to estimate the share of false-donor transfers. Those are not ported here because ProteomicsLFQ does not quantify decoy peptides. The donor q gate (#10633) addresses false donors instead.

Benchmark

ProteoBench DDA quant ion module (QExactive HF-X, PXD028735, 3 + 3 runs, 2 h gradients), with the #10585 pipeline. Spectra are ProteoBench's msconvert mzML, as in #10585. Identification per run: Comet 2025.01 → PSMFeatureExtractor → Percolator 3.06 → q ≤ 0.10, PEP as the score. Then ProteomicsLFQ -targeted_only false -pip_echo true -psmFDR 0.01 -proteinFDR 0.01 -picked_proteinFDR true -protein_inference aggregation, then ConsensusMapNormalizer -algorithm_type rt_local and MSstatsConverter, scored with proteobench 0.18.6 (min 3 runs). The scorer reproduces the public quantms submission d01e87b9… exactly.

Arms differ only in -PipEcho:shape_features (and -PipEcho:fdr for the operating curve). All arms of one database share the same IDs and the same -feat_dir checkpoints.

Scripts, hashes and tables: benchmark-reproduction/andes-ports/pr10637 on claude/andes-benchmarks.

Option off = baseline. At transfer q 0.05 and 0.01:

  • the MSstats CSV and the rt_local CSV are byte-identical;
  • the consensusXML is identical up to process-random ids, timestamps and parameter lines.

The baseline at q 0.05 gives 46,401 precursors, median |eps| 0.2214, E. coli 0.4061, CV 0.2358; with rt_local 0.1572, 0.3359 and 0.0951. #10585 reported 46,375 / 0.2214 / 0.4090 / 0.2356, and 0.157 / 0.338 / 0.095 with rt_local.

ProteoBench, plain HYE database (raw / rt_local):

arm transfer q transfers precursors median |eps| E. coli |eps| CV
off (= baseline) 0.01 13,782 43,586 0.2205 / 0.1513 0.4051 / 0.3105 0.2327 / 0.0905
on 0.01 22,187 44,507 0.2193 / 0.1519 0.4009 / 0.3166 0.2334 / 0.0917
off 0.02 29,894 45,390 0.2199 / 0.1540 0.3986 / 0.3278 0.2344 / 0.0930
on 0.02 33,845 45,771 0.2199 / 0.1549 0.3960 / 0.3252 0.2347 / 0.0937
off 0.03 36,627 46,044 0.2205 / 0.1560 0.4009 / 0.3258 0.2351 / 0.0942
on 0.03 36,906 46,046 0.2205 / 0.1560 0.4009 / 0.3277 0.2351 / 0.0941
off (= baseline, default) 0.05 41,549 46,401 0.2214 / 0.1572 0.4061 / 0.3359 0.2358 / 0.0951
on 0.05 39,349 46,235 0.2211 / 0.1567 0.4088 / 0.3395 0.2354 / 0.0947

Transfer FDP, entrapment database:

transfer q arm transfers entrapment transfers FDP
0.01 off 11,340 21 0.37 %
0.01 on 17,769 31 0.35 %
0.05 off 27,123 48 0.35 %
0.05 on 26,506 46 0.35 %

The identified precursors alone have an FDP of 0.47 %. With the option on, the elution width was available for 75 % of the candidate transfers (36,925 of 49,545); tailing and isotope envelope were available for all of them. Combine time does not change.

andes (bigbio/andes#167 and bigbio/andes#172: a public 6-run LFQ DDA benchmark, accession not named; normalised quantity, MBR, min 3 runs):

transfer q precursors, before → with shape features median |eps| E. coli CV entrapment transfers
0.01 54,932 → 67,586 (+23 %) 0.155 → 0.164 0.212 → 0.302 0.110 → 0.120 48 → 728
0.05 67,035 → 73,203 (+9 %) 0.164 → 0.177 0.317 → 0.471 0.124 → 0.134 537 → 1,199

At matched depth, andes reports bigbio/andes#167 better or equal, e.g. median |eps| −0.0003 to −0.0012.

Verdict

  • Precursors at transfer q 0.01: not reproduced. The direction is the same but the gain is +2.1 % (43,586 → 44,507), not +23 %. Accepted transfers rise by 61 % (13,782 → 22,187), so the features do separate transfers better at a strict threshold. Most of the extra transfers fill runs of precursors that already have ≥ 3 runs, so they do not add ProteoBench precursors.
  • Precursors at q ≥ 0.03: not reproduced. There is no gain; at the default 0.05 the count drops by 166 (−0.4 %), where andes gained 9 %. The deepest point stays at about 46.4k.
  • Quantities at matched depth: partly reproduced.
    • At q 0.01 (44,507 precursors), against the interpolated off curve with rt_local: median |eps| 0.1519 vs 0.1527, E. coli 0.3166 vs 0.3193, CV 0.0917 vs 0.0918.
    • At q 0.02: 0.1549 vs 0.1552, 0.3252 vs 0.3266, CV equal. This is about the size andes reports.
    • At q 0.05, E. coli is worse: 0.3395 vs 0.3312.
    • At the same q 0.01, rt_local median |eps| (+0.0006), E. coli (+0.006) and CV (+0.0012) get slightly worse because there are more transfers. andes' changes at the same q go the same way but are ten times larger.
  • Transfer FDP: controlled, and andes' problem is not reproduced. Entrapment transfers grow in proportion to all transfers (21 → 31 at q 0.01, 48 → 46 at q 0.05), and the FDP stays at 0.35–0.37 %. In andes, entrapment transfers rose 15-fold (48 → 728 at q 0.01), which quant: identity decoys and a donor gate for the MBR transfer FDR bigbio/andes#172 then fixed with identity decoys and a donor gate. With -psmFDR 0.01 and a picked protein FDR of 0.01 there are few false donors (152 entrapment consensus features), and the features did not favour their transfers. Without the protein filter they do; see the combination with [FEATURE] ProteomicsLFQ PIP-ECHO: without a protein FDR, transfer only precursors confidently identified somewhere #10633 below.

Why the gain is smaller in OpenMS:

Combined with #10633 (donor gate). #10633 (merged) turns on PipEcho:donor_max_q 0.001 only with -proteinFDR 1. With -proteinFDR 0.01 the gate is off, so the arms above already are the combination. The 2 × 2 therefore runs at -proteinFDR 1:

Everything else is unchanged.

Transfer FDP, entrapment database, -proteinFDR 1:

transfer q gate shape features transfers entrapment transfers FDP
0.01 no off 11,558 124 2.15 %
0.01 no on 18,222 240 2.63 %
0.01 yes off 7,767 21 0.54 %
0.01 yes on 11,408 30 0.53 %
0.05 no off 28,160 481 3.42 %
0.05 no on 27,492 453 3.30 %
0.05 yes off 20,681 65 0.63 %
0.05 yes on 20,426 66 0.65 %

ProteoBench, plain HYE database, -proteinFDR 1 (raw / rt_local):

transfer q gate shape features precursors median |eps| E. coli |eps| CV
0.01 no off 44,167 0.2221 / 0.1527 0.4358 / 0.3368 0.2328 / 0.0906
0.01 no on 45,125 0.2211 / 0.1532 0.4397 / 0.3493 0.2336 / 0.0918
0.01 yes off 43,559 0.2227 / 0.1527 0.4410 / 0.3397 0.2327 / 0.0903
0.01 yes on 44,054 0.2211 / 0.1526 0.4410 / 0.3496 0.2330 / 0.0909
0.05 no off 47,119 0.2232 / 0.1588 0.4425 / 0.3798 0.2359 / 0.0953
0.05 no on 46,945 0.2228 / 0.1582 0.4439 / 0.3859 0.2355 / 0.0949
0.05 yes off 45,655 0.2218 / 0.1555 0.4288 / 0.3611 0.2351 / 0.0944
0.05 yes on 45,621 0.2217 / 0.1551 0.4249 / 0.3600 0.2351 / 0.0942
  • Without gate and protein filter, the shape features favour false-donor transfers. At q 0.01, entrapment transfers almost double (124 → 240) while target transfers rise by 57 % (11,434 → 17,982), and the FDP goes from 2.15 % to 2.63 %. This is andes' effect (48 → 728), but much smaller. At q 0.05 nothing changes.
  • With the gate (ProteomicsLFQ's automatic behaviour at -proteinFDR 1), the FDP stays controlled. It is 0.54 % → 0.53 % at q 0.01 and 0.63 % → 0.65 % at q 0.05, while target transfers at q 0.01 rise by 47 % (7,746 → 11,378). This reproduces andes' combination: in quant: identity decoys and a donor gate for the MBR transfer FDR bigbio/andes#172, shape features with the donor gate and identity decoys give 88 entrapment transfers at q 0.01, against 48 before the shape features.
  • Precursors with the gate: +495 (+1.1 %) at q 0.01 and −34 at q 0.05. Median |eps| is equal; at q 0.01, E. coli with rt_local gets worse (0.3397 → 0.3496) and CV goes up by 0.0006. In andes, the combination at q 0.01 gives 62,797 precursors, against 54,932 before the shape features (+14 %).

Fix in this benchmark. In ce6eb11b, ProteomicsLFQ now keeps the shape snapshots in -feat_dir checkpoints that were detected without the option. Before, PipEcho:* was not in the checkpoint fingerprint, so combining with shape_features true from such checkpoints silently compared no transfer by width or tailing (BSA: 0 of 11 instead of 11 of 11).

Not done:

  • andes itself was not run on these inputs, because of compute (a Rust build plus search and quantification of six 2 h runs).
  • No second dataset.

Suggestion (not in this PR): keep the default false. The option only helps at strict transfer q (0.01–0.02), by about 1k precursors at equal or slightly better accuracy. Without a protein filter, use it only together with the #10633 gate, which ProteomicsLFQ turns on automatically there.

Ported from bigbio/andes#167.

Checklist

  • Make sure that you are listed in the AUTHORS file
  • Add relevant changes and new features to the CHANGELOG file
  • I have commented my code, particularly in hard-to-understand areas
  • New and existing unit tests pass locally with my changes
  • Updated or added python bindings for changed or new classes (Tick if no updates were necessary.)

How can I get additional information on failed tests during CI

Click to expand If your PR is failing you can check out

Advanced commands (admins / reviewer only)

Click to expand
  • /reformat (experimental) applies the clang-format style changes as additional commit. Note: your branch must have a different name (e.g., yourrepo:feature/XYZ) than the receiving branch (e.g., OpenMS:develop). Otherwise, reformat fails to push.


Generated by Claude Code

…agrees with its precursor's identified features

With PipEcho:shape_features true, the transfer FDR model gets three more
features per candidate transfer, comparing its peak with the identified
features of the same precursor in the other runs (median, leaving out the
acceptor's own run): the log ratio of the elution width on the aligned RT
scale, the difference in tailing, and the cosine between the observed
isotope envelopes. They describe the peak, not its size. A decoy transfer
is compared with its donor's precursor. Without a reference the features
are 0, 0 and -1. Off by default.

ProteomicsLFQ snapshots the width (sigma of the elution model fit, carried
onto the aligned scale by the local slope of the run's RT transformation)
and the tailing (from the peak's integration boundaries) as feature meta
values when the option is on.

Ported from bigbio/andes #167 (identity decoys from #172 are not ported).

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01F73hZDwadLuUofLxkDHyVS
@coderabbitai

coderabbitai Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 33 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 4 included reviews currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 6d64cc07-0814-46db-864c-f60379e5d23d
📥 Commits

Reviewing files that changed from the base of the PR and between b8f55c6 and 3f421d6.

📒 Files selected for processing: 11
  • CHANGELOG
  • src/openms/source/ANALYSIS/MAPMATCHING/PIPECHO/Impl.cpp
  • src/openms/source/ANALYSIS/MAPMATCHING/PIPECHO/Impl.h
  • src/openms/source/ANALYSIS/MAPMATCHING/PIPECHO/Score.h
  • src/openms/source/ANALYSIS/MAPMATCHING/PIPECHO/TransferFDRModel.cpp
  • src/openms/source/ANALYSIS/MAPMATCHING/PIPECHO/TransferFDRModel.h
  • src/openms/source/ANALYSIS/MAPMATCHING/PIPECHO/Util.cpp
  • src/openms/source/ANALYSIS/MAPMATCHING/PIPECHO/Util.h
  • src/openms/source/ANALYSIS/MAPMATCHING/PipEchoAlgorithm.cpp
  • src/tests/class_tests/openms/source/PipEchoAlgorithm_test.cpp
  • src/topp/ProteomicsLFQ.cpp
✨ 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

Comment @coderabbitai help to get the list of available commands.

@timosachsenberg
timosachsenberg marked this pull request as draft October 19, 2026 12:40
…heckpoints detected without shape_features

PipEcho:* is not part of the checkpoint fingerprint, but the elution width
and tailing were only snapshotted at detection with
PipEcho:shape_features true. A combine with the option from checkpoints
detected without it therefore compared no transfer by width or tailing,
without a warning (BSA example: 0 of 11 candidate transfers instead of 11).
They are now snapshotted whenever PIP-ECHO is on and dropped at combine
time when the option is off, so the output without it stays unchanged.

TOPP test: detect without the option into -feat_dir, combine with it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_019EmvqvGCbTQPJEG9k6jJug
timosachsenberg pushed a commit that referenced this pull request Oct 20, 2026
…ch HF-X and the frozen entrapment DB

Scripts, input/output hashes and result tables of the #10637 benchmark
(#10585 recipe; option off vs on, baseline merge-base, transfer q 0.01-0.05,
transfer FDP with the frozen shuffled r = 1 entrapment database).

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

Copy link
Copy Markdown
Contributor Author

Benchmark fix pushed: ce6eb11b — ProteomicsLFQ: keep the PIP-ECHO shape snapshots in -feat_dir checkpoints detected without shape_features.

PipEcho:* is not part of the checkpoint fingerprint, but pipecho_width / pipecho_tailing were only snapshotted at detection when PipEcho:shape_features was on. Combining with the option from checkpoints detected without it therefore compared no transfer by width or tailing, without a warning (BSA example: 0 of 11 candidate transfers instead of 11 of 11; only the isotope cosine was left).

The snapshots are now taken whenever PIP-ECHO is on and dropped at combine time when the option is off. Output without the option is unchanged: byte-identical mzTab, consensusXML and MSstats on BSA, and identical MSstats on the ProteoBench benchmark. New TOPP test TOPP_ProteomicsLFQ_feat_dir_shape_{clean,detect,combine}. All 111 ProteomicsLFQ|PipEchoAlgorithm tests pass locally.

The benchmark results are in the PR description.


Generated by Claude Code

Copy link
Copy Markdown
Contributor Author

Why andes gains +23 % and this port +2.1 %

This comes from reading the code and the committed tables; nothing was re-run. It is not a porting bug.

  1. Headroom explains about ¾ of the gap.

    • The andes baseline climbs steeply with the transfer q: 54,932 / 67,035 / 70,679 precursors at 0.01 / 0.05 / 0.10. With FeatureFinder crashes with "simple" method [167] #167, andes's q 0.01 point reaches its old q 0.05 depth.
    • The OpenMS "off" curve is nearly flat: 43,586 → 46,401 from q 0.01 to 0.05. A perfect ranking could add at most about +2.8k (+6.5 %) at 0.01, and the port gets 921 of that.
    • Identifications alone already cover 95 % of the precursors seen in ≥ 3 runs (50,073 of 52,585 in transfers.tsv). PIP-ECHO also only scores detected, unidentified features, while andes fits every library precursor in every run.
  2. About a third of andes's +23 % was false transfers. Its entrapment transfers rose 48 → 728. Once andes#172 controlled them with identity decoys, its own table gives:

    andes arm precursors at q 0.01 gain
    identity decoys, scored only 56,022 +2.0 %
    identity decoys, trained 63,238 +15.1 %
    final, with the donor gate 62,797 +14.3 %

    So the fair andes reference is about +14 %, not +23 %.

  3. Target/decoy separation is weaker here. This explains the rest; it is inferred, not tested.

    • PIP-ECHO uses a linear SVM where andes uses a GBDT.
    • shape_width and shape_tailing are signed and non-monotone: a wrong peak can be wider or narrower. A linear model rewards only one direction.
    • The "no reference" value reads as perfect agreement.
    • Tailing is measured from the integration boundaries here, but from the fit residual in andes.

Cheap test, combine-only on the existing -feat_dir checkpoints:

  1. Run "off" at PipEcho:fdr 0.1 and 1.0 to measure the ceiling.
  2. Add |shape_width|, |shape_tailing| and a has-reference flag as predictors. Rerun on/off at 0.01 and 0.02, also with -proteinFDR 1.

If the ceiling stays near 47k, keep this as a small gain at strict transfer q. The bigger lever would be candidate generation, i.e. extracting every precursor in every run; that is a separate project.


Generated by Claude Code

Copy link
Copy Markdown
Contributor Author

Closing this port. The gain in OpenMS is too small for an extra option.

Benchmark details are in the description and in claude/andes-benchmarks, benchmark-reproduction/andes-ports/pr10637. The checkpoint fix found during the benchmark (ce6eb11) only concerns this PR's option, so nothing needs to move to develop.


Generated by Claude Code

Copy link
Copy Markdown
Contributor Author

Closing without merging; the benchmark in the description is the reason.

The limit is how many candidate transfers PIP-ECHO produces, not how it scores them. That is tracked in #10693, together with what a second attempt at shape features would need. The benchmark scripts and tables remain in benchmark-reproduction/andes-ports/pr10637, and the branch stays for reference.


Generated by Claude Code

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.

2 participants