Skip to content

feat(BrukerTimsFile): IM-axis hill centroiding + isotopic prefilter - #9380

Merged
timosachsenberg merged 4 commits into
developfrom
feat/timstof-ppim-extras
May 19, 2026
Merged

timosachsenberg merged 4 commits into
developfrom
feat/timstof-ppim-extras

Conversation

@timosachsenberg

@timosachsenberg timosachsenberg commented May 19, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Migrates the hill-based centroiding work for TIMS-PASEF .d files from feat/timstof-hill-centroiding (#9286) to a fresh branch off develop, dropping the PeakPickerIM-as-Bruker-algo path. Side-by-side ProSE comparisons on HeLa DIA-PASEF showed the mobilogram (PeakPickerIM) variants underperforming hill on PSM count at 1% FDR, so they are intentionally excluded here.

This branch is a successor / replacement for #9286 — same hill code, plus the isotopic-partner prefilter we developed on top of it; minus everything mobilogram-related.

What's in

  • IM-axis hill detection (PASEFHillCentroider) for MS1 and DIA/DDA-MS2 with valley splitting, configurable m/z linking tolerance, min hill length, and max scan gap. Modeled on Biosaur2's hill detection on the IM axis.
  • Greedy2D (legacy 2D box-clustering) retained as back-compat centroider.
  • DIA-MS2 frame aggregation (dia_ms2_n_neighbors) with 3×3 (m/z × IM) denoise, independent of centroiding algo.
  • DDA-MS2 hill path: replaces the default TOF-domain pipeline with IM-axis hill on per-precursor (m/z, intensity, IM) triples; output schema unchanged.
  • Isotopic-partner prefilter (off by default): drops peaks lacking an isotopic partner at m/z ± C13C12/q (q ∈ {1..5}) within ±isotopic_prefilter_tol_ppm (default 50 ppm) AND |Δscan_id| ≤ 1. Mutual-evidence check (both monoisotopic and isotopologue survive). Applied at every centroiding entry point after aggregation; not applied to DDA-MS2.
  • FrameBuffers struct: bundles parallel (mz/intensity/im/scan_ids) vectors with templated in-place filter(Keep) compaction so the prefilter and centroider dispatch operate uniformly across all four call sites.
  • expose_hill_bounds: opt-in attaches four FloatDataArrays per centroided spectrum (im lower/upper bound, m/z lower/upper bound) with each centroid's source-hill bounding box for visual QC.
  • CLI: -bruker:* flags on FileConverter and TOPPPeakPickerIM.
  • Visualization scripts (tools/scripts/plot_pasef_frames.py, visualize_pasef_centroiding.py).
  • Tests: BrukerTimsFile_test integration tests (DDA + DIA hill, frame aggregation, hill-vs-greedy comparisons), PASEFHillCentroider_test unit test. CTest timeout raised to 3600s.

What's NOT in (vs #9286 head)

  • CentroidAlgo::PEAK_PICKER_IM enum value + dispatcher branches
  • PeakPickerIM FWHM bounding-box exposure (PeakPickerIM-specific)
  • PeakPickerIM m/z-projection resampling fix
  • PeakPickerIM-specific visualization tweaks

Test plan

  • Local build (cmake --build OpenMS-build --target OpenMS) — verified ✓
  • BrukerTimsFile_test + PASEFHillCentroider_test pass on CI (locally hits 3600s on a contended dev machine; CI hardware should be clear)
  • Manual smoke: FileConverter -in <.d> -out <.mzML> -bruker:ms1_centroid_algo hillbased -bruker:ms2_centroid_algo hillbased produces sensible centroids
  • Spot-check with -bruker:isotopic_prefilter enabled to confirm prefilter dropout rates match the per-frame INFO log expectations (MS1 ~40-50%, DIA-MS2 ~95-100% on noisy fragments)

Closes

Supersedes #9286 (same hill content + prefilter additions, sans mobilogram path).

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • HillBased centroiding available as alternative to Greedy2D for MS1/MS2 with separate MS1/MS2 algorithm selection
    • Isotopic-partner prefiltering, hill controls (valley split, min hill lengths, max scan-gap, tolerances), and option to export hill bounding-box metadata
    • MS1 default centroid tolerance updated (0 → 10 ppm) and new CLI/tool options to configure hill parameters
    • Two visualization scripts for frame inspection and centroiding comparison
  • Tests

    • Expanded unit and integration tests covering hill vs greedy centroiding (DDA/DIA) and dedicated hill-centroider tests
  • Chores

    • Increased test timeout for real-data runs

Review Change Stack

@coderabbitai

coderabbitai Bot commented May 19, 2026 •

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

Adds a hill-based TIMS-PASEF centroider (PASEFHillCentroider), integrates per-MS-level centroid algorithm selection into BrukerTimsFile with isotopic prefiltering and optional hill-bounds output, refactors MS1/MS2/DIA flows to dispatch Greedy2D vs HillBased, wires CLI options, and adds unit/integration tests plus visualization scripts.

Changes

HillBased PASEF Centroiding

Layer / File(s) Summary
HillBased centroiding algorithm
src/openms/include/OpenMS/FORMAT/HANDLERS/PASEFHillCentroider.h, src/openms/source/FORMAT/HANDLERS/PASEFHillCentroider.cpp, src/openms/include/OpenMS/FORMAT/HANDLERS/sources.cmake, src/openms/source/FORMAT/HANDLERS/sources.cmake
Adds Params and Centroid API and implements centroidFrame with peak filtering, scan-wise linking into hills, pruning by gap, valley-based splitting, centroid computation (m/z, intensity, IM/mz bounds, apex), and sorted output.
Config, headers, and core helpers
src/openms/include/OpenMS/FORMAT/BrukerTimsFile.h, src/openms/source/FORMAT/BrukerTimsFile.cpp
Introduces CentroidAlgo enum and ms1_centroid_algo/ms2_centroid_algo fields plus HillBased tuning fields and isotopic-prefilter options; includes PASEFHillCentroider header and implements FrameBuffers, isotopic prefilter, aggregatorPeaksToBuffers, and algorithm-resolution helpers (effectiveMS1Algo/effectiveMS2Algo).
MS1 centroiding refactoring
src/openms/source/FORMAT/BrukerTimsFile.cpp
Refactors single-frame and aggregated MS1 centroiding to use FrameBuffers, apply isotopic prefilter, dispatch to Greedy2D or HillBased via runMS1Centroider, and optionally attach hill-bounds arrays when enabled.
MS2 centroiding (DDA and DIA)
src/openms/source/FORMAT/BrukerTimsFile.cpp
Adds HillBased DDA-MS2 path (convert TOF→m/z, run PASEFHillCentroider, build centroided MS2 with scalar drift time). Refactors DIA-MS2 aggregated and raw paths to convert peaks to FrameBuffers, optionally apply isotopic prefilter, dispatch via effectiveMS2Algo, and attach hill bounds / set IM centroid metadata accordingly.
CLI options and config wiring
src/topp/FileConverter.cpp, src/topp/PeakPickerIM.cpp
Adds Bruker CLI options for MS1/MS2 centroid algorithm selection (`off
HillBased algorithm unit tests
src/tests/class_tests/openms/source/PASEFHillCentroider_test.cpp
Comprehensive unit tests for centroidFrame covering empty input, single/multiple hills, valley splitting, min_hill_length, max_scan_gap rules, m/z tolerance separation, intensity filtering, determinism, and sorting.
Integration tests for DDA and DIA centroiding
src/tests/class_tests/openms/source/BrukerTimsFile_test.cpp, src/tests/class_tests/openms/CMakeLists.txt, src/tests/class_tests/openms/executables.cmake, src/pyOpenMS/tests/unittests/test_BrukerTimsFile.py
Adds centroiding-statistics helpers, DDA MS2/MS1 and DIA MS1+MS2 Greedy2D vs HillBased comparisons, updates DIA MS2 baseline loading, registers new test executable, increases BrukerTimsFile_test timeout, and updates pyOpenMS expectation for ms1_centroid_mz_ppm default.
Frame visualization and centroiding comparison scripts
tools/scripts/plot_pasef_frames.py, tools/scripts/visualize_pasef_centroiding.py
Adds CLI scripts to render grids/scatterplots of PASEF frames and side-by-side centroiding comparisons, with optional hill-bounds overlays and nativeID-based alignment.

Possibly related issues

Possibly related PRs

  • OpenMS/OpenMS#9129: Related DIA MS2 aggregation/denoise and dia_ms2_n_neighbors interaction.
  • OpenMS/OpenMS#9022: Related PeakPickerIM → BrukerTimsFile configuration wiring for IM-centroiding options.
  • OpenMS/OpenMS#9152: Overlaps MS1 aggregated centroiding dispatch and loadAggregatedMS1Spectrum changes.

Suggested reviewers

  • singjc
  • alhigaylan
  • jcharkow

🐰 I hopped through peaks with tiny paws,

I traced the hills and marked their laws,
Valleys split and apexes gleam,
Frames now plotted in a stream,
Greedy or Hill — pick your dream!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 44.16% which is insufficient. The required threshold is 80.00%. 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 specifically summarizes the main addition: IM-axis hill centroiding algorithm plus isotopic prefilter support for BrukerTimsFile, matching the core features introduced in the changeset.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ 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/timstof-ppim-extras

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 and usage tips.

@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.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/topp/PeakPickerIM.cpp (1)

380-391: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

HillBased centroiding check is incomplete.

The current logic only detects Greedy2D centroiding (requiring both ms1_centroid_mz_ppm > 0 and ms1_centroid_im_pct > 0). With the new ms1_centroid_algo=HILL_BASED option, centroiding can be enabled using only ms1_centroid_mz_ppm without requiring ms1_centroid_im_pct, causing PeakPickerIM to redundantly process already-centroided spectra.

Extend the check to detect any active centroiding algorithm:

Suggested fix
       // If built-in IM centroiding was enabled, BrukerTimsFile already produced
       // IM_CENTROIDED spectra — skip PeakPickerIM and write directly.
-      bool builtin_centroiding = (bruker_config.ms1_centroid_mz_ppm > 0.0f
-                                  && bruker_config.ms1_centroid_im_pct > 0.0f);
+      bool builtin_centroiding = 
+          (bruker_config.ms1_centroid_algo != BrukerTimsFile::Config::CentroidAlgo::OFF) ||
+          (bruker_config.ms1_centroid_mz_ppm > 0.0f && bruker_config.ms1_centroid_im_pct > 0.0f);
🤖 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/topp/PeakPickerIM.cpp` around lines 380 - 391, The builtin centroiding
detection in PeakPickerIM.cpp currently sets builtin_centroiding only when both
bruker_config.ms1_centroid_mz_ppm>0.0f and
bruker_config.ms1_centroid_im_pct>0.0f, which misses the new HILL_BASED option;
change the condition for builtin_centroiding to also be true when
ms1_centroid_mz_ppm>0.0f OR ms1_centroid_im_pct>0.0f OR the configured algorithm
indicates HILL_BASED (i.e., include a check on bruker_config.ms1_centroid_algo
== HILL_BASED or more generally ms1_centroid_algo != NONE), so the early
return/logging block (the if(builtin_centroiding) that calls addDataProcessing_,
MzMLFile().store and returns EXECUTION_OK) will correctly skip PeakPickerIM when
any Bruker centroiding is active.
♻️ Duplicate comments (1)
src/openms/source/FORMAT/BrukerTimsFile.cpp (1)

2949-2952: ⚠️ Potential issue | 🔴 Critical | ⚡ Quick win

Same undefined function calls in raw DIA-MS2 path.

This is the same issue as the aggregated path - runHillCentroider and makeMS2HillParams are not defined.

🤖 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/FORMAT/BrukerTimsFile.cpp` around lines 2949 - 2952, The
call site in the raw DIA-MS2 path is using undefined symbols runHillCentroider
and makeMS2HillParams; fix this by either including the header that declares
these functions or by implementing/renaming them to match the existing
centroider API used elsewhere (search for other uses of
runHillCentroider/makeMS2HillParams in the codebase and mirror their
signatures), update the call to use the correct function names/signatures and
ensure the appropriate prototype is visible at compile time so the linker can
resolve runHillCentroider and makeMS2HillParams.
🧹 Nitpick comments (2)
tools/scripts/visualize_pasef_centroiding.py (1)

65-74: 💤 Low value

Unused parameter want_im_array.

The want_im_array parameter is declared but never used in the function body. Either remove it or implement the intended filtering logic to select only spectra that have per-peak IM arrays.

Option 1: Remove unused parameter
-def first_nonempty(exp, ms_level, want_im_array=True, index=None):
+def first_nonempty(exp, ms_level, index=None):
     """Pick a spectrum at the given MS level. Falls back to first non-empty
     if `index` is None or out of range; returns None if nothing matches."""
🤖 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 `@tools/scripts/visualize_pasef_centroiding.py` around lines 65 - 74, The
parameter want_im_array on first_nonempty is unused; either remove it from the
signature and all callers, or implement filtering when True by only including
spectra that contain per-peak ion-mobility arrays before selecting candidates.
Modify first_nonempty to, when want_im_array is True, check each spectrum
(exp[i]) for the presence of a per-peak IM/float data array (use the project’s
spectrum API methods on exp[i], e.g., checking float data arrays or a named IM
array) and build candidates only from those spectra, otherwise keep the existing
ms_level and non-empty filters; keep the same return behavior and update callers
if you remove the parameter.
src/openms/source/FORMAT/HANDLERS/PASEFHillCentroider.cpp (1)

296-301: 💤 Low value

Potential integer overflow when encoding new hill ID.

When hills.size() approaches INT_MAX, casting to -static_cast<int>(new_hid) - 1 can overflow. With typical PASEF frames (~10^5 peaks), this is unlikely to occur in practice, but the encoding is fragile for very large inputs.

Consider using a separate vector to track new-hill peak indices rather than encoding in the signed integer space.

🤖 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/FORMAT/HANDLERS/PASEFHillCentroider.cpp` around lines 296 -
301, The current sentinel encoding cur_peak_to_tail[i] =
-static_cast<int>(new_hid) - 1 can overflow when hills.size() is large; instead
introduce a separate container (e.g., vector<Size> new_hill_indices or
vector<int> new_hill_peaks) to record newly-created hill indices when you call
append_to_hill(new_hid, mz_cur, cur_int[i], scan_im) and push new_hid into that
container; set cur_peak_to_tail[i] to a safe sentinel (e.g., -1 or a named
constant) rather than encoding new_hid, and update any decoding logic that
previously parsed negative cur_peak_to_tail values to consult the
new_hill_indices container (search for usages of cur_peak_to_tail where negative
values are interpreted and modify them to handle the new vector), leaving
functions like append_to_hill, hills, and the new container as the locating
symbols to change.
🤖 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/FORMAT/BrukerTimsFile.cpp`:
- Around line 2818-2821: The code calls non-existent functions runHillCentroider
and makeMS2HillParams; replace those calls with the actual function
runMS2HillCentroider and pass the existing config object directly (i.e., change
runHillCentroider(makeMS2HillParams(config), buf.mz.data(), ...) to
runMS2HillCentroider(config, buf.mz.data(), ...) and do the same for the other
occurrence), ensuring you use the runMS2HillCentroider signature defined in this
file.

---

Outside diff comments:
In `@src/topp/PeakPickerIM.cpp`:
- Around line 380-391: The builtin centroiding detection in PeakPickerIM.cpp
currently sets builtin_centroiding only when both
bruker_config.ms1_centroid_mz_ppm>0.0f and
bruker_config.ms1_centroid_im_pct>0.0f, which misses the new HILL_BASED option;
change the condition for builtin_centroiding to also be true when
ms1_centroid_mz_ppm>0.0f OR ms1_centroid_im_pct>0.0f OR the configured algorithm
indicates HILL_BASED (i.e., include a check on bruker_config.ms1_centroid_algo
== HILL_BASED or more generally ms1_centroid_algo != NONE), so the early
return/logging block (the if(builtin_centroiding) that calls addDataProcessing_,
MzMLFile().store and returns EXECUTION_OK) will correctly skip PeakPickerIM when
any Bruker centroiding is active.

---

Duplicate comments:
In `@src/openms/source/FORMAT/BrukerTimsFile.cpp`:
- Around line 2949-2952: The call site in the raw DIA-MS2 path is using
undefined symbols runHillCentroider and makeMS2HillParams; fix this by either
including the header that declares these functions or by implementing/renaming
them to match the existing centroider API used elsewhere (search for other uses
of runHillCentroider/makeMS2HillParams in the codebase and mirror their
signatures), update the call to use the correct function names/signatures and
ensure the appropriate prototype is visible at compile time so the linker can
resolve runHillCentroider and makeMS2HillParams.

---

Nitpick comments:
In `@src/openms/source/FORMAT/HANDLERS/PASEFHillCentroider.cpp`:
- Around line 296-301: The current sentinel encoding cur_peak_to_tail[i] =
-static_cast<int>(new_hid) - 1 can overflow when hills.size() is large; instead
introduce a separate container (e.g., vector<Size> new_hill_indices or
vector<int> new_hill_peaks) to record newly-created hill indices when you call
append_to_hill(new_hid, mz_cur, cur_int[i], scan_im) and push new_hid into that
container; set cur_peak_to_tail[i] to a safe sentinel (e.g., -1 or a named
constant) rather than encoding new_hid, and update any decoding logic that
previously parsed negative cur_peak_to_tail values to consult the
new_hill_indices container (search for usages of cur_peak_to_tail where negative
values are interpreted and modify them to handle the new vector), leaving
functions like append_to_hill, hills, and the new container as the locating
symbols to change.

In `@tools/scripts/visualize_pasef_centroiding.py`:
- Around line 65-74: The parameter want_im_array on first_nonempty is unused;
either remove it from the signature and all callers, or implement filtering when
True by only including spectra that contain per-peak ion-mobility arrays before
selecting candidates. Modify first_nonempty to, when want_im_array is True,
check each spectrum (exp[i]) for the presence of a per-peak IM/float data array
(use the project’s spectrum API methods on exp[i], e.g., checking float data
arrays or a named IM array) and build candidates only from those spectra,
otherwise keep the existing ms_level and non-empty filters; keep the same return
behavior and update callers if you remove the parameter.
🪄 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: 67989409-282e-4bbd-aeab-b2e5550f7da4

📥 Commits

Reviewing files that changed from the base of the PR and between ca61ce6 and 5673239.

📒 Files selected for processing (14)
  • src/openms/include/OpenMS/FORMAT/BrukerTimsFile.h
  • src/openms/include/OpenMS/FORMAT/HANDLERS/PASEFHillCentroider.h
  • src/openms/include/OpenMS/FORMAT/HANDLERS/sources.cmake
  • src/openms/source/FORMAT/BrukerTimsFile.cpp
  • src/openms/source/FORMAT/HANDLERS/PASEFHillCentroider.cpp
  • src/openms/source/FORMAT/HANDLERS/sources.cmake
  • src/tests/class_tests/openms/CMakeLists.txt
  • src/tests/class_tests/openms/executables.cmake
  • src/tests/class_tests/openms/source/BrukerTimsFile_test.cpp
  • src/tests/class_tests/openms/source/PASEFHillCentroider_test.cpp
  • src/topp/FileConverter.cpp
  • src/topp/PeakPickerIM.cpp
  • tools/scripts/plot_pasef_frames.py
  • tools/scripts/visualize_pasef_centroiding.py

Brings the hill-based centroiding work for TIMS-PASEF .d files (originally
landed on feat/timstof-hill-centroiding as a sequence of commits including
PeakPickerIM-as-CentroidAlgo) to a fresh branch off develop, keeping only
the hill components and dropping the mobilogram-based path. The
mobilogram (PeakPickerIM-as-Bruker-algo) variants did not perform well on
DIA-PASEF in side-by-side ProSE comparisons against hill centroiding, so
they are intentionally excluded here.

What's in:
  - IM-axis hill detection (PASEFHillCentroider) for MS1 and DIA/DDA-MS2,
    with valley splitting, configurable m/z linking tolerance, min hill
    length, and max scan gap. Modeled on Biosaur2's hill detection
    applied to the IM axis.
  - Greedy2D (legacy 2D box-clustering) path retained as the back-compat
    centroider when ms1_centroid_mz_ppm + ms1_centroid_im_pct both > 0.
  - DIA-MS2 frame aggregation (dia_ms2_n_neighbors) with 3x3 (m/z x IM)
    denoise (dia_ms2_min_support), independent of centroiding algorithm.
  - DDA-MS2 hill path: replaces the default TOF-domain pipeline with
    IM-axis hill detection on per-precursor (m/z, intensity, IM) triples;
    output schema unchanged (still scalar drift_time per spectrum).
  - Optional opt-in isotopic-partner prefilter (off by default) that
    drops peaks lacking an isotopic partner at m/z +/- C13C12_MASSDIFF_U/q
    (q in 1..5) within +/- isotopic_prefilter_tol_ppm (default 50 ppm)
    AND |delta scan_id| <= 1. Cleans up isolated detector-noise
    singletons; mutual-evidence check (both monoisotopic and isotopologue
    survive). Applied at every centroiding entry point after aggregation
    (MS1 + DIA-MS2 paths); not applied to DDA-MS2.
  - FrameBuffers struct: bundles the parallel (mz/intensity/im/scan_ids)
    vectors with a templated in-place filter(Keep) compaction so the
    prefilter and the centroider dispatch operate uniformly across all
    four call sites.
  - expose_hill_bounds: opt-in attaches four FloatDataArrays per
    centroided spectrum ("im lower/upper bound", "m/z lower/upper bound")
    with each centroid's source-hill bounding box for visual QC.
  - tools/scripts/plot_pasef_frames.py and visualize_pasef_centroiding.py:
    helper scripts for inspecting 4D data and centroider output.
  - CLI flags exposed on FileConverter (-bruker:*) and TOPPPeakPickerIM.
  - BrukerTimsFile_test integration tests (DDA + DIA hill paths, frame
    aggregation, hill-vs-greedy comparisons) and a PASEFHillCentroider
    unit test.

What's NOT in (vs feat/timstof-hill-centroiding):
  - CentroidAlgo::PEAK_PICKER_IM enum value + dispatcher branches.
  - PeakPickerIM FWHM bounding-box exposure (PeakPickerIM-specific).
  - PeakPickerIM m/z-projection resampling fix.
  - PeakPickerIM-specific visualization tweaks.

Test timeout for BrukerTimsFile_test bumped from 2400s to 3600s — the
hill + DIA integration tests need a generous budget on slower hardware.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@timosachsenberg
timosachsenberg force-pushed the feat/timstof-ppim-extras branch from 5673239 to b64e622 Compare May 19, 2026 11:43

@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.

Actionable comments posted: 3

🤖 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 `@tools/scripts/plot_pasef_frames.py`:
- Around line 157-163: The fallback is incorrectly treating arbitrary named
bounds arrays as IM because it blindly uses fda[0]; update the block that sets
im from fda (variables: im, fda, arr, np.fromiter, arr.size()) to first find a
legitimate per-peak IM array by inspecting the array metadata/name and shape:
iterate over fda and skip arrays whose name contains substrings like "bound",
"bounds", "hill", "start", or "end" (or otherwise indicate hill-bounds), require
a 1D numeric array (arr.size() > 1 and arr.ndim == 1 if available) and/or a name
equal to the expected IM key (e.g., "ion_mobility"/"IM") before converting with
np.fromiter; only assign to im if such a validated array is found, otherwise
leave im as None so the DDA/MS2 fallback is used.
- Around line 395-398: The TIC label computation uses the requested n_frames
instead of the actual number of returned rows, so when
pick_by_tic_quantile(first_exp, pool, n_frames) returns fewer picks the labels
are wrong; change quantile_labels to be built from the length of picks (e.g.,
use len(picks) and enumerate 1..len(picks) to compute percentiles) so labels
reflect the actual selected frames for the pick_strategy "tic" block (refer to
pick_strategy, pick_by_tic_quantile, picks, quantile_labels, n_frames).

In `@tools/scripts/visualize_pasef_centroiding.py`:
- Around line 106-112: The fallback currently uses fda[0] unconditionally and
can pick up named bounds arrays; change the logic around the im/fda handling so
you only treat FloatDataArrays[0] as the per-peak IM array when it is actually
unnamed (empty name/None). In the try block that grabs arr = fda[0], check the
array's name property (e.g., getName() or name) and only convert it to im with
np.fromiter if the name is empty/None; otherwise leave im as None and continue
to the 1D fallback path. Update the exception handling to remain the same and
ensure you reference the existing variables arr, im and fda in the modified
condition.
🪄 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: 205ae428-5499-4028-8d88-ac09b99bf8ad

📥 Commits

Reviewing files that changed from the base of the PR and between 5673239 and b64e622.

📒 Files selected for processing (14)
  • src/openms/include/OpenMS/FORMAT/BrukerTimsFile.h
  • src/openms/include/OpenMS/FORMAT/HANDLERS/PASEFHillCentroider.h
  • src/openms/include/OpenMS/FORMAT/HANDLERS/sources.cmake
  • src/openms/source/FORMAT/BrukerTimsFile.cpp
  • src/openms/source/FORMAT/HANDLERS/PASEFHillCentroider.cpp
  • src/openms/source/FORMAT/HANDLERS/sources.cmake
  • src/tests/class_tests/openms/CMakeLists.txt
  • src/tests/class_tests/openms/executables.cmake
  • src/tests/class_tests/openms/source/BrukerTimsFile_test.cpp
  • src/tests/class_tests/openms/source/PASEFHillCentroider_test.cpp
  • src/topp/FileConverter.cpp
  • src/topp/PeakPickerIM.cpp
  • tools/scripts/plot_pasef_frames.py
  • tools/scripts/visualize_pasef_centroiding.py
✅ Files skipped from review due to trivial changes (2)
  • src/tests/class_tests/openms/executables.cmake
  • src/openms/include/OpenMS/FORMAT/HANDLERS/sources.cmake
🚧 Files skipped from review as they are similar to previous changes (9)
  • src/tests/class_tests/openms/CMakeLists.txt
  • src/openms/include/OpenMS/FORMAT/HANDLERS/PASEFHillCentroider.h
  • src/openms/source/FORMAT/HANDLERS/sources.cmake
  • src/topp/PeakPickerIM.cpp
  • src/tests/class_tests/openms/source/PASEFHillCentroider_test.cpp
  • src/tests/class_tests/openms/source/BrukerTimsFile_test.cpp
  • src/topp/FileConverter.cpp
  • src/openms/include/OpenMS/FORMAT/BrukerTimsFile.h
  • src/openms/source/FORMAT/BrukerTimsFile.cpp

Comment thread tools/scripts/plot_pasef_frames.py Resolved
Comment thread tools/scripts/plot_pasef_frames.py Resolved
timosachsenberg and others added 3 commits May 19, 2026 16:28
The hill PR changes the BrukerTimsFile::Config default from 0.0 to 10.0f
(HillBased TIMS-PASEF MS1 m/z tuning). Update the pyOpenMS test that
asserted the pre-hill default.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Both PASEF visualization scripts had the same bug: when a spectrum
carried no per-peak IM array but did carry named bounds arrays
(emitted by -bruker:expose_hill_bounds true: "im lower bound",
"im upper bound", "m/z lower bound", "m/z upper bound"), the fallback
treated fda[0] as IM and rendered a bogus 2D plot. Fix by checking
arr.getName() before promoting fda[0] to IM.

Also fix TIC label off-by-one in plot_pasef_frames.py when n_frames
exceeds the available spectrum count: labels now reflect the actual
number of picked rows rather than the requested count.

Addresses CodeRabbit comments on #9380.

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

@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 (1)
tools/scripts/visualize_pasef_centroiding.py (1)

65-75: 💤 Low value

Unused parameter want_im_array.

The want_im_array parameter is declared but never used in the function body. Either remove it or implement the filtering logic if intended.

Proposed fix
-def first_nonempty(exp, ms_level, want_im_array=True, index=None):
+def first_nonempty(exp, ms_level, index=None):
     """Pick a spectrum at the given MS level. Falls back to first non-empty
     if `index` is None or out of range; returns None if nothing matches."""
🤖 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 `@tools/scripts/visualize_pasef_centroiding.py` around lines 65 - 75, The
parameter want_im_array on function first_nonempty is unused; either remove it
from the function signature and from all callers, or implement its intended
filter: when want_im_array is True restrict candidates to spectra that expose an
ion-mobility/imaging array (e.g., add a predicate has_im_array(exp[i]) inside
the candidates comprehension) and keep current behavior when False; update any
callers/tests to match the chosen change.
🤖 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 `@tools/scripts/visualize_pasef_centroiding.py`:
- Around line 65-75: The parameter want_im_array on function first_nonempty is
unused; either remove it from the function signature and from all callers, or
implement its intended filter: when want_im_array is True restrict candidates to
spectra that expose an ion-mobility/imaging array (e.g., add a predicate
has_im_array(exp[i]) inside the candidates comprehension) and keep current
behavior when False; update any callers/tests to match the chosen change.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 6018a647-ecd1-444d-8899-4b2535a81e04

📥 Commits

Reviewing files that changed from the base of the PR and between 15a446a and e2e1b33.

📒 Files selected for processing (2)
  • tools/scripts/plot_pasef_frames.py
  • tools/scripts/visualize_pasef_centroiding.py

@timosachsenberg
timosachsenberg merged commit eff1781 into develop May 19, 2026
40 of 41 checks passed
@timosachsenberg
timosachsenberg deleted the feat/timstof-ppim-extras branch May 19, 2026 18:25
timosachsenberg pushed a commit that referenced this pull request May 20, 2026
timosachsenberg added a commit that referenced this pull request May 20, 2026
…) and IMAGING module (#9381) (#9385)

Two recent feature commits (both merged Tue May 19 2026) did not have
CHANGELOG entries in the 3.6.0 section:

- #9380: BrukerTimsFile IM-axis hill-based centroiding (PASEFHillCentroider)
  with new Config fields for hill params, isotopic prefilter, and per-mode
  centroid-algorithm selection; Greedy2D path retained as back-compat default.

- #9381: New OpenMS/IMAGING module — IonImage, MSImagingGeometry,
  MSImagingExperiment — providing in-memory data structures for imaging MS;
  first phase of imzML/MSI support.

Also adds the missing (#9379) PR reference tag to the existing pyOpenMS
BrukerTimsFile bindings line so the entry is traceable.

Co-authored-by: GitHub Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: timosachsenberg <[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.

1 participant