Repository navigation
PIP-ECHO: make the local adaptive RT window the default MBR mode (accuracy + specificity) - #9680
Conversation
… from mbr_score PIP-ECHO's transfer-FDR SVM produced ZERO match-between-runs transfers on real ProteomicsLFQ data (PXD016921 single-cell, quantms#287) at every FDR cutoff. Root cause: two of its three scoring features were broken, which the #9661 SimpleSVM fix exposed (it previously rode on a feature-index-misalignment bug). mass_error was DEAD. RunStatistics calibrates the donor mass-error distribution via Util::feature_mass_error, which computed getPPM(feature.getMZ(), theoretical). But FeatureFinderIdentification seeds the feature's position m/z to the peptide's THEORETICAL m/z, so this is identically 0 for every donor: the calibration distribution is degenerate, calc_score_using returns a constant MIN_SCORE, and SimpleSVM drops the feature as uninformative. The real observed mass accuracy is carried in the feature's "masserror_ppm" meta (the OpenSWATH DIA mass-difference score = getPPM(observed, theoretical) per isotope), which ProteomicsLFQ stripped before grouping. Fix: whitelist "masserror_ppm" in keep_meta ONLY on the pip_echo path (it is needed solely by PIP-ECHO; keeping it on the default QT-linker path leaks it into the consensusXML/mzTab output and shifts the TOPP_ProteomicsLFQ references), and read it in feature_mass_error (monoisotopic-first; -1 is a "no signal" sentinel matched exactly, so genuinely negative errors are kept; precursor-m/z then feature-m/z fallbacks). This mirrors FlashLFQ, which calibrates its ppm distribution from the observed mass errors of identified peaks. rt_diff_error was RAW and INVERTED in the geometric-mean mbr_score: it multiplied in the raw absolute RT difference (0-1200+ s, magnitude-dominating) with inverted monotonicity (a larger RT error increased the score), poisoning best-acceptor selection and the round-1 bootstrap. Drop RT from the geomean (it is still given to the SVM as a feature). A faithful calibrated RT-agreement score (FlashLFQ's anchor-peptide RT prediction-error distribution) is a follow-up; see #9655. Effect on the PXD016921 benchmark: PIP-ECHO goes from 0 transfers at every FDR to FDR-controlled MBR -- at PipEcho:fdr=0.05, 1280 transfers at ~5% realized FDR, adding +392 peptides to the deep run while the empty Blank stays clean (+2). Both PipEchoAlgorithm tests pass; the keep_meta change is output-neutral (masserror_ppm is dropped at the consensus level, so the default pip_echo=false path is unaffected). Co-Authored-By: Claude Opus 4.8 <[email protected]>
…, 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]>
Adds an optional local adaptive retention-time window to PIP-ECHO's MBR candidate search (local_rt:enabled, default off -> existing behaviour is byte-identical). The global RT window is sized from the worst-case post-alignment residual (up to ~20 min on poorly-aligned single-cell data), which dilutes the target candidate pool with false in-window matches and makes the RT feature non-discriminative (target/decoy |dRT| AUC ~0.55). Instead, predict each acceptor's RT locally from peptides identified in both runs and search a tight, data-driven window (c * local stddev) around the prediction; decoys go through the same model so the target/decoy null stays exchangeable. Inspired by FlashLFQ's PredictRetentionTime, but with a generous cap (FlashLFQ's literal +/-30 s over-tightens this regime: it censors the RT dynamic range and starves decoys) and adaptive widening -- if a pass yields too few decoys to resolve the requested FDR, the window scale is doubled and the runs re-matched until the FDR is estimable or the global ceiling is reached. Validation: on the synthetic ground-truth entrapment test the local path keeps the realised FDR bounded (0.01 vs nominal 0.05) and improves true-transfer recovery vs the global baseline; on real PXD016921 it revives the RT feature (target/decoy AUC 0.55 -> 0.63) and cleans the candidate pool (mass AUC 0.67 -> 0.75) with healthy decoy counts. Parameters under 'local_rt:' (advanced): enabled, max_window, min_window, anchor_window, anchors, sigma_scale, fallback_window. Adds a local-path FDR assertion to PipEchoAlgorithm_realistic_test. Co-Authored-By: Claude Opus 4.8 <[email protected]>
…rt:auto)
Adds an opt-in auto mode (local_rt:auto, default off) that derives the local RT
window scales from the data instead of fixed seconds, so one configuration
adapts across short (single-cell) and long (bulk) gradients -- FlashLFQ's
absolute RT constants do not port across gradient lengths.
A global pre-pass over all run pairs estimates, from the shared-anchor RT-shift
scatter (local sigma) and anchor density:
locality = median_inter_anchor_gap * anchors * margin
cap = max(sigma_scale * P90(local_sigma), 0.25 * gap_med)
floor = max(1.5 * median_fwhm, P25(local_sigma)) [FWHM-aware]
= max(sigma_scale * P25(local_sigma), 0.1 * cap) [no FWHM]
The floor is chromatographic when a peak width is available (alignment scatter
already enters via c*sigma and the cap). median_fwhm is an optional host-provided
lower guard -- features carry no usable width, so ProteomicsLFQ passes its
raw-spectra estimate down. The adaptive widening (decoy estimability) remains a
separate mechanism on top. Derived values and local-sigma percentile diagnostics
are logged.
Validation: synthetic ground-truth entrapment keeps the realised FDR bounded
(0.01 vs nominal 0.05) under auto sizing; real PXD016921 reproduces/exceeds the
hand-tuned result (RT target/decoy AUC 0.55 -> 0.63), with the cap auto-adapting
from ~9 s (synthetic, sigma ~2 s) to ~260 s (real, sigma P90 ~87 s). The
short/long/sparse/low-sigma synthetic stress matrix is a planned follow-up (no
real long-gradient dataset on hand).
Params (advanced): local_rt:auto, local_rt:median_fwhm. Adds an auto-path FDR
assertion to PipEchoAlgorithm_realistic_test.
Co-Authored-By: Claude Opus 4.8 <[email protected]>
…, dup anchors, rng) Codex review of the local-RT / auto commits: - HIGH: decoy-donor RT separation used the WIDENED window, so adaptive widening pushed decoy donors farther away -- opposing the decoy generation it is meant to achieve. Use the base (un-widened) local window for the separation. - target_decoy_count() returns 0 when fdr>=1.0 (FDR control disabled), so auto / widening no longer widens to satisfy a decoy requirement that does not apply. - build_local_rt_model takes one robust anchor per peptide (median RT over duplicate seq+charge features) per run, so duplicate features cannot inject arbitrary residuals that inflate the local-sigma tail driving the auto cap. - Reseed the decoy RNG and reset the local-RT diagnostic counters at the start of each (re-)match pass, so each pass is independent of discarded widening passes and the final log/result describe the retained pass. Baseline path stays byte-identical; PipEchoAlgorithm_test and the realistic entrapment test (local + auto paths) still pass with bounded realised FDR. Co-Authored-By: Claude Opus 4.8 <[email protected]>
Parameterizes the synthetic entrapment generator (RT span, local scatter, run shift) and adds a stress matrix over short / long / sparse / low-sigma gradient regimes -- span, scatter, shift, anchor density and FWHM scaled together. Each runs local_rt:auto and asserts the realised FDR stays bounded against ground truth and sensitivity is preserved with ONE config; the derived windows differ per regime (cap ~4 / 8.6 / 17 / 69 s), which a single fixed window could not satisfy. The adaptive-widening ceiling (distance_RT:max_difference) is set per regime as ProteomicsLFQ does (2*max_align + 2*fwhm), since a too-tight global ceiling caps widening below decoy estimability on long gradients. Co-Authored-By: Claude Opus 4.8 <[email protected]>
…agreement) On the local adaptive RT path, convert the signed RT residual from the locally predicted acceptor RT into a [0,1] agreement score (rt_score) via the two-tailed CDF against a data-driven, per-run-pair RT prediction-error distribution built leave-one-out from shared anchors (FlashLFQ AddRtPredErrorDistribution). The calibrated score replaces the raw rt_diff_error SVM predictor and is folded into the bootstrap geometric mean. Controlled by the advanced param local_rt:rt_score (raw|svm|svm_and_mbr, default svm_and_mbr); only active when local_rt:enabled. The global/baseline path stays Raw and byte-identical (PipEchoAlgorithm_test). Sparse run pairs with no estimable RT distribution get a neutral score and are excluded from the geometric mean (no hard penalty), preserving decoy exchangeability; the decoy is re-anchored through the same per-pair model, so the target/decoy null is unchanged. Benchmarks (design + results iterated with Codex): - Real PXD016921 single-cell (local auto, fdr 0.10): mbr target/decoy AUC 0.735 -> 0.773, rt residual AUC 0.631 -> 0.680; transfers/decoys unchanged (FDR-neutral). SVM-only calibration was neutral (rt_score AUC 0.608 < raw 0.631, identical transfers) -> the gain comes from the geometric mean, not the SVM column. - Synthetic entrapment ground truth: realized FDR improves across base/auto/short/long/sparse/low-sigma (e.g. local 0.0105 -> 0.0088, sparse 0.0195 -> 0.0144) with more correct and fewer false transfers, all well below nominal; sensitivity preserved. Co-Authored-By: Claude Opus 4.8 <[email protected]>
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughPIP-ECHO now carries a local RT scoring mode through its scoring contracts, predictor wiring, and ProteomicsLFQ parameter plumbing. The change also adds isotope-envelope support, a mass-error validity guard, and documentation for the new default RT behavior. ChangesPIP-ECHO scoring contracts
Local RT state and predictor wiring
Upstream parameter plumbing and guards
Possibly related PRs
Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (9)
src/openms/source/ANALYSIS/MAPMATCHING/PipEchoAlgorithm.cpp (2)
261-274: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick winReplace
std::endlwith\nin the new log statements.These messages do not need an explicit flush.
As per coding guidelines, “Avoid
std::endland use\ninstead for performance reasons.”Proposed cleanup
- OPENMS_LOG_INFO << "[LOCAL-RT] " << decoys << " decoy transfers (>= " << target_decoys - << " needed) at widen x" << widen << "; FDR estimable." << std::endl; + OPENMS_LOG_INFO << "[LOCAL-RT] " << decoys << " decoy transfers (>= " << target_decoys + << " needed) at widen x" << widen << "; FDR estimable.\n"; @@ - OPENMS_LOG_WARN << "[LOCAL-RT] widened the local RT window to the global ceiling but only " - << decoys << " decoy transfer(s) (< " << target_decoys - << " needed); the conservative FDR gate may drop transfers." << std::endl; + OPENMS_LOG_WARN << "[LOCAL-RT] widened the local RT window to the global ceiling but only " + << decoys << " decoy transfer(s) (< " << target_decoys + << " needed); the conservative FDR gate may drop transfers.\n"; @@ - OPENMS_LOG_INFO << "[LOCAL-RT] only " << decoys << " decoy transfer(s) (< " << target_decoys - << " needed); widening local RT window x" << widen << " and re-matching." << std::endl; + OPENMS_LOG_INFO << "[LOCAL-RT] only " << decoys << " decoy transfer(s) (< " << target_decoys + << " needed); widening local RT window x" << widen << " and re-matching.\n";🤖 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/PipEchoAlgorithm.cpp` around lines 261 - 274, The new LOCAL-RT log statements in PipEchoAlgorithm use std::endl unnecessarily; update the OPENMS_LOG_INFO and OPENMS_LOG_WARN messages in the widening/FDR gating block to end with newline characters instead, without forcing a flush. Keep the existing message text and control flow unchanged, and replace std::endl in the relevant log outputs with '\n'.Source: Coding guidelines
218-232: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winUse
Sizefor OpenMS counters and avoid floating-pointstd::powhere.These counters are size/count values, and
runs.size()is an STL container size; keeping this inSizealso avoids the integer→double→integer conversion instd::pow.As per coding guidelines, “Use OpenMS primitive types from
OpenMS/CONCEPT/Types.hinstead of standard C++ types” and “UseSizeandSignedSizetypes for STL container.size()values.”Proposed cleanup
- const std::size_t target_decoys = impl.target_decoy_count(); + const Size target_decoys = static_cast<Size>(impl.target_decoy_count()); @@ - std::size_t progress {}; + Size progress = 0; + const Size total_pairs = static_cast<Size>(runs.size() * runs.size()); logger.setLogType(ProgressLogger::CMD); - logger.startProgress(0, std::pow(runs.size(), 2), "matching donors and acceptors"); + logger.startProgress(0, total_pairs, "matching donors and acceptors"); @@ - std::size_t decoys = 0; + Size decoys = 0;Also applies to: 254-258
🤖 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/PipEchoAlgorithm.cpp` around lines 218 - 232, Use OpenMS Size counters instead of std::size_t/double in PipEchoAlgorithm. Update the target_decoys and progress variables (and any related loop counters in the matching pass) to use Size/SignedSize from OpenMS/CONCEPT/Types.h, and replace the std::pow(runs.size(), 2) usage in ProgressLogger::startProgress with an integer Size-based computation to avoid floating-point conversion. Apply the same cleanup in the later matching block referenced by the review, keeping the logic in the matching loop and logger setup unchanged.Source: Coding guidelines
src/tests/class_tests/openms/source/PipEchoAlgorithm_realistic_test.cpp (1)
594-596: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winUse OpenMS logging here instead of
std::cout.These new diagnostics introduce a direct-console pattern in a file that otherwise follows the OpenMS test infrastructure.
Example rewrite
- std::cout << "[local_rt fdr=0.05] transfers=" << s.n_transfers - << " correct=" << s.n_correct << " false=" << s.n_false - << " realized_FDR=" << realized << "\n"; + OPENMS_LOG_INFO << "[local_rt fdr=0.05] transfers=" << s.n_transfers + << " correct=" << s.n_correct << " false=" << s.n_false + << " realized_FDR=" << realized << '\n';As per coding guidelines,
**/*.{h,hpp,cpp}:Use OpenMS logging macros and OpenMS::LogStream instead of std::cout or std::cerr directly.Also applies to: 621-623, 667-670
🤖 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/tests/class_tests/openms/source/PipEchoAlgorithm_realistic_test.cpp` around lines 594 - 596, Replace the direct console diagnostics in PipEchoAlgorithm_realistic_test with OpenMS logging instead of std::cout. Update the local_rt reporting and the other affected print blocks in the same test file to use the existing OpenMS test logging infrastructure (for example the LogStream/macros used elsewhere in OpenMS tests) so the messages follow the project’s standard output handling.Source: Coding guidelines
src/openms/source/ANALYSIS/MAPMATCHING/PIPECHO/Util.h (1)
42-49: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAdd
@briefto the new API comment.The new header declaration is documented, but not in the repo-required Doxygen form. As per coding guidelines, "
**/*.h: Add Doxygen documentation with@brieftag (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 new `feature_obs_envelope(const Feature&)` API comment in `Util.h` needs to follow the repo’s Doxygen header style by adding an `@brief` tag at the start. Update the existing block comment so it begins with a concise `@brief` summary, then keep a blank line before the longer description of the `pipecho_obs_envelope` meta value and `ProteomicsLFQ` provenance.Source: Coding guidelines
src/openms/source/ANALYSIS/MAPMATCHING/PIPECHO/Impl.cpp (1)
310-314: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick winUse
'\n'in the new log sites.Each of these statements forces an unnecessary flush through
std::endl. As per coding guidelines, "**/*.cpp: Avoidstd::endland use\ninstead for performance reasons`."Also applies to: 332-334, 394-395, 443-447, 693-695
🤖 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/Impl.cpp` around lines 310 - 314, The new logging statements in the PIP-ECHO implementation use std::endl, which forces an unnecessary flush; update the OPENMS_LOG_INFO log sites in the PIP-ECHO code to use '\n' instead. Apply the same change to all matching log calls in the Impl.cpp flow (including the MBR logging blocks and the other listed log sites), keeping the message content unchanged while removing the flush-triggering endl.Source: Coding guidelines
src/openms/source/ANALYSIS/MAPMATCHING/PIPECHO/Impl.h (1)
67-100: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winBring the new LOCAL-RT helpers in line with the header style contract.
These blocks are missing
@brief,set_widen_factor(double w)still does not document the multiplier range, and the inline helper bodies keep braces on the same line. As per coding guidelines, "**/*.h: Add Doxygen documentation with@brieftag (required), followed by blank line and details", "Document method parameters with ranges and units in code comments or Doxygen documentation", and "Place opening and closing braces on their own lines, aligned with the surrounding code`."🤖 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/Impl.h` around lines 67 - 100, The new LOCAL-RT helpers in Impl.h do not follow the header documentation/brace style contract. Update the Doxygen comments for set_local_rt_model, estimate_auto_params, local_rt_enabled, target_decoy_count, set_widen_factor, and widen_ceiling to include required `@brief` entries and parameter range/unit details where applicable, especially for set_widen_factor(double w). Also move the inline function braces onto their own lines to match the surrounding header style.Source: Coding guidelines
src/openms/source/ANALYSIS/MAPMATCHING/PIPECHO/Score.h (1)
15-25: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAdd
@briefto the new header Doxygen blocks.These new docs are still plain prose blocks, so they do not meet the repository’s header Doxygen contract. As per coding guidelines, "
**/*.h: Add Doxygen documentation with@brieftag (required), followed by blank line and details`."Also applies to: 55-68
🤖 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/Score.h` around lines 15 - 25, The new header documentation block in the Score-related header is plain prose and needs to follow the repository Doxygen contract. Update the comment attached to the retention-time feature description in Score.h to start with an `@brief` line, then add a blank line before the remaining detailed bullets. Keep the existing content, but format it as proper header Doxygen so it matches the required style for the Score documentation block and any similar blocks in the same header.Source: Coding guidelines
src/openms/source/ANALYSIS/MAPMATCHING/PIPECHO/RunStatistics.h (1)
31-51: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAdd
@briefto the new/updated header docs.The updated Doxygen blocks should use the required
@briefform and keep the details after a blank line.Proposed fix
- /// Score the given donor and acceptor. + /// `@brief` Score the given donor and acceptor. /// /// For decoy candidates the donor is hypothetically eluting at a randomised- /// Isotope-distribution agreement score for a donor/acceptor pair: the Pearson - /// correlation between the acceptor's observed isotope envelope and the donor + /// `@brief` Calculate isotope-distribution agreement for a donor/acceptor pair. + /// + /// Uses the Pearson correlation between the acceptor's observed isotope envelope and the donorAs per coding guidelines,
**/*.h: “Add Doxygen documentation with@brieftag (required), followed by blank line and details.”Also applies to: 78-84
🤖 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 31 - 51, The Doxygen comment for RunStatistics::score is missing the required `@brief` tag. Update the header documentation to start with a concise `@brief` summary, then keep the existing detailed description after a blank line, and apply the same Doxygen format to the other updated header docs in this area as well.Source: Coding guidelines
src/openms/source/ANALYSIS/MAPMATCHING/PIPECHO/TransferFDRModel.h (1)
146-151: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winUse
@brieffor the new header member docs.Proposed fix
- /// Whether the RT predictor is the CALIBRATED rt_score ([0,1] agreement) rather - /// than the raw rt_diff_error. Like ion mobility this is all-or-nothing: true + /// `@brief` Whether the RT predictor uses calibrated RT agreement. + /// + /// Uses the CALIBRATED rt_score ([0,1]) rather than the raw rt_diff_error. + /// Like ion mobility this is all-or-nothing: trueAs per coding guidelines,
**/*.h: “Add Doxygen documentation with@brieftag (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/TransferFDRModel.h` around lines 146 - 151, The new header member documentation for use_rt_score_ needs to follow the Doxygen header style by adding an `@brief` tag and a blank line before the detailed explanation. Update the comment block in TransferFDRModel around the use_rt_score_ member so the first sentence is a concise `@brief` summary, then keep the existing details below it in the same comment. Ensure the formatting matches the rest of the header documentation conventions.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.
Inline comments:
In `@src/openms/source/ANALYSIS/MAPMATCHING/PIPECHO/Util.cpp`:
- Around line 93-96: The ppm calculation in the m/z helper currently only
validates the peptide-derived observed value before falling back, but still
returns a value even when the fallback feature m/z or the theoretical m/z is
invalid. Update the logic in the utility that computes PPM from hit/feature data
to recheck both the final observed value and the theoretical value before
calling Math::getPPM, and return nullopt whenever either input is non-finite or
non-positive.
In `@src/tests/class_tests/openms/source/PipEchoAlgorithm_realistic_test.cpp`:
- Around line 155-158: The synthetic `run_shift` in
`PipEchoAlgorithm_realistic_test` is only being applied to peptide-derived RTs,
while the noise/false-transfer path still uses the unshifted `u_rt(rng)`. Update
the test logic where `run_shift[r]` is computed and consumed so the same per-run
shift also offsets the noise features, keeping the acceptor RT distribution
scaled consistently across stress-matrix regimes.
---
Nitpick comments:
In `@src/openms/source/ANALYSIS/MAPMATCHING/PIPECHO/Impl.cpp`:
- Around line 310-314: The new logging statements in the PIP-ECHO implementation
use std::endl, which forces an unnecessary flush; update the OPENMS_LOG_INFO log
sites in the PIP-ECHO code to use '\n' instead. Apply the same change to all
matching log calls in the Impl.cpp flow (including the MBR logging blocks and
the other listed log sites), keeping the message content unchanged while
removing the flush-triggering endl.
In `@src/openms/source/ANALYSIS/MAPMATCHING/PIPECHO/Impl.h`:
- Around line 67-100: The new LOCAL-RT helpers in Impl.h do not follow the
header documentation/brace style contract. Update the Doxygen comments for
set_local_rt_model, estimate_auto_params, local_rt_enabled, target_decoy_count,
set_widen_factor, and widen_ceiling to include required `@brief` entries and
parameter range/unit details where applicable, especially for
set_widen_factor(double w). Also move the inline function braces onto their own
lines to match the surrounding header style.
In `@src/openms/source/ANALYSIS/MAPMATCHING/PIPECHO/RunStatistics.h`:
- Around line 31-51: The Doxygen comment for RunStatistics::score is missing the
required `@brief` tag. Update the header documentation to start with a concise
`@brief` summary, then keep the existing detailed description after a blank line,
and apply the same Doxygen format to the other updated header docs in this area
as well.
In `@src/openms/source/ANALYSIS/MAPMATCHING/PIPECHO/Score.h`:
- Around line 15-25: The new header documentation block in the Score-related
header is plain prose and needs to follow the repository Doxygen contract.
Update the comment attached to the retention-time feature description in Score.h
to start with an `@brief` line, then add a blank line before the remaining
detailed bullets. Keep the existing content, but format it as proper header
Doxygen so it matches the required style for the Score documentation block and
any similar blocks in the same header.
In `@src/openms/source/ANALYSIS/MAPMATCHING/PIPECHO/TransferFDRModel.h`:
- Around line 146-151: The new header member documentation for use_rt_score_
needs to follow the Doxygen header style by adding an `@brief` tag and a blank
line before the detailed explanation. Update the comment block in
TransferFDRModel around the use_rt_score_ member so the first sentence is a
concise `@brief` summary, then keep the existing details below it in the same
comment. Ensure the formatting matches the rest of the header documentation
conventions.
In `@src/openms/source/ANALYSIS/MAPMATCHING/PIPECHO/Util.h`:
- Around line 42-49: The new `feature_obs_envelope(const Feature&)` API comment
in `Util.h` needs to follow the repo’s Doxygen header style by adding an
`@brief` tag at the start. Update the existing block comment so it begins with a
concise `@brief` summary, then keep a blank line before the longer description
of the `pipecho_obs_envelope` meta value and `ProteomicsLFQ` provenance.
In `@src/openms/source/ANALYSIS/MAPMATCHING/PipEchoAlgorithm.cpp`:
- Around line 261-274: The new LOCAL-RT log statements in PipEchoAlgorithm use
std::endl unnecessarily; update the OPENMS_LOG_INFO and OPENMS_LOG_WARN messages
in the widening/FDR gating block to end with newline characters instead, without
forcing a flush. Keep the existing message text and control flow unchanged, and
replace std::endl in the relevant log outputs with '\n'.
- Around line 218-232: Use OpenMS Size counters instead of std::size_t/double in
PipEchoAlgorithm. Update the target_decoys and progress variables (and any
related loop counters in the matching pass) to use Size/SignedSize from
OpenMS/CONCEPT/Types.h, and replace the std::pow(runs.size(), 2) usage in
ProgressLogger::startProgress with an integer Size-based computation to avoid
floating-point conversion. Apply the same cleanup in the later matching block
referenced by the review, keeping the logic in the matching loop and logger
setup unchanged.
In `@src/tests/class_tests/openms/source/PipEchoAlgorithm_realistic_test.cpp`:
- Around line 594-596: Replace the direct console diagnostics in
PipEchoAlgorithm_realistic_test with OpenMS logging instead of std::cout. Update
the local_rt reporting and the other affected print blocks in the same test file
to use the existing OpenMS test logging infrastructure (for example the
LogStream/macros used elsewhere in OpenMS tests) so the messages follow the
project’s standard output handling.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: b7ea7a84-0f4f-4996-8b22-1c44525fc648
📒 Files selected for processing (12)
src/openms/source/ANALYSIS/MAPMATCHING/PIPECHO/Impl.cppsrc/openms/source/ANALYSIS/MAPMATCHING/PIPECHO/Impl.hsrc/openms/source/ANALYSIS/MAPMATCHING/PIPECHO/RunStatistics.cppsrc/openms/source/ANALYSIS/MAPMATCHING/PIPECHO/RunStatistics.hsrc/openms/source/ANALYSIS/MAPMATCHING/PIPECHO/Score.hsrc/openms/source/ANALYSIS/MAPMATCHING/PIPECHO/TransferFDRModel.cppsrc/openms/source/ANALYSIS/MAPMATCHING/PIPECHO/TransferFDRModel.hsrc/openms/source/ANALYSIS/MAPMATCHING/PIPECHO/Util.cppsrc/openms/source/ANALYSIS/MAPMATCHING/PIPECHO/Util.hsrc/openms/source/ANALYSIS/MAPMATCHING/PipEchoAlgorithm.cppsrc/tests/class_tests/openms/source/PipEchoAlgorithm_realistic_test.cppsrc/topp/ProteomicsLFQ.cpp
…-rt-window # Conflicts: # src/openms/source/ANALYSIS/MAPMATCHING/PIPECHO/RunStatistics.cpp # src/openms/source/ANALYSIS/MAPMATCHING/PIPECHO/Score.h
… RT shift, log/type cleanup - Util.cpp feature_mass_error: getPPM was called even when the fallback feature m/z (line 95) or the theoretical m/z (getPPM's denominator) was invalid. Guard both the final observed and the theoretical value and return nullopt if either is non-finite or non-positive, so a degenerate m/z can no longer feed a garbage PPM into the mass-error SVM feature / geometric-mean score. No change on valid data (both inputs are then finite/positive and it falls through to the same getPPM call). - PipEchoAlgorithm_realistic_test: the synthetic per-run systematic RT shift (run_shift) was applied to peptide-derived features but not to the noise / false-transfer features, so their acceptor RT distribution drifted apart under non-zero shift. Apply the same run_shift[r] to the noise RTs. - Impl.cpp / PipEchoAlgorithm.cpp: replace std::endl with '\n' in the OPENMS_LOG sites (message text unchanged; avoids the per-line flush). - PipEchoAlgorithm.cpp: use OpenMS Size for the decoy/progress counters and compute the progress total as runs.size() * runs.size() instead of std::pow(runs.size(), 2) (integer, no float round-trip). Co-Authored-By: Claude Opus 4.8 <[email protected]>
… geomean arity) The calibrated RT-agreement score was folded into the mbr_score geometric mean only for run pairs whose local RT prediction-error distribution could be estimated (>=4 locally-dense shared anchors). Anchor-sparse pairs (e.g. a negative-control run) omitted the factor, so their mbr_score was a geomean over fewer factors and thus not comparable to other pairs' -- yet mbr_score is compared across donor runs when selecting an acceptor's transferred identity (Acceptor::push_back) and when ranking the pooled target pool in the transfer-FDR q-value fallback. On real single-cell data 3/42 run pairs hit this (all negative-control-involved). build_rt_error_dist() now always yields a distribution for a calibrated pair: per-anchor prediction errors use the same centring predict() applies (unshifted when an anchor has no local neighbours, else the local median shift), and a generous window-scale default backs pairs with too few anchors or a degenerate spread. The RT factor is therefore folded uniformly, keeping the geomean's factor count constant across pairs. Mirrors FlashLFQ/PIP-ECHO (Solivais et al., J. Proteome Res. 2025), which substitutes a default Normal rather than dropping the RT factor. The Raw/baseline path is unchanged (byte-identical). Verified on single-cell PXD016921 (auto, svm_and_mbr): 42/42 pairs now fold, transfers essentially unchanged (3436 vs 3437 acceptors / 358 vs 354 decoys), and the realistic entrapment slow test passes including the sparse stress regime. Co-Authored-By: Claude Opus 4.8 <[email protected]> Claude-Session: https://claude.ai/code/session_01HcY3LMYuUDF2psYat9uUYN
…uto = true) Make the local adaptive RT window the default for PIP-ECHO MBR: local_rt:enabled and local_rt:auto now default to true, so '-pip_echo true' uses the data-driven local window (the reference FlashLFQ/PIP-ECHO behaviour, Solivais et al. 2025) instead of the single global RT window. On single-cell PXD016921 this cuts negative-control (Blank) false transfers ~19x (76 -> 4) at equal genuine recovery. The legacy global window remains available via '-PipEcho:local_rt:enabled false' (byte-identical to the previous default). Tests: the global-window baseline cases in PipEchoAlgorithm_test and PipEchoAlgorithm_realistic_test are pinned to local_rt:enabled=false so they keep covering the global path; the manual-window case is pinned to local_rt:auto=false so both the manual and auto local-RT paths stay covered. Added assertions for the new defaults. Co-Authored-By: Claude Opus 4.8 <[email protected]> Claude-Session: https://claude.ai/code/session_01HcY3LMYuUDF2psYat9uUYN
… fixed 120 s floor) On the local adaptive RT path the decoy-donor RT separation was max(2*half, 120 s). The fixed 120 s floor is a large fraction of a short gradient and starves decoys there (adaptive widening cannot recover them, since it only enlarges the acceptor gate, not the decoy-donor eligibility). Scale the separation with the local window instead -- 4*half-window, matching FlashLFQ/PIP-ECHO (Solivais et al. 2025, Alg. 13: separation = 2*Width = 4*half) -- so it shrinks on well-aligned/short gradients and grows on wide ones, with no fixed floor. Verified on single-cell PXD016921 (local-RT default): transfers unchanged (3434 acceptors), decoys stay well above the estimability floor (338 >= 20, single pass); the realistic entrapment + cross-gradient stress matrix pass with bounded FDR. Co-Authored-By: Claude Opus 4.8 <[email protected]> Claude-Session: https://claude.ai/code/session_01HcY3LMYuUDF2psYat9uUYN
…BR default Co-Authored-By: Claude Opus 4.8 <[email protected]> Claude-Session: https://claude.ai/code/session_01HcY3LMYuUDF2psYat9uUYN
…-rt-window # Conflicts: # CHANGELOG
Summary
Makes the local adaptive retention-time window the default for PIP-ECHO match-between-runs (MBR) in
ProteomicsLFQ(-pip_echo true). For each donor the expected acceptor RT is predicted per (donor-run, acceptor-run) pair from peptides identified in both runs (shared anchors), and the candidate search is gated to a tight, data-driven window (c·σ_local, auto-sized across gradients) instead of the single global RT window sized from the global worst-case post-alignment residual (±~1200 s on poorly-aligned data).Why default
PIP-ECHO's single global RT window admits RT-implausible transfers (an ID attached to a same-mass feature eluting far from the peptide's true RT). Those carry flat, near-anchor intensities that compress fold-changes and add background. The local window rejects them. It is also the reference PIP-ECHO/FlashLFQ behaviour (Solivais et al., J. Proteome Res. 2025, DOI 10.1021/acs.jproteome.5c00065, SI Alg. 4/5/11/13); the global window was the OpenMS-specific fallback.
Validation
Single-cell (PXD016921, 7 runs), one binary, GLOBAL vs local-RT (default):
The reduced raw transfer count is exactly the RT-implausible/false subset (raw completeness rewards fabrication; the honest axes are FDR control and CV/dose-response). (UPS1 ratio-accuracy re-run on the current binary is in progress and will be added.)
Robustness fixes included
mbr_scorefor every run pair now (a data-driven distribution backs anchor-poor pairs), so the geomean has a constant factor count across the donor runs it is ranked against — previously anchor-sparse pairs (e.g. negative controls) silently omitted the factor. Mirrors PIP-ECHO Algorithm 11.4·half, per Algorithm 13) instead of a fixed 120 s floor, which starved decoys on short gradients.Tests
PipEchoAlgorithm_test/PipEchoAlgorithm_realistic_test: the global-window baseline cases are pinned tolocal_rt:enabled=false(still cover the global path), the manual-window case toauto=false; new default assertions added. The realistic entrapment + cross-gradient stress matrix pass with bounded FDR and preserved sensitivity.Opt-out / scope
-PipEcho:local_rt:enabled false(byte-identical to the previous default).PipEcho:local_rt:(rt_scoredefaultsvm_and_mbr, plus manual window scales).🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Bug Fixes