Skip to content

[FEATURE] ProteomicsLFQ -consensus_elution_width: one elution width per linked precursor - #10632

Merged
timosachsenberg merged 5 commits into
developfrom
claude/andes-consensus-width
Oct 26, 2026
Merged

timosachsenberg merged 5 commits into
developfrom
claude/andes-consensus-width

Conversation

@timosachsenberg

@timosachsenberg timosachsenberg commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Requested by Timo · project thread

Description

Before: FeatureFinderIdentification quantifies a feature by its Gaussian area, height × sigma × √(2π), with sigma fitted in each run. The error of the width fit moves a precursor's quantity from run to run.

After: With ProteomicsLFQ -consensus_elution_width true, every feature of a consensus feature is quantified as height × w_c × √(2π) with one width w_c: the median over the precursor's identified features (with a valid fit) of sigma carried onto the consensus RT scale by the run's alignment slope. Each run's width is mapped back with its own slope. Features without a valid fit keep their intensity. Default false.

How: New ConsensusElutionWidth (apply() and localSlope()). ProteomicsLFQ keeps the fit's meta values (model_height, model_Gauss_sigma, model_center, model_status) through its meta-value cleanup at detection, so -feat_dir checkpoints serve both settings; the option is not part of the checkpoint fingerprint. It applies the option after linking and removes the meta values before linking (option off) or after it (option on). Class test, TOPP test.

Benchmark

Data. ProteoBench DDA quant ion module, Q Exactive HF-X (PXD028735): 3 + 3 runs with 2 h gradients. The mzML are ProteoBench's own files, the same as in #10585. The FASTA is ProteoBenchFASTA_MixedSpecies_HYE.fasta (sha256 d9ac434d…), with reversed DECOY_ decoys from DecoyDatabase.

Builds.

  • Baseline: 77cccda7, the merge-base with develop.
  • PR: 6fa67d5f. This is PR head 529b2027 plus the checkpoint fix below. e66bfaa1 adds only a test.

Pipeline. It follows #10585 step by step:

  • Identification: CometAdapter (10 ppm, 0.02 Da, Trypsin, 2 missed cleavages, 7–40 aa, z 2–5, CAM, Ox(M), Acetyl(Protein N-term)). Then PSMFeatureExtractor and PercolatorAdapter (PEP, TDC, seed 42), with PSMs kept at q ≤ 0.10. At q < 0.01 the six runs have 50,906 / 52,121 / 55,935 / 51,758 / 51,605 / 56,258 PSMs, identical to [FEATURE,FIX] RT-local run normalization (ConsensusMapNormalizer rt_local); ProteomicsLFQ linking tolerance and RT model #10585.
  • ProteomicsLFQ: -psmFDR 0.01 -proteinFDR 0.01 -picked_proteinFDR true -protein_inference aggregation -feat_dir <dir>, plus -targeted_only true (identified only) or -targeted_only false -pip_echo true (MBR).
  • Pairing: each arm runs with -consensus_elution_width false and true, from the same IDs and the same 6 -feat_dir checkpoints.
  • Normalization: "none" is ProteomicsLFQ's own -out_msstats. "rt_local" is -out_cxml → ConsensusMapNormalizer -algorithm_type rt_local → MSstatsConverter.
  • Scoring: the official proteobench 0.18.6, format "quantms", min 3 runs. The scoring script reproduces the public quantms submission d01e87b9 exactly (33,040 / 0.2088 / 0.3866 / CV 0.2236).

Scripts, commands and tables: benchmark-reproduction/andes-ports/pr10632 on branch claude/andes-benchmarks.

ProteomicsLFQ arm normalization consensus width precursors median |ε| E. coli yeast human CV
identified only none off 42,253 0.2223 0.4048 0.2599 0.2108 0.2309
identified only none on 42,253 0.2179 0.2906 0.2515 0.2068 0.2320
identified only rt_local off 42,253 0.1494 0.2978 0.1823 0.1431 0.0879
identified only rt_local on 42,253 0.1390 0.1818 0.1341 0.1390 0.0926
MBR (PIP-ECHO) none off 46,415 0.2214 0.4054 0.2598 0.2087 0.2357
MBR (PIP-ECHO) none on 46,415 0.2168 0.3060 0.2511 0.2065 0.2361
MBR (PIP-ECHO) rt_local off 46,415 0.1572 0.3363 0.1994 0.1491 0.0950
MBR (PIP-ECHO) rt_local on 46,415 0.1466 0.1974 0.1434 0.1461 0.0985

Baseline sanity check. With the option off, the numbers match #10585:

Option off vs baseline build.

  • Identified only: identical. The MSstats CSVs (none and rt_local) are byte-identical. consensusXML and mzTab are identical except for paths, version, dates and random feature ids.
  • PIP-ECHO: the outputs differ, but the cause is in the baseline. The baseline itself does not repeat:
    • For 5 of the 6 runs, the feature checkpoints of the two builds are identical (rt, m/z, charge, intensity, quality).
    • Run A_01 is not reproducible in PIP-ECHO-mode detection (-targeted_only false) with either build. Detecting it twice with the same baseline build gives 77,858 vs 77,859 features, and about 15,500 features differ in intensity (relative difference about 1e-5). The PR build varies the same way.
    • The PIP-ECHO metrics of the two builds differ by at most 0.0001 in median |ε| and CV.
  • Combining from checkpoints. On the PIP-ECHO path, combining from -feat_dir checkpoints does not reproduce the in-memory result exactly (46,415 vs 46,419 precursors). On the identified-only path, only the formatting of percolator_score changes.
  • Both effects are already on develop. Neither the A_01 nondeterminism nor the checkpoint difference is touched by this PR. That is why the PIP-ECHO off/on rows above both come from the same checkpoints.

What the option changes.

  • Ratio compression. Most of the gain is less ratio compression. The median signed ε for PIP-ECHO, none / rt_local:
    • E. coli: +0.33 / +0.25 → +0.18 / +0.06
    • yeast: −0.09 / −0.12 → +0.05 / −0.04
  • Spread. The spread around each species' median also shrinks, e.g. E. coli 0.39 → 0.32 (none).
  • CV. The within-condition CV does not improve. With rt_local it gets slightly worse (0.088 → 0.093 and 0.095 → 0.099).
  • Width fits. In the identified-only arm, 267,249 of 301,098 features have a valid Gaussian fit and all of them were re-quantified. The other 33,849 kept their intensity. In PIP-ECHO, 381,546 of 471,838 features have a valid fit and 295,961 were re-quantified, in 83,033 consensus features. 46,355 kept their intensity. The MSstats rows (265,768) are the same with and without the option; only the intensities change.

Comparison with andes (bigbio/andes#150). The andes numbers are for MBR quantities without normalization (its raw quantity), so the comparable OpenMS row is PIP-ECHO, none.

metric andes before → after OpenMS off → on verdict
median |ε| 0.253 → 0.225 (−0.028) 0.2214 → 0.2168 (−0.005) partly: same direction, about 1/6 of the size
E. coli |ε| 0.382 → 0.276 (−0.106) 0.4054 → 0.3060 (−0.099) reproduced
CV 0.251 → 0.240 (−0.011) 0.2357 → 0.2361 (±0) not reproduced

Likely reasons for the smaller overall gain:

  • Width scatter in andes. andes chooses each run's width from a 3-point grid (0.7 / 1.0 / 1.4 × prior), so its per-run widths jump by up to 40 %. FeatureFinderIdentification fits sigma continuously, so it has less width error to remove.
  • Pipeline differences. The two pipelines also differ in feature finder (likelihood template vs FFId), MBR (GBDT transfers vs PIP-ECHO), normalization and protein inference.

andes was not run on these inputs. It does its own search, and a like-for-like run did not fit next to the 11–13 GB PIP-ECHO runs on this machine.

Second dataset: Agilent 6550 Q-TOF (PXD069532, archive ProteomicsLFQ-Multi-Instrument; 3 + 3 runs; same recipe with FragPipe's search settings). This set is too small to decide anything:

  • Only 520–760 PSMs per run at 1 % FDR, and 73–76 precursors in all 6 runs.
  • The CV improves slightly with the option: 0.330 → 0.318 (none) and 0.310 → 0.285 (rt_local), identified only. PIP-ECHO is similar.
  • log2 fold changes agree with FragPipe-MBR in neither arm (r ≈ 0).

Verdict. The option clearly improves accuracy on the HF-X data, mostly for the E. coli and yeast ratios, with and without rt_local normalization. Precision (CV) does not improve. Default stays false, as in this PR. Turning it on by default could be considered separately.

Fix pushed while benchmarking (6fa67d5). The option was part of the -feat_dir checkpoint fingerprint, and the fit was dropped at detection when the option was off. So checkpoints written without the option were rejected with it, and the two settings could not share checkpoints.

  • Now: detection always keeps the fit, the option is excluded from the fingerprint, and the fit is removed before linking (option off) or after it (option on). It is removed from the consensus features too, because single-run linking copies feature meta values.
  • Test: TOPP_ProteomicsLFQ_feat_dir_consensus_width (e66bfaa) combines the existing BSA checkpoints with the option on.
  • Checks: the 103 existing TOPP_ProteomicsLFQ* tests, the new test and ConsensusElutionWidth_test pass.

Ported from bigbio/andes#150.

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 with Claude Code

https://claude.ai/code/session_01F73hZDwadLuUofLxkDHyVS

Summary by CodeRabbit

  • New Features
    • ProteomicsLFQ can now quantify linked precursors using a shared elution width across runs. Enable this behavior with -consensus_elution_width true; it is off by default.
    • When valid fitted widths are unavailable, the affected intensities are retained rather than recalculated.

…er linked precursor

FeatureFinderIdentification reports each feature's Gaussian area, height x
sigma x sqrt(2 pi), with sigma fitted per run, so the width fit's error
moves a precursor's quantity from run to run. The new
ConsensusElutionWidth replaces, per consensus feature, every run's sigma by
the median over its identified features of sigma carried onto the
consensus RT scale by the run's alignment slope, and reports
height x consensus width x sqrt(2 pi) for every feature with a valid fit.
ProteomicsLFQ applies it after linking with -consensus_elution_width true
(default false).

Ported from bigbio/andes #150.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01F73hZDwadLuUofLxkDHyVS
@timosachsenberg timosachsenberg self-assigned this Oct 19, 2026
@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 22 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: 1980b81e-3482-45cc-953c-b2ae575191a5
📥 Commits

Reviewing files that changed from the base of the PR and between e66bfaa and a9fb997.

📒 Files selected for processing: 8
  • src/openms/include/OpenMS/ANALYSIS/QUANTITATION/ConsensusElutionWidth.h
  • src/openms/include/OpenMS/ANALYSIS/QUANTITATION/sources.cmake
  • src/openms/source/ANALYSIS/QUANTITATION/ConsensusElutionWidth.cpp
  • src/openms/source/ANALYSIS/QUANTITATION/sources.cmake
  • src/tests/class_tests/openms/executables.cmake
  • src/tests/class_tests/openms/source/ConsensusElutionWidth_test.cpp
  • src/tests/topp/CMakeLists.txt
  • src/topp/ProteomicsLFQ.cpp

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 791ed576-c800-4156-aae0-cc9a35f4337a
📥 Commits

Reviewing files that changed from the base of the PR and between 77cccda and e66bfaa.

📒 Files selected for processing: 9
  • CHANGELOG
  • src/openms/include/OpenMS/ANALYSIS/QUANTITATION/ConsensusElutionWidth.h
  • src/openms/include/OpenMS/ANALYSIS/QUANTITATION/sources.cmake
  • src/openms/source/ANALYSIS/QUANTITATION/ConsensusElutionWidth.cpp
  • src/openms/source/ANALYSIS/QUANTITATION/sources.cmake
  • src/tests/class_tests/openms/executables.cmake
  • src/tests/class_tests/openms/source/ConsensusElutionWidth_test.cpp
  • src/tests/topp/CMakeLists.txt
  • src/topp/ProteomicsLFQ.cpp

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

📝 Walkthrough

ProteomicsLFQ adds an optional consensus elution-width step. The step uses identified Gaussian fits and retention-time transformations to re-quantify linked features, while retaining intensities for handles that are not updated.

Changes: Consensus Elution Width

Layer / File(s) Summary
Width calculation and validation
src/openms/include/OpenMS/ANALYSIS/QUANTITATION/ConsensusElutionWidth.h, src/openms/source/ANALYSIS/QUANTITATION/ConsensusElutionWidth.cpp, src/openms/include/OpenMS/ANALYSIS/QUANTITATION/sources.cmake, src/openms/source/ANALYSIS/QUANTITATION/sources.cmake, src/tests/class_tests/openms/source/ConsensusElutionWidth_test.cpp, src/tests/class_tests/openms/executables.cmake
Adds an API that validates Gaussian fits, computes local RT transformation slopes, and uses the median identified-feature width to update eligible handle intensities. Other handle intensities are retained. Unit tests cover slope calculation and re-quantification.
ProteomicsLFQ integration
src/topp/ProteomicsLFQ.cpp, src/tests/topp/CMakeLists.txt, CHANGELOG
Adds the -consensus_elution_width option, defaulting to false. When enabled, ProteomicsLFQ retains fit metadata through linking, applies consensus-width re-quantification, logs update counts, and removes the metadata. The option is excluded from the checkpoint fingerprint. Adds an integration test and changelog entries.

Sequence Diagram(s)

sequenceDiagram
  participant ProteomicsLFQ
  participant FeatureMaps
  participant ConsensusElutionWidth
  participant ConsensusMap
  ProteomicsLFQ->>ConsensusElutionWidth: apply after feature linking
  ConsensusElutionWidth->>FeatureMaps: match handles by map index and unique ID
  ConsensusElutionWidth->>ConsensusMap: update eligible handle and consensus intensities
  ConsensusElutionWidth-->>ProteomicsLFQ: return update and kept counts
Loading

Suggested reviewers: cbielow, poshul

Priority: ➖ Normal

Change: Feature

Merge Risk: ⚪ Minimal · up to e66bf

No actionable issue was established that should prevent merging after normal checks.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 12 functions across 4 files. (5 skipped: … 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 clearly and concisely describes the main change: adding the ProteomicsLFQ -consensus_elution_width feature to use one elution width per linked precursor.
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 33.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 12 functions across 4 files. (5 skipped: 5 unsupported.)

Resolution

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

✨ Finishing Touches: 💡 1
📝 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 each fitted peak,
And finds one width across the week.
The linked intensities settle in line,
While unfit handles keep their sign.
Then hops away, with tests to shine.

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

Copy link
Copy Markdown
Contributor Author

build-and-test (windows-2025, cl.exe) failed while installing dependencies, before the build: choco install rsync got a 503 from community.chocolatey.org. That was a short Chocolatey outage (about 08:50–09:08 UTC); Windows jobs on other PRs passed the same step before and after it. Nothing in this PR touches it. I re-ran the failed job.


Generated by Claude Code

…ckpoints

The elution model fit was kept through detection only when the option was on,
and the option was part of the checkpoint fingerprint. Checkpoints written
without it were rejected when it was turned on, and checkpoints could not be
shared between the two settings. The option is only applied after linking, so
it is now excluded from the fingerprint; detection always keeps the fit, and
it is removed after linking in either case.

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

Copy link
Copy Markdown
Contributor Author

Two commits came out of the ProteoBench benchmark (results are in the PR description):

  • 6fa67d5: -consensus_elution_width works with -feat_dir checkpoints.
    • Problem. The option was part of the checkpoint fingerprint, and the elution model fit was kept through detection only when the option was on. So checkpoints detected without it were rejected with it ("produced with different settings"), and the off/on arms could not share checkpoints.
    • Fix. The option is only applied after linking, so it is now excluded from the fingerprint. Detection always keeps the four fit meta values. They are removed before linking when the option is off (single-run linking copies feature meta values into the consensus map) and after apply() when it is on.
    • Output with the option off is unchanged. All 103 existing TOPP_ProteomicsLFQ* tests pass. On the HF-X benchmark, the identified-only outputs are identical to the merge-base build.
  • e66bfaa: adds the TOPP test TOPP_ProteomicsLFQ_feat_dir_consensus_width. It combines the BSA checkpoints written without the option, with the option on, and requires re-quantified features.

Generated by Claude Code

Copy link
Copy Markdown
Contributor Author

Why andes's median |ε| and CV gain is larger

This comes from reading the code and the committed tables; nothing was re-run. The E. coli gain is reproduced: −0.101 in andes, −0.099 here. The rest of andes's gain removes noise that only andes's baseline had.

  1. The baselines differ.

  2. The andes headline also includes a continuous width refinement (golden-section search, 09681e5). That refinement gives −0.004 median |ε| and −0.005 CV, about half of andes's CV gain. OpenMS does not need it, because its width is already continuous.

    Consensus width alone, compared like for like:

    andes OpenMS
    median |ε| −0.023 −0.005
    E. coli −0.101 −0.099
    CV −0.006 ±0
  3. Here the human gain partly cancels.

    • The human spread improves (0.2095 → 0.2041), but the human bias moves from +0.012 to +0.030.
    • Yeast is over-corrected: −0.09 → +0.05.
    • CV gets slightly worse. Inferred cause: in a joint height/σ fit the area is the stable quantity, so swapping in the consensus width adds noise.
  4. The port matches andes (quant_mbr.rs:624-670): same width estimator, same rescaling. OpenMS groups per consensus feature instead of per library precursor, and keeps features without a valid fit (19 %) unchanged.

Recommendation: keep the port as a species-bias fix and don't chase the remaining gap. Two optional follow-ups:

  • To confirm cause 1, snap σ to andes's grid and rescore.
  • To possibly recover the CV and human loss, shrink σ toward the consensus width instead of replacing it. Untested.

Generated by Claude Code

…nsus-width

CHANGELOG conflict resolved to develop's version: entries are generated weekly now.

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

@timosachsenberg timosachsenberg left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Reviewed the width estimator, RT-slope conversion, feature-handle updates, and checkpoint integration at a9fb997. No substantive correctness finding. The option is excluded from the detection fingerprint while the required fit metadata is retained until combination; the disabled path removes it before linking. Build and wheel CI passed. This was a source review, without rerunning the quantitative benchmark.

@timosachsenberg
timosachsenberg merged commit f04062c into develop Oct 26, 2026
32 checks passed
@timosachsenberg
timosachsenberg deleted the claude/andes-consensus-width branch October 26, 2026 12:54
timosachsenberg pushed a commit that referenced this pull request Oct 28, 2026
…onWidth natively

develop's ConsensusElutionWidth (#10632, ProteomicsLFQ
-consensus_elution_width) takes a feature's width as identified if the
feature carries peptide identifications; here, if it is linked to
identifications in the identification data of its feature map
(BaseFeature::getLinkedIdentifications). The class test links the same
features through the identification data converter.

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