Skip to content

[FIX,TOPP,TEST] ProteomicsLFQ: make the fraction's link FWHM a median, not the last file's - #9985

Merged
timosachsenberg merged 1 commit into
developfrom
fix/proteomicslfq-fraction-fwhm
Aug 28, 2026
Merged

timosachsenberg merged 1 commit into
developfrom
fix/proteomicslfq-fraction-fwhm

Conversation

@timosachsenberg

@timosachsenberg timosachsenberg commented Aug 28, 2026 •

Copy link
Copy Markdown
Contributor

What

The feature linker's RT tolerance is derived from a chromatographic FWHM
(distance_RT:max_difference = 2*max_alignment_diff + 2*fwhm, and PIP-ECHO's local_rt window).
That FWHM describes the fraction, but quantifyFraction_ computed it into a variable scoped to
the whole function and read it again after the per-file loop had finished — so it was whichever
run the loop ended on, and the tolerance depended on the order the files were passed in.

It is now the median over the fraction's runs. Feature detection is untouched:
detect:peak_width still uses the current run's own FWHM, which is a genuinely per-run quantity.
Only the fraction-level use changes.

Two related defects with the same shape

  • The per-run value is now scoped to the loop iteration. The "no seed-based estimate
    available, use 30 s" fallback for .d/IM_PEAK fires on == 0.0, so it only ever fired for the
    first file; a later IM_PEAK run in a fraction that also contained a non-IM run silently
    inherited that run's measured FWHM instead.
  • picked_decoy_string_/picked_decoy_prefix_ were overwritten by every input file, so the
    last one silently decided the affix used for picked protein FDR across the whole study. The
    first is now kept and a disagreement is reported: the affix is a property of the FASTA, so two
    files disagreeing means one was searched against a different database and the picked FDR would
    be computed against an affix that does not match half the accessions.

Effect on output

None, on the shipped fixtures — and the values genuinely do move, so this is not vacuous:

fraction per-run FWHMs (s) before (last run) after (median)
1 8.64 / 7.78 / 7.12 7.12 7.78
2 8.68 / 8.77 8.77 8.73

No grouping decision changes, because the tolerance is dominated by 2*max_alignment_diff, which
is floored at 120 s: a ~1.4 s shift in a ~255 s window moves nothing. So the change is justified
by the definition rather than by an observed delta, and the fixtures are not sensitive enough to
show one. No reference file is touched.

Test

Since nothing in the outputs would notice a silent revert to last-file-wins,
TOPP_ProteomicsLFQ_fraction_fwhm asserts the aggregation on the log:
PASS_REGULAR_EXPRESSION pins that it happens over the fraction's 3 runs,
FAIL_REGULAR_EXPRESSION pins that the reported value is not the last run's 7.1x. Matched on
7.1 rather than on the median itself so it does not become brittle to platform differences in
the FWHM estimate.

Verified to fail for its stated reason: with Math::median(...) replaced by run_fwhms.back(),
it reports 7.11529 and goes red; green again on revert.

ctest -R TOPP_ProteomicsLFQ: 72/72 pass (rebased onto develop after #9979/#9982/#9984, so
this includes the new strictly_unique tests).

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes

    • Improved fraction-level retention-time tolerance calculations by using the median chromatographic FWHM across runs.
    • Runs without measurable FWHM now use the standard 30-second fallback consistently.
    • Added warnings when input files specify inconsistent decoy affixes.
  • Tests

    • Added coverage verifying that median FWHM aggregation is correctly reported.

…, not the last file's

The feature linker's RT tolerance is derived from a chromatographic FWHM
(distance_RT:max_difference = 2*max_alignment_diff + 2*fwhm, and PIP-ECHO's
local_rt window). That FWHM is a property of the fraction, but quantifyFraction_
computed it into a variable scoped to the whole function and read it again after
the per-file loop had finished -- so it was whichever run the loop ended on, and
the tolerance depended on the order the files were passed in.

It is now the median over the fraction's runs. Feature detection is untouched:
detect:peak_width still uses the current run's own FWHM, which is a genuinely
per-run quantity. Only the fraction-level use changes.

Two related defects with the same shape:

- The per-run value is now scoped to the loop iteration. The "no seed-based
  estimate available, use 30 s" fallback for .d/IM_PEAK fires on `== 0.0`, so it
  only ever fired for the first file; a later IM_PEAK run in a fraction that also
  contained a non-IM run silently inherited that run's measured FWHM instead.

- picked_decoy_string_/picked_decoy_prefix_ were overwritten by every input file,
  so the last one silently decided the affix used for picked protein FDR over the
  whole study. The first is now kept and a disagreement is reported: the affix is
  a property of the FASTA, so two files disagreeing means one was searched against
  a different database and half the accessions will not match.

Measured on the shipped BSA fixtures, the fraction values do move -- fraction 1's
runs are 8.64 / 7.78 / 7.12 s, so 7.12 (last) becomes 7.78 (median), and fraction
2's 8.77 becomes 8.73. No output changes, because the tolerance is dominated by
2*max_alignment_diff, which is floored at 120 s: a ~1.4 s shift in a ~255 s window
changes no grouping decision. The change is therefore justified by the definition
rather than by an observed delta, and the fixtures are not sensitive enough to
show one.

Since nothing in the outputs would notice a silent revert, TOPP_ProteomicsLFQ_
fraction_fwhm asserts the aggregation on the log: PASS_REGULAR_EXPRESSION pins
that it happens over the fraction's 3 runs, FAIL_REGULAR_EXPRESSION pins that the
reported value is not the last run's 7.1x. Verified to fail for its stated reason
-- with median() replaced by back(), it reports 7.11529 and goes red.

TOPP_ProteomicsLFQ suite: 70/70 pass, no reference files touched. The .d/PASEF
tests (DDA_PASEF, DDA_PASEF_biosaur2) cover the IM_PEAK path above.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@coderabbitai

coderabbitai Bot commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 162123e9-2bda-406b-9d8e-fc76dbc0cf2c

📥 Commits

Reviewing files that changed from the base of the PR and between aa003d0 and fa19830.

📒 Files selected for processing (3)
  • CHANGELOG
  • src/tests/topp/CMakeLists.txt
  • src/topp/ProteomicsLFQ.cpp

Included review availability: Your plan provides up to 4 included reviews per hour; 3 remain after this review.


📝 Walkthrough

Walkthrough

Changes

ProteomicsLFQ metric handling

Layer / File(s) Summary
Fraction-level FWHM aggregation
src/topp/ProteomicsLFQ.cpp, src/tests/topp/CMakeLists.txt, CHANGELOG
ProteomicsLFQ computes the median chromatographic FWHM across fraction runs. Per-run default values do not carry over between runs. A CTest validates the reported aggregation, and the changelog records the behavior.
Decoy-affix consistency
src/topp/ProteomicsLFQ.cpp
ProteomicsLFQ retains the first inferred decoy affix and warns when later files provide a different affix.

Sequence Diagram(s)

sequenceDiagram
  participant ProteomicsLFQ
  participant MSRun
  participant alignAndLink_
  ProteomicsLFQ->>MSRun: Measure chromatographic FWHM
  MSRun-->>ProteomicsLFQ: Return per-run FWHM or default
  ProteomicsLFQ->>ProteomicsLFQ: Compute fraction median
  ProteomicsLFQ->>alignAndLink_: Pass fraction FWHM
Loading

Suggested reviewers: cbielow, copilot, satyam102006

Poem

A rabbit counts runs in a neat little row
Their FWHMs form a median flow
The linker gets one steady guide
Decoy affixes stay side by side
And warnings hop where mismatches hide

Merge Risk: 🔵 Low · up to fa198

The change makes fraction-level FWHM aggregation order-independent while preserving per-run feature detection. A bounded data-integrity risk remains because files with conflicting decoy conventions are combined after a warning, using one convention for study-wide picked-protein FDR; the PR is mergeable with explicit owner awareness or follow-up.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 1 files. (2 skipped: 2 … Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ 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: ProteomicsLFQ now uses the fraction-level median FWHM instead of the last processed file's value.
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 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 1 files. (2 skipped: 2 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/proteomicslfq-fraction-fwhm

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 merged commit 61f6fcc into develop Aug 28, 2026
36 checks passed
@timosachsenberg
timosachsenberg deleted the fix/proteomicslfq-fraction-fwhm branch August 28, 2026 19:36
pull Bot pushed a commit to bgruening/OpenMS that referenced this pull request Aug 29, 2026
…fix entry

The median-FWHM entry added by OpenMS#9985 was missing its own PR citation.
The quant-score SVM training shuffle fix (OpenMS#9981/OpenMS#9982) had no entry at all.

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

1 participant