Skip to content

[FIX] ProSE: retain peaks in the short final m/z window - #10357

Merged
timosachsenberg merged 2 commits into
developfrom
codex/prose-final-window
Sep 30, 2026
Merged

timosachsenberg merged 2 commits into
developfrom
codex/prose-final-window

Conversation

@timosachsenberg

@timosachsenberg timosachsenberg commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Split out of #10335, based on develop 2e82a31b966e59c595a4b1e6e29a3fc3abd67bc2.

ProSE's jumping 100-Da peak filter scales the last window's quota by its observed width. A short final window can therefore retain zero peaks, even when it contains a strong fragment; a singleton spectrum can become empty.

This PR adds peaks:window_type=auto. For fragment tolerances ≤0.1 Da or ≤100 ppm it retains the full peaks:window_top quota in the final window. Low-resolution auto keeps the existing filter. jump restores legacy filtering at every resolution; jump_full explicitly uses the full quota everywhere. The existing global peak cap still applies.

Selection preserves integer, float and string data arrays and resolves intensity ties by original peak order. All three preprocessing call sites use the option; requested/resolved modes are recorded in search parameters. Tool documentation and CHANGELOG are updated. No public method signatures or Python bindings change.

Local validation

Built the changed ProSEAlgorithm and current FragmentIndex, HyperScore and TheoreticalSpectrumGenerator sources with GCC 13.3, C++23 and OpenMP. Linked unchanged support code from official pyOpenMS 3.6.0.dev20260930 (reports 3.6.0-pre-nightly-2026-09-29, revision 55f7bdb). This is a targeted source build, not a full clean OpenMS build.

  • ProSEAlgorithm_test: all 34 sections pass.
  • New regression: legacy filtering keeps 2 of 5 peaks; full-quota filtering correctly keeps 4, including both peaks in the short final window.
  • Covers singleton/empty spectra, exact 100-Da boundary, intensity ties, aligned integer/float/string arrays, Da/ppm resolution boundaries and explicit compatibility overrides.
  • Changed C++ regions checked with clang-format 20.1.8; unrelated include/comment reformatting omitted. git diff --check passes.

Also ran the inputs/settings of TOPP ProSE tests 1, 2, 4 and 10 through the source-built algorithm harness, with both auto and legacy filtering. Peptide sequences and scores are unchanged. Updated their idXML references for the two mode parameters and six explained-intensity fractions affected by the additional retained peaks. Parsed output structures and remaining numeric annotations match the references (runtime paths/dates and the existing fragment-annotation whitelist excluded). This does not claim a full TOPP executable build.

Exact tested source tree: 6a5da7c98200f333ad29074ee4d80f1566149f35.

Earlier paired benchmark evidence

The isolated filter was evaluated in #10335 on 20 measurements, 8,000 MS2 each, across seven acquisition groups. Percolator 3.09.0, seeds 1/42/137, per-file q≤0.01. Changes in mean accepted PSMs:

Acquisition Filter-only change
Velos CID 0%
Lumos CID/TMT 0%
HF-X HCD +0.88%
Astral HCD +2.01%
Lumos HCD/LFQ +0.27%
Exploris HCD/TMTpro −0.40%
timsTOF HT −0.83%

Worst individual loss: −1.16% (timsTOF 50 min). All six low-resolution PINs and their seed results were unchanged. These are identification-yield comparisons, not proof of true FDR or absence of regressions. The full benchmark matrix was not rerun on this rebased extraction. Its baseline already contained the earlier auto-scoring changes; the comparison changed only the window filter.

Complete pinned protocol and benchmark manifest · Public reproduction ZIP

The bundle contains public dataset URLs/checksums, sampling code, FASTA construction, exact historical source patches/parameters and expected per-seed counts. To repeat the filter comparison, build baseline and window, then use the broad_benchmark:*:prose_auto and native_gap:*:window_fixed jobs listed by reproduce.py list. Historical experiment sources are pinned separately from this extraction.

Reproduce this PR's targeted local build and tests

On Linux x86_64 with g++-13, make, git, curl, Python 3.12, unzip and the required runtime libraries:

curl -fL https://raw.githubusercontent.com/OpenMS/OpenMS/a5705ec8e1cb19d40ebfa7bb16f6b5651aa1dc65/benchmark-reproduction/prose-andes/prose-andes-reproduction.zip -o reproduction.zip
echo 'e24cbe748001df4e77bd03b98b2bc47d18463948a6ce05e6f1f422806f5075b2  reproduction.zip' | sha256sum -c -
unzip reproduction.zip
cd prose-andes-reproduction
sha256sum -c MANIFEST.sha256
git clone --branch codex/prose-final-window https://github.com/OpenMS/OpenMS.git OpenMS
git -C OpenMS checkout --detach 973ee6b445b3712306b75362465fb51dfa0dc659
python3 -m pip install --target nightly --no-deps --index-url https://pypi.openms.de pyopenms==3.6.0.dev20260930
python3 -m pip install --target deps --no-deps cmake==4.4.3
python3 -m pip install --target header_deps --no-deps cmeel-boost==1.84.0 cmeel-eigen==3.4.0.2
python3 - <<'PY'
from pathlib import Path
import re
p = Path("native_cid/include/OpenMS/test_config.h")
data = str(Path("OpenMS/src/tests/class_tests/openms/data").resolve()) + "/"
p.write_text(re.sub(r'"[^"]*/src/tests/class_tests/openms/data/"', '"' + data + '"', p.read_text()))
PY
export OPENMS_DATA_PATH="$PWD/nightly/pyopenms/share/OpenMS"
export OMP_NUM_THREADS=2
deps/cmake/data/bin/cmake -S native_cid -B build-window -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_COMPILER=g++-13 -DOPENMS="$PWD/OpenMS"
deps/cmake/data/bin/cmake --build build-window --target ProSEAlgorithm_test -j2
deps/cmake/data/bin/ctest --test-dir build-window -R '^ProSEAlgorithm_test$' --output-on-failure

The original harness defines additional targets for #10335; only the target above is needed for this extraction.

Summary by CodeRabbit

  • Bug Fixes

    • High-resolution ProSE searches now retain strong peaks in short final 100 Da windows.
    • Peak-associated data remains correctly aligned during filtering.
    • Low-resolution filtering behavior remains unchanged.
  • New Features

    • Added configurable peak-window modes: auto, jump, and jump_full.
    • auto selects filtering based on fragment tolerance; jump_full retains the full peak quota in each window.
  • Documentation

    • Added guidance on peak-filtering modes and their effects on preprocessing.

@coderabbitai

coderabbitai Bot commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

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: 814ced75-0743-4edf-9539-e7638c41578b

📥 Commits

Reviewing files that changed from the base of the PR and between 978e366 and 973ee6b.

📒 Files selected for processing (4)
  • src/tests/topp/ProSE_10_out.idXML
  • src/tests/topp/ProSE_1_out.idXML
  • src/tests/topp/ProSE_2_out.idXML
  • src/tests/topp/ProSE_4_out.idXML

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

Walkthrough

ProSE adds configurable local peak filtering for 100 Da windows. The auto mode selects full-quota filtering for supported high-resolution fragment tolerances and retains legacy filtering otherwise. Search metadata records the configured and resolved modes, and tests cover peak selection and aligned data arrays.

Changes

ProSE peak filtering

Layer / File(s) Summary
Configure and apply window filtering
src/openms/include/OpenMS/ANALYSIS/ID/ProSEAlgorithm.h, src/openms/source/ANALYSIS/ID/ProSEAlgorithm.cpp
Adds the peaks:window_type option (auto, jump, or jump_full). Full-quota filtering selects the strongest peaks in each 100 Da window, including a short final window, while preserving associated arrays. The option is passed through the search paths, and metadata records its configured and resolved values.
Verify and document filtering behavior
src/tests/class_tests/openms/source/ProSEAlgorithm_test.cpp, src/topp/ProSE.cpp, CHANGELOG, src/tests/topp/ProSE_*_out.idXML
Tests check retained peaks, array alignment, tolerance and mode combinations, and empty or singleton spectra. The ProSE documentation and changelog describe the filtering modes. TOPP test outputs record the window mode and updated matched-ion-current fractions.

Sequence Diagram(s)

sequenceDiagram
  participant ProSEAlgorithm
  participant preprocessSpectra_
  participant filterLocalPeaks_
  participant WindowMower
  ProSEAlgorithm->>preprocessSpectra_: pass window_type and fragment tolerance
  preprocessSpectra_->>preprocessSpectra_: resolve filtering mode
  alt Full quota per window
    preprocessSpectra_->>filterLocalPeaks_: select peaks by local intensity quota
  else Legacy filtering
    preprocessSpectra_->>WindowMower: apply existing window filtering
  end
Loading

Suggested reviewers: claude

Priority: ➖ Normal

Change: Bug fix

Merge Risk: ⚪ Minimal · up to 973ee

The filtering behavior and search-path configuration align with the documented change, and regression tests and TOPP golden comparisons cover the behavior. No material merge risk was established; proceed with normal project checks.

Architecture Summary

Architecture risk: 🔵 Low · up to 973ee

The change affects 2 systems.

Changed systems: src, CHANGELOG

Architecture concerns
No architecture-level concerns identified.

Review details

Systems and components

  • observed — src (service) was modified; 8 changed files map to changed impact.
  • observed — CHANGELOG (service) was modified; 1 changed file maps to changed impact.

Before / after behavior

  • observed — Modified behavior in CHANGELOG: Added the ProSE release-note entry describing final-window peak filtering: auto keeps the full quota at ≤0.1 Da or ≤100 ppm, low-resolution filtering is unchanged, jump restores the prior filter, and jump_full forces the full quota; associated data arrays stay aligned.
  • observed — Modified behavior in src/openms/include/OpenMS/ANALYSIS/ID/ProSEAlgorithm.h: preprocessSpectra_ adds a window_type argument defaulting to "auto". A new filterLocalPeaks_ helper is declared to keep the strongest peaks per 100 Da window, including a short final window.
  • observed — Modified behavior in src/openms/include/OpenMS/ANALYSIS/ID/ProSEAlgorithm.h: Adds peaks_window_type_, defaulting to "auto", for configuring treatment of the final peak window.
  • observed — Modified behavior in src/openms/source/ANALYSIS/ID/ProSEAlgorithm.cpp: Adds the standard <numeric> include used by the local peak-filtering implementation.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 46.15% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 13 functions across 4 files. (4 skipped: … 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: retaining peaks in the short final m/z window for ProSE.
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 46.15% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 13 functions across 4 files. (4 skipped: 4 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Autopilot is currently an internal CodeRabbit preview.


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 the peaks in rows,
Through hundred-dalton windows it goes.
The last short patch keeps its share,
And aligned arrays travel there.
Three modes guide the filtering spree,
Then the rabbit hops off happily.

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

@timosachsenberg
timosachsenberg merged commit b906aec into develop Sep 30, 2026
13 checks passed
@timosachsenberg
timosachsenberg deleted the codex/prose-final-window branch September 30, 2026 16:22
timosachsenberg pushed a commit that referenced this pull request Oct 1, 2026
Resolves the conflicts with the two ProSE changes that landed on develop
after this branch's last develop merge: #10357 (peaks:window_type, the
same final-window retention this branch carried; the develop text and the
richer develop test are kept, the branch's duplicate CHANGELOG bullet is
dropped) and #10358 (peptide:clip_nterm_methionine, kept alongside this
branch's peptide:deduplicate and fragment:query_spectrum parameters).

Also documents the evidence_spectra parameter of postProcessHits_, which
Doxygen_Warning_test flagged.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01UGKGwMtvsf72yELV4xNmAQ
timosachsenberg pushed a commit that referenced this pull request Oct 1, 2026
…rences

The references from develop (refreshed there for #10357 and #10358) lack the
search-parameter entries this branch writes: scoring:method,
scoring:method_resolved, scoring:fragment_charges,
scoring:fragment_charges_resolved, scoring:mass_error_sd, fragment:max_charge,
fragment:query_spectrum, peptide:deduplicate and
annotate:local_fragment_evidence; peptide:clip_nterm_methionine moves to the
position this branch writes it at. Every identification, score and
annotation line is unchanged, so only these UserParam lines are added to
ProSE_1_out (also used by the multi-file and chunked tests), ProSE_2_out,
ProSE_4_out and ProSE_10_out.

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