Skip to content

feat(PIPECHO): isotope-distribution MBR feature (envelope correlation) - #9676

Merged
timosachsenberg merged 1 commit into
developfrom
feat/pipecho-isotope-feature
Jun 27, 2026
Merged

timosachsenberg merged 1 commit into
developfrom
feat/pipecho-isotope-feature

Conversation

@timosachsenberg

@timosachsenberg timosachsenberg commented Jun 27, 2026 •

Copy link
Copy Markdown
Contributor

What

Adds the isotope-distribution similarity MBR feature to PIP-ECHO — one of the two
features the OpenMS port dropped from FlashLFQ's 5-feature classifier (issue #9655).

For each candidate (donor, acceptor) transfer it computes the Pearson correlation between
the acceptor's observed isotope envelope and the donor peptide's theoretical envelope
(CoarseIsotopePatternGenerator), mapped to [0,1], and feeds it to the transfer-FDR SVM.
It is identity-coupled (acceptor signal vs the donor's theoretical pattern), so a
coincidental same-m/z match scores lower.

Mechanics:

  • ProteomicsLFQ extracts 3 isotopes on the pip_echo path (the default 2 give a
    degenerate Pearson) and snapshots the observed envelope into a pipecho_obs_envelope meta
    before the feature-meta strip (whitelisted, like the mass fix's masserror_ppm).
  • RunStatistics::calc_isotope_score does the correlation; added as an SVM-only predictor
    (not the mbr_score geomean).

Stacked on #9674 (the mass-error/RT fix) — base branch is fix/pipecho-mass-rt-features;
the diff here is just the isotope commit. Retarget to develop once #9674 merges.

Results (PXD016921 single-cell, PipEcho:fdr=0.05, on top of #9674)

The right metric is cross-run completeness (consensus size = how many of the 7 runs a
peptide is quantified in), not distinct-peptide count — transfers fill out existing groups
(total consensus ~19,400 constant), reducing missing values. All rows at ~5% realized FDR
with a clean Blank.

build transfers peptides in all 7 runs (sz7) singletons (sz1)
develop (mass dead) 0 37 11533
#9674 (n_iso=2, mass) 1280 114 10969
n_iso=3 mass-only (control) 1343 124 10910
n_iso=3 + isotope (this PR) 1826 167 (+46% vs #9674) 10730

Attribution (measured via the n_iso=3 mass-only control): the isotope feature itself
contributes +483 transfers (+36%) and +43 of the +53 sz7 gain (~81%). n_isotopes=3
alone is only a minor positive (sz7 114→124) and — unlike n_isotopes=5, which hurts
mass-only (1280→1103) — carries no extraction penalty. So the completeness win is genuinely
the feature, and n_isotopes=3 is the sweet spot.

Honest scope / caveats

  • The feature's univariate target/decoy AUC is only 0.54 (it helps multivariately
    in the SVM). OpenMS PIP-ECHO has no raw-MS1 access (group() takes pre-extracted
    FeatureMaps), so it cannot re-extract the envelope at the candidate identity/RT the way
    FlashLFQ does to make isotope/scan strong; two peptides within 10 ppm have similar
    pre-extracted envelopes. The win is real but bounded by that architecture.
  • Scan count (the other dropped feature) is not ported: the acceptor's self
    points_across_baseline/FWHM is identity-independent (redundant with intensity) and would
    need the same raw re-extraction.
  • RT stays out of mbr_score (its raw/inverted form was fixed in fix(PIPECHO): revive dead mass-error feature and drop raw/inverted RT from mbr_score #9674); calibrating it
    is a monotonic transform that cannot change its ~0.49 AUC.

Tests: PipEchoAlgorithm_test and PipEchoAlgorithm_realistic_test pass; the
extract:n_isotopes change is confined to the pip_echo path, so the default linker path
and its TOPP_ProteomicsLFQ_* references are untouched.

Closes part of #9655 (isotope feature); the remaining items (scan count via raw
re-extraction, faithful RT) are scoped in that issue.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Added isotope-envelope scoring to improve feature matching quality.
    • Preserved observed isotope envelope and mass error information for downstream scoring in relevant workflows.
  • Bug Fixes

    • Improved handling of missing or incomplete isotope data by using a neutral fallback score.
    • Ensured scoring inputs are consistently available so matching behaves more reliably across samples.

@timosachsenberg

Copy link
Copy Markdown
Contributor Author

Implements the isotope-distribution feature from #9655 (with measured attribution + the architectural-ceiling finding for scan-count/RT). Stacked on #9674.

@timosachsenberg
timosachsenberg force-pushed the fix/pipecho-mass-rt-features branch from f04bb33 to 515d372 Compare June 27, 2026 04:17
@timosachsenberg
timosachsenberg force-pushed the feat/pipecho-isotope-feature branch from 577f6f3 to 63010bb Compare June 27, 2026 04:23
Base automatically changed from fix/pipecho-mass-rt-features to develop June 27, 2026 05:24
…, SVM-only)

Adds the acceptor-observed vs donor-theoretical isotope-envelope Pearson as an SVM
predictor. ProteomicsLFQ extracts 3 isotopes on the pip_echo path (the default 2
give a degenerate Pearson) and snapshots the observed envelope into a
pipecho_obs_envelope meta before the feature-meta strip; RunStatistics correlates
it against the donor peptide's theoretical envelope (CoarseIsotopePatternGenerator),
mapped to [0,1].

The feature is identity-coupled (compares the acceptor signal to the DONOR's
theoretical pattern), so a coincidental same-m/z match scores lower. Its univariate
target/decoy AUC on PXD016921 is only 0.543 -- OpenMS PIP-ECHO has no raw-MS1 access
and cannot re-extract the envelope at the candidate identity/RT the way FlashLFQ does,
and two peptides within 10 ppm have similar pre-extracted envelopes -- but it
contributes meaningfully in the multivariate SVM.

Effect on the PXD016921 single-cell benchmark (fdr=0.05, on top of the mass fix
headline -- peptides quantified in all 7 runs (consensus size 7) rise 114 -> 167
(+46%) with fewer singletons (sz1 10969 -> 10730), i.e. materially completer
cross-run quantification, while the empty Blank stays clean. n_isotopes=3 (not 5)
is deliberate: more isotopes perturb FFID's extraction and cost direct quant.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@timosachsenberg
timosachsenberg force-pushed the feat/pipecho-isotope-feature branch from 63010bb to 531d43b Compare June 27, 2026 05:29
@coderabbitai

coderabbitai Bot commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

PIP-ECHO now captures observed isotope envelopes, computes an isotope-agreement score during run statistics, stores it in Score, and writes it into the FDR model predictor map. The pip_echo path also adjusts isotope extraction and metadata retention.

Changes

PIP-ECHO isotope scoring pipeline

Layer / File(s) Summary
Envelope metadata plumbing
src/topp/ProteomicsLFQ.cpp, src/openms/source/ANALYSIS/MAPMATCHING/PIPECHO/Util.h, src/openms/source/ANALYSIS/MAPMATCHING/PIPECHO/Util.cpp
pip_echo snapshots subordinate intensities into pipecho_obs_envelope, preserves that meta key with masserror_ppm, and adds feature_obs_envelope to read the stored envelope as an optional vector.
Isotope score calculation
src/openms/source/ANALYSIS/MAPMATCHING/PIPECHO/Score.h, src/openms/source/ANALYSIS/MAPMATCHING/PIPECHO/RunStatistics.h, src/openms/source/ANALYSIS/MAPMATCHING/PIPECHO/RunStatistics.cpp
Score gains isotope_score, and RunStatistics::score now fills it using a helper that compares donor-theoretical and acceptor-observed isotope envelopes with a 0.5 fallback.
Predictor encoding
src/openms/source/ANALYSIS/MAPMATCHING/PIPECHO/TransferFDRModel.cpp
TransferFDRModel::predictors_t::encode now always emits the isotope_score predictor column for each acceptor.

Sequence Diagram(s)

sequenceDiagram
  participant ProteomicsLFQ
  participant Feature
  participant RunStatistics
  participant Score
  participant TransferFDRModel
  ProteomicsLFQ->>Feature: store pipecho_obs_envelope metadata
  RunStatistics->>Feature: read pipecho_obs_envelope via feature_obs_envelope
  RunStatistics->>Score: set isotope_score
  TransferFDRModel->>Score: encode isotope_score predictor
Loading

Possibly related issues

  • OpenMS/OpenMS issue 9655 — Covers the same PIP-ECHO isotope-distribution pipeline touched by ProteomicsLFQ.cpp, Score.h, Util.*, and RunStatistics.*.

Possibly related PRs

  • OpenMS/OpenMS#9647 — Introduces the core PIP-ECHO scoring stack that this PR extends with isotope-envelope scoring.
  • OpenMS/OpenMS#9674 — Touches the same PIP-ECHO ProteomicsLFQ and RunStatistics paths, making it closely adjacent to this scoring update.

Poem

A bunny found envelopes, soft and sweet,
With isotope hops in a tidy beat.
I twitched my nose at every score,
And tucked new predictors into store.
Hoppity pip, the pipeline sings! 🐇

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: adding an isotope-distribution MBR feature based on envelope correlation in PIPECHO.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/pipecho-isotope-feature

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (2)
src/openms/source/ANALYSIS/MAPMATCHING/PIPECHO/Util.h (1)

42-49: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add the required @brief tag to this header doc block.

The new declaration is documented, but it does not match the header-format rule used in this repo. As per coding guidelines, **/*.h: Add Doxygen documentation with @brief tag (required), followed by blank line and details.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/openms/source/ANALYSIS/MAPMATCHING/PIPECHO/Util.h` around lines 42 - 49,
The Doxygen block for feature_obs_envelope in Util.h is missing the required
`@brief` tag. Update the header comment to follow the repo’s h-file documentation
format by adding an `@brief` summary at the start, then a blank line, then the
existing detailed description of the feature’s observed isotope envelope and
pipecho_obs_envelope metadata.

Source: Coding guidelines

src/openms/source/ANALYSIS/MAPMATCHING/PIPECHO/RunStatistics.h (1)

66-72: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add the required @brief tag to this header doc block.

This new declaration is documented, but not in the header format required by the repo. As per coding guidelines, **/*.h: Add Doxygen documentation with @brief tag (required), followed by blank line and details.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/openms/source/ANALYSIS/MAPMATCHING/PIPECHO/RunStatistics.h` around lines
66 - 72, The Doxygen block for calc_isotope_score in RunStatistics.h is missing
the required `@brief` tag. Update the existing header comment so it starts with a
concise `@brief` summary, then keep a blank line before the detailed description,
matching the repo’s header documentation style and the surrounding declarations
in RunStatistics.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@src/openms/source/ANALYSIS/MAPMATCHING/PIPECHO/RunStatistics.h`:
- Around line 66-72: The Doxygen block for calc_isotope_score in RunStatistics.h
is missing the required `@brief` tag. Update the existing header comment so it
starts with a concise `@brief` summary, then keep a blank line before the detailed
description, matching the repo’s header documentation style and the surrounding
declarations in RunStatistics.

In `@src/openms/source/ANALYSIS/MAPMATCHING/PIPECHO/Util.h`:
- Around line 42-49: The Doxygen block for feature_obs_envelope in Util.h is
missing the required `@brief` tag. Update the header comment to follow the repo’s
h-file documentation format by adding an `@brief` summary at the start, then a
blank line, then the existing detailed description of the feature’s observed
isotope envelope and pipecho_obs_envelope metadata.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 1a0490f2-fcd4-4d50-a212-969746c68afa

📥 Commits

Reviewing files that changed from the base of the PR and between da10ab4 and 531d43b.

📒 Files selected for processing (7)
  • src/openms/source/ANALYSIS/MAPMATCHING/PIPECHO/RunStatistics.cpp
  • src/openms/source/ANALYSIS/MAPMATCHING/PIPECHO/RunStatistics.h
  • src/openms/source/ANALYSIS/MAPMATCHING/PIPECHO/Score.h
  • src/openms/source/ANALYSIS/MAPMATCHING/PIPECHO/TransferFDRModel.cpp
  • src/openms/source/ANALYSIS/MAPMATCHING/PIPECHO/Util.cpp
  • src/openms/source/ANALYSIS/MAPMATCHING/PIPECHO/Util.h
  • src/topp/ProteomicsLFQ.cpp

@timosachsenberg
timosachsenberg merged commit 221d046 into develop Jun 27, 2026
42 checks passed
@timosachsenberg
timosachsenberg deleted the feat/pipecho-isotope-feature branch June 27, 2026 07:54
@jpfeuffer

Copy link
Copy Markdown
Contributor

Nice. How much runtime does this all add?

@timosachsenberg

Copy link
Copy Markdown
Contributor Author

not too much. calculation are mostly already done by feature finder ID

timosachsenberg added a commit that referenced this pull request Jun 29, 2026
…O fixes) (#9677)

Documents two PIP-ECHO improvements merged on 2026-06-27:
- #9674: revive dead mass_error feature and drop raw/inverted RT from mbr_score
- #9676: isotope-distribution envelope correlation as a new SVM-only MBR feature


Claude-Session: https://claude.ai/code/session_01GRoRx9TnjaBjfuBWT8umia

Co-authored-by: Claude <[email protected]>
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