Skip to content

(feat,osw): full peak-map extraction (w/ ion mobility) and XIPM parquet support - #9684

Merged
timosachsenberg merged 27 commits into
OpenMS:developfrom
singjc:add/osw_full_peakmap_extractor
Jul 1, 2026
Merged

timosachsenberg merged 27 commits into
OpenMS:developfrom
singjc:add/osw_full_peakmap_extractor

Conversation

@singjc

@singjc singjc commented Jun 29, 2026 •

Copy link
Copy Markdown
Contributor

Description

This PR adds targeted full peak-map extraction for OpenSWATH coordinates (similar to ChromatogramExtractor, but for the full peakmap data, i.e. mz, rt, ion mobility and intensity) and introduces an XIPM parquet format for storing extracted mz / RT / ion mobility peaks.

The new functionality is intended for DIA / diaPASEF use cases where we want to retain the raw targeted peak data instead of only exporting reduced XIC/XIM traces. This will also allow future extension/replacement of the current 1D XIC extraction followed by 1D XIM extraction, and possible 2D peak picking instead of separate 1D in each dimension.

What this adds

  • PeakMapExtractor for targeted raw peak-map extraction

    • follows the OpenSWATH extraction model
    • extracts full mz / RT / IM points for each precursor target
    • stores target mz, target RT, and target ion mobility alongside the extracted data
  • OpenSwathPeakMapExtractor TOPP tool

    • extracts targeted peak maps from one or more mzML inputs
    • supports OpenSWATH-style transition input
    • writes extracted results as .xipm
  • XIPM parquet support

    • XIPMParquetConsumer
    • XIPMParquetFile
    • file type registration for .xipm
  • pyOpenMS support

    • exposes the XIPM file type and bindings needed to read/query XIPM output from Python

Checklist

  • Make sure that you are listed in the AUTHORS file
  • Add relevant changes and new features to the CHANGELOG file
  • I have commented my code, particularly in hard-to-understand areas
  • New and existing unit tests pass locally with my changes
  • Updated or added python bindings for changed or new classes (Tick if no updates were necessary.)

How can I get additional information on failed tests during CI

Click to expand If your PR is failing you can check out

Advanced commands (admins / reviewer only)

Click to expand
  • /reformat (experimental) applies the clang-format style changes as additional commit. Note: your branch must have a different name (e.g., yourrepo:feature/XYZ) than the receiving branch (e.g., OpenMS:develop). Otherwise, reformat fails to push.
  • setting the label "NoJenkins" will skip tests for this PR on jenkins (saves resources e.g., on edits that do not affect tests)
  • commenting with rebuild jenkins will retrigger Jenkins-based CI builds

⚠️ Note: Once you opened a PR try to minimize the number of pushes to it as every push will trigger CI (automated builds and test) and is rather heavy on our infrastructure (e.g., if several pushes per day are performed).

Summary by CodeRabbit

  • New Features
    • Added an OpenSWATH tool for targeted peak-point extraction with .xipm Parquet output.
    • Added C++ and Python APIs to extract targeted peak maps and to write/read/query .xipm data (including DataFrame/Arrow-friendly access).
    • Registered .xipm as a supported file type.
  • Bug Fixes
    • Improved target/decoy precursor labeling consistency in Parquet outputs.
    • Parquet/Arrow writing now surfaces clearer, column-specific errors.
  • Tests
    • Added unit tests and a new CTest covering peak-map extraction, .xipm read/write, file-type mappings, and TOPP execution.

singjc added 14 commits June 2, 2026 00:58
- Implemented the OpenSwathPeakMapExtractor tool to extract targeted raw mz/RT/IM peak maps from DIA/diaPASEF data, outputting results as Parquet `.xipm` files.
- Registered the new tool in ToolHandler.cpp for inclusion in the OpenMS applications.
- Updated executables.cmake to include OpenSwathPeakMapExtractor in the build configuration.
- Added necessary test cases for the new tool in the class_tests directory.
@github-actions

Copy link
Copy Markdown
Contributor

@singjc The following names might be missing from the AUTHORS file:

  • singjc

Please consider applying the following patch:

--- AUTHORS	2026-06-29 19:23:41.458785744 +0000
+++ AUTHORS.new	2026-06-29 19:23:46.366170560 +0000
@@ -113,6 +113,7 @@
  - Sandro Andreotti
  - Santhil
  - Simon Gene Gottlieb
+ - singjc
  - Steffen Sass
  - Stephan Aiche
  - Sven Nahnsen

@coderabbitai

coderabbitai Bot commented Jun 29, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It 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 reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Adds a new OpenSWATH peak-map extraction tool and .xipm Parquet reader/writer support, with pyOpenMS bindings, Python helpers, and tests. Also updates precursor decoy handling in two Parquet consumers and makes Arrow append failures throw in the OpenSWATH Parquet exporter.

Changes

XIPM peak-map extraction feature

Layer / File(s) Summary
Public XIPM contracts
src/openms/include/OpenMS/ANALYSIS/OPENSWATH/PeakMapExtractor.h, src/openms/include/OpenMS/FORMAT/ArrowSchemaRegistry.h, src/openms/include/OpenMS/FORMAT/FileTypes.h, src/openms/include/OpenMS/FORMAT/DATAACCESS/XIPMParquetConsumer.h, src/openms/include/OpenMS/FORMAT/XIPMParquetFile.h
Defines the new peak-map extraction API, XIPM Arrow schema, PEAKMAPPARQUET file type, Parquet consumer, and Parquet reader types.
Extraction, schema, and storage implementations
src/openms/source/ANALYSIS/OPENSWATH/PeakMapExtractor.cpp, src/openms/source/FORMAT/ArrowSchemaRegistry.cpp, src/openms/source/FORMAT/DATAACCESS/XIPMParquetConsumer.cpp, src/openms/source/FORMAT/XIPMParquetFile.cpp, src/openms/source/FORMAT/FileTypes.cpp, src/openms/source/ANALYSIS/OPENSWATH/sources.cmake, src/openms/source/FORMAT/DATAACCESS/sources.cmake, src/openms/source/FORMAT/sources.cmake
Implements extraction, Arrow schema creation, Parquet writing, Parquet reading and decoding, file-type lookup, and source list wiring.
TOPP extractor tool and wiring
src/topp/OpenSwathPeakMapExtractor.cpp, src/topp/executables.cmake, src/tests/topp/CMakeLists.txt, src/openms/source/APPLICATIONS/ToolHandler.cpp, doc/doxygen/public/TOPP.doxygen, CHANGELOG
Registers the new TOPP executable, defines its CLI flow, and adds the matching CTest and changelog entries.
pyOpenMS bindings and addon layer
src/pyOpenMS/bindings/bind_misc.cpp, src/pyOpenMS/bindings/bind_format.cpp, src/pyOpenMS/pyopenms/addons/xipmparquetfile.py, src/pyOpenMS/pyproject.toml
Adds nanobind bindings for peak-map extraction and XIPM Parquet access, plus Python addon utilities for querying, conversion, and analyte grouping.
XIPM and PeakMapExtractor tests
src/tests/class_tests/openms/source/PeakMapExtractor_test.cpp, src/tests/class_tests/openms/source/XIPMParquetConsumer_test.cpp, src/tests/class_tests/openms/source/XIPMParquetFile_test.cpp, src/tests/class_tests/openms/source/FileTypes_test.cpp, src/tests/class_tests/openms/executables.cmake, src/pyOpenMS/tests/unittests/test_PeakMapExtractor.py, src/pyOpenMS/tests/unittests/test_XIPMParquetFile.py, src/pyOpenMS/tests/unittests/test_FileTypes.py
Adds C++ and Python coverage for extraction, Parquet round-trips, file types, and executable registration.

Parquet consumer fixes: decoy resolution and error handling

Layer / File(s) Summary
Precursor decoy resolution
src/openms/source/FORMAT/DATAACCESS/MSChromatogramParquetConsumer.cpp, src/openms/source/FORMAT/DATAACCESS/MobilogramParquetConsumer.cpp, src/tests/class_tests/openms/source/MSChromatogramParquetConsumer_test.cpp, src/tests/class_tests/openms/source/MobilogramParquetConsumer_test.cpp
Computes precursor decoy status from pre-scanned target and decoy transition sets in the chromatogram and mobilogram consumers, and updates the associated round-trip tests.
Arrow append error handling
src/openms/source/ANALYSIS/OPENSWATH/OpenSwathParquetExporter.cpp
Replaces non-throwing Arrow append calls in feature-score and transition-score writing with column-aware helpers that raise on append failure.

Possibly related PRs

  • OpenMS/OpenMS#9649: Both PRs register a new TOPP tool entry and update the matching tool documentation/listing.
  • OpenMS/OpenMS#9681: Shares the same OpenSWATH Parquet exporter row-building path now updated to throw on Arrow append failures.

Suggested reviewers

  • jpfeuffer
  • timosachsenberg

🐇 I hopped through clouds of ionized light,
Into .xipm jars both tidy and bright.
Peaks and decoys now travel with care,
And Arrow grumbles are caught in the air.
A carrot to tools that extract by the ton —
Hooray for the peak-map work well done!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 10.81% 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 summarizes the main additions: peak-map extraction with ion mobility and XIPM Parquet support.
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.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@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: 9

🧹 Nitpick comments (6)
src/tests/class_tests/openms/source/MSChromatogramParquetConsumer_test.cpp (1)

166-166: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Use TEST_TRUE for the boolean assertion.

TEST_EQUAL(chrom.has_precursor_decoy, true) works, but these class tests prefer the dedicated boolean macro.

Suggested change
-    TEST_EQUAL(chrom.has_precursor_decoy, true)
+    TEST_TRUE(chrom.has_precursor_decoy)

As per coding guidelines, "Prefer TEST_TRUE(expr) and TEST_FALSE(expr) over TEST_EQUAL(expr, true) and TEST_EQUAL(expr, false) for boolean assertions".

🤖 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/MSChromatogramParquetConsumer_test.cpp`
at line 166, Replace the boolean check in MSChromatogramParquetConsumer_test.cpp
with the dedicated boolean assertion macro. Update the TEST_EQUAL assertion on
chrom.has_precursor_decoy to use TEST_TRUE instead, keeping the test intent the
same and following the class test guideline for boolean expressions.

Source: Coding guidelines

src/tests/class_tests/openms/source/MobilogramParquetConsumer_test.cpp (1)

184-184: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Use TEST_TRUE for the boolean assertion.

This should use the dedicated boolean test macro for consistency with the class-test conventions.

Suggested change
-    TEST_EQUAL(m.has_precursor_decoy, true)
+    TEST_TRUE(m.has_precursor_decoy)

As per coding guidelines, "Prefer TEST_TRUE(expr) and TEST_FALSE(expr) over TEST_EQUAL(expr, true) and TEST_EQUAL(expr, false) for boolean assertions".

🤖 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/MobilogramParquetConsumer_test.cpp` at
line 184, The boolean assertion in the MobilogramParquetConsumer test uses a
generic equality check instead of the dedicated boolean macro. Update the
`TEST_EQUAL(m.has_precursor_decoy, true)` assertion in
`MobilogramParquetConsumer_test.cpp` to use `TEST_TRUE` for consistency with the
class-test conventions and boolean assertion guidelines.

Source: Coding guidelines

src/openms/include/OpenMS/FORMAT/XIPMParquetFile.h (1)

24-94: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Document the new public reader API before it lands in the installed headers.

XIPMPeakMap, XIPMRunInfo, the constructors, and the query/getter methods are all new public surface here, but the header does not explain their semantics (including the -1 / "" “no filter” sentinels on getPeakMaps). That leaves the generated API docs incomplete for downstream users. As per coding guidelines, src/openms/include/OpenMS/**/*.h: add Doxygen comments for new public methods and classes, and update relevant documentation when modifying existing functionality.

🤖 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/include/OpenMS/FORMAT/XIPMParquetFile.h` around lines 24 - 94, The
new public API in XIPMParquetFile is missing Doxygen documentation, so add brief
class/struct comments and method docs for XIPMPeakMap, XIPMRunInfo, both
constructors, and the getter/query methods. Be sure to document the semantics of
getPeakMaps in particular, including that the -1 and empty-string defaults mean
“no filter,” and describe the expected contents of the output vectors and
filename accessors so the installed headers generate complete API docs.

Source: Coding guidelines

src/tests/class_tests/openms/source/XIPMParquetConsumer_test.cpp (1)

133-143: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Use TEST_TRUE/TEST_FALSE for these boolean checks.

The new class-test assertions still use TEST_EQUAL(..., true). As per coding guidelines, src/tests/class_tests/**/*_test.cpp: “Prefer TEST_TRUE(expr) and TEST_FALSE(expr) over TEST_EQUAL(expr, true) and TEST_EQUAL(expr, false) for boolean assertions.”

Also applies to: 158-158, 185-189

🤖 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/XIPMParquetConsumer_test.cpp` around
lines 133 - 143, Update the boolean assertions in XIPMParquetConsumer_test to
follow the class-test guideline: replace every TEST_EQUAL(..., true) and
TEST_EQUAL(..., false) with TEST_TRUE or TEST_FALSE as appropriate. The affected
checks are the File::exists and File::fileSize validations as well as the
has_target_rt assertions on XIPMParquetFile::XIPMPeakMap entries, and the same
pattern should be corrected in the other referenced test blocks too.

Source: Coding guidelines

src/tests/class_tests/openms/source/FileTypes_test.cpp (1)

154-160: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Also assert WRITEABLE for PEAKMAPPARQUET.

This section only guards the readable registration. Since the PR also introduces .xipm as an output format, a missing WRITEABLE property would still slip through here.

Suggested test addition
   std::vector<FileTypes::FileProperties> f;
   f.push_back(FileTypes::FileProperties::READABLE);
   FileTypeList g = FileTypeList::typesWithProperties(f);
   TEST_EQUAL(g.contains(FileTypes::PEAKMAPPARQUET), true);
   TEST_EQUAL(g.getTypes().size(), 50); // YAML is WRITEABLE-only, so the readable count includes the new xipm type
+
+  std::vector<FileTypes::FileProperties> w;
+  w.push_back(FileTypes::FileProperties::WRITEABLE);
+  TEST_TRUE(FileTypeList::typesWithProperties(w).contains(FileTypes::PEAKMAPPARQUET));
🤖 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/FileTypes_test.cpp` around lines 154 -
160, The typesWithProperties test only verifies that FileTypes::PEAKMAPPARQUET
is registered as READABLE, so it can miss a broken output-format registration.
Update the FileTypes::typesWithProperties coverage in FileTypes_test.cpp to also
assert that PEAKMAPPARQUET is present when filtering for WRITEABLE, using the
existing FileTypeList helper and PEAKMAPPARQUET symbol to keep the test aligned
with the new .xipm output behavior.
src/tests/class_tests/openms/source/XIPMParquetFile_test.cpp (1)

103-107: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Use TEST_TRUE/TEST_FALSE for these boolean checks.

These new assertions use TEST_EQUAL(..., true/false) instead of the preferred class-test helpers. As per coding guidelines, src/tests/class_tests/**/*_test.cpp: “Prefer TEST_TRUE(expr) and TEST_FALSE(expr) over TEST_EQUAL(expr, true) and TEST_EQUAL(expr, false) for boolean assertions.”

Also applies to: 126-126, 162-162

🤖 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/XIPMParquetFile_test.cpp` around lines
103 - 107, The boolean assertions in this test should use the class-test helpers
instead of equality checks; update the checks around peak_maps[0].has_target_rt
(and the other boolean assertions noted in the same test) to use TEST_TRUE or
TEST_FALSE as appropriate, keeping the non-boolean size comparisons unchanged.

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/include/OpenMS/ANALYSIS/OPENSWATH/PeakMapExtractor.h`:
- Around line 60-82: The public contract in PeakMapExtractor::extractPeakMaps is
out of sync with PeakMapExtractor.cpp: the header currently documents only
"tophat", but the implementation also accepts "bartlett" and may throw
IllegalArgument when the filter is unsupported or ion-mobility arrays are
missing. Update the Doxygen in PeakMapExtractor.h to accurately describe the
supported filter values and the exceptions callers should expect, or tighten the
implementation to match the header if that is the intended API.

In `@src/openms/include/OpenMS/FORMAT/ArrowSchemaRegistry.h`:
- Around line 656-689: The XIPMSchema public API only has a short brief and is
missing the required full Doxygen block. Update the documentation on XIPMSchema
to include the proper `@brief`, a blank line with descriptive details, and the
appropriate group tag using `@defgroup` or `@ingroup` so this exported header is
documented consistently with the other public schema types.

In `@src/openms/source/ANALYSIS/OPENSWATH/PeakMapExtractor.cpp`:
- Around line 113-121: The m/z and IM boundary checks in PeakMapExtractor are
excluding peaks that lie exactly on the configured window edges, unlike the
inclusive RT handling. Update the comparisons in the extraction loop around the
lower_bound/mz_it scan so edge values are accepted, and keep the IM filter in
sync with that inclusive behavior using the existing point_mz/point_im logic.

In `@src/openms/source/FORMAT/XIPMParquetFile.cpp`:
- Around line 338-380: Add an early return for schema-only XIPM tables in
XIPMParquetFile::getPeakMaps and XIPMParquetFile::getRuns: after
readParquetTable_(filenames_) and before any getColumn_() calls, check whether
the table has zero rows and immediately leave the output empty. This prevents
getColumn_() from throwing on valid empty tables and keeps both methods aligned
with the empty-file behavior.
- Around line 31-64: The table returned by readParquetTable_ is not
schema-validated, so mismatched Parquet column types can still reach
getOptionalInt_(), getOptionalDouble_(), getOptionalString_(), or
getBinaryView_() and cause unsafe casts. After CombineChunks() in
readParquetTable_, validate the resulting table against XIPMSchema::schema()
using ArrowSchemaValidation::validate(..., ArrowSchemaValidation::Mode::Subset)
and throw a controlled Exception::InvalidValue if validation fails before
returning the table.

In `@src/pyOpenMS/pyopenms/addons/xipmparquetfile.py`:
- Around line 176-238: The nested-analyte path in _build_analyte_dict is using
requested precursor fields as the grouping key, which can merge distinct
precursors when only a subset of columns is requested. Update the grouping logic
in _build_analyte_dict so nest_transitions=True always groups by the full
precursor identity from _PRECURSOR_GROUPING_FIELDS internally, while still
projecting only the caller-requested fields into the final result. Keep the
transition collection and deduplication behavior the same, but ensure the final
output is built from the internally grouped records rather than the projected
columns.

In `@src/tests/topp/CMakeLists.txt`:
- Around line 2049-2064: The smoke test for OpenSwathPeakMapExtractor uses a
fixed out_dir and only checks for the .xipm file’s existence, so stale artifacts
can make it pass incorrectly. Update the TOPP_OpenSwathPeakMapExtractor_1 test
setup in the CMakeLists entry to remove or recreate the
OpenSwathPeakMapExtractor_1_out directory before running the test, and keep the
existing TOPP_OpenSwathPeakMapExtractor_1_out1 existence check against fresh
output only.

In `@src/topp/OpenSwathPeakMapExtractor.cpp`:
- Around line 385-386: Replace the remaining OPENMS_LOG_WARN statements in
OpenSwathPeakMapExtractor::load... paths that still use std::endl with a newline
character instead. Update the warning at the priority peptide file load failure
site, and apply the same change to the other listed log statements in this class
so they use '\n' consistently and avoid the extra flush.
- Around line 397-403: deriveRunOutputPath_() currently uses only
fileBasenameNoExtension_(run_files.front()), so separate runs with the same
filename can overwrite each other in the same out_dir. Update the output-name
generation in OpenSwathPeakMapExtractor::deriveRunOutputPath_ to make it
collision-safe by incorporating a per-run unique component such as run_index
and/or a path-derived hash/relative structure from run_files.front() before
appending the .xipm suffix. Keep the existing absolute path handling and
basename fallback, but ensure different input directories cannot map to the same
output path under -separate_runs.

---

Nitpick comments:
In `@src/openms/include/OpenMS/FORMAT/XIPMParquetFile.h`:
- Around line 24-94: The new public API in XIPMParquetFile is missing Doxygen
documentation, so add brief class/struct comments and method docs for
XIPMPeakMap, XIPMRunInfo, both constructors, and the getter/query methods. Be
sure to document the semantics of getPeakMaps in particular, including that the
-1 and empty-string defaults mean “no filter,” and describe the expected
contents of the output vectors and filename accessors so the installed headers
generate complete API docs.

In `@src/tests/class_tests/openms/source/FileTypes_test.cpp`:
- Around line 154-160: The typesWithProperties test only verifies that
FileTypes::PEAKMAPPARQUET is registered as READABLE, so it can miss a broken
output-format registration. Update the FileTypes::typesWithProperties coverage
in FileTypes_test.cpp to also assert that PEAKMAPPARQUET is present when
filtering for WRITEABLE, using the existing FileTypeList helper and
PEAKMAPPARQUET symbol to keep the test aligned with the new .xipm output
behavior.

In `@src/tests/class_tests/openms/source/MobilogramParquetConsumer_test.cpp`:
- Line 184: The boolean assertion in the MobilogramParquetConsumer test uses a
generic equality check instead of the dedicated boolean macro. Update the
`TEST_EQUAL(m.has_precursor_decoy, true)` assertion in
`MobilogramParquetConsumer_test.cpp` to use `TEST_TRUE` for consistency with the
class-test conventions and boolean assertion guidelines.

In `@src/tests/class_tests/openms/source/MSChromatogramParquetConsumer_test.cpp`:
- Line 166: Replace the boolean check in MSChromatogramParquetConsumer_test.cpp
with the dedicated boolean assertion macro. Update the TEST_EQUAL assertion on
chrom.has_precursor_decoy to use TEST_TRUE instead, keeping the test intent the
same and following the class test guideline for boolean expressions.

In `@src/tests/class_tests/openms/source/XIPMParquetConsumer_test.cpp`:
- Around line 133-143: Update the boolean assertions in XIPMParquetConsumer_test
to follow the class-test guideline: replace every TEST_EQUAL(..., true) and
TEST_EQUAL(..., false) with TEST_TRUE or TEST_FALSE as appropriate. The affected
checks are the File::exists and File::fileSize validations as well as the
has_target_rt assertions on XIPMParquetFile::XIPMPeakMap entries, and the same
pattern should be corrected in the other referenced test blocks too.

In `@src/tests/class_tests/openms/source/XIPMParquetFile_test.cpp`:
- Around line 103-107: The boolean assertions in this test should use the
class-test helpers instead of equality checks; update the checks around
peak_maps[0].has_target_rt (and the other boolean assertions noted in the same
test) to use TEST_TRUE or TEST_FALSE as appropriate, keeping the non-boolean
size comparisons unchanged.
🪄 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: ef4f8df2-5b7c-4964-9366-3f8b681180ca

📥 Commits

Reviewing files that changed from the base of the PR and between 5f99633 and 187e5b1.

📒 Files selected for processing (34)
  • doc/doxygen/public/TOPP.doxygen
  • src/openms/include/OpenMS/ANALYSIS/OPENSWATH/PeakMapExtractor.h
  • src/openms/include/OpenMS/FORMAT/ArrowSchemaRegistry.h
  • src/openms/include/OpenMS/FORMAT/DATAACCESS/XIPMParquetConsumer.h
  • src/openms/include/OpenMS/FORMAT/FileTypes.h
  • src/openms/include/OpenMS/FORMAT/XIPMParquetFile.h
  • src/openms/source/ANALYSIS/OPENSWATH/OpenSwathParquetExporter.cpp
  • src/openms/source/ANALYSIS/OPENSWATH/PeakMapExtractor.cpp
  • src/openms/source/ANALYSIS/OPENSWATH/sources.cmake
  • src/openms/source/APPLICATIONS/ToolHandler.cpp
  • src/openms/source/FORMAT/ArrowSchemaRegistry.cpp
  • src/openms/source/FORMAT/DATAACCESS/MSChromatogramParquetConsumer.cpp
  • src/openms/source/FORMAT/DATAACCESS/MobilogramParquetConsumer.cpp
  • src/openms/source/FORMAT/DATAACCESS/XIPMParquetConsumer.cpp
  • src/openms/source/FORMAT/DATAACCESS/sources.cmake
  • src/openms/source/FORMAT/FileTypes.cpp
  • src/openms/source/FORMAT/XIPMParquetFile.cpp
  • src/openms/source/FORMAT/sources.cmake
  • src/pyOpenMS/bindings/bind_format.cpp
  • src/pyOpenMS/bindings/bind_misc.cpp
  • src/pyOpenMS/pyopenms/addons/xipmparquetfile.py
  • src/pyOpenMS/tests/unittests/test_FileTypes.py
  • src/pyOpenMS/tests/unittests/test_PeakMapExtractor.py
  • src/pyOpenMS/tests/unittests/test_XIPMParquetFile.py
  • src/tests/class_tests/openms/executables.cmake
  • src/tests/class_tests/openms/source/FileTypes_test.cpp
  • src/tests/class_tests/openms/source/MSChromatogramParquetConsumer_test.cpp
  • src/tests/class_tests/openms/source/MobilogramParquetConsumer_test.cpp
  • src/tests/class_tests/openms/source/PeakMapExtractor_test.cpp
  • src/tests/class_tests/openms/source/XIPMParquetConsumer_test.cpp
  • src/tests/class_tests/openms/source/XIPMParquetFile_test.cpp
  • src/tests/topp/CMakeLists.txt
  • src/topp/OpenSwathPeakMapExtractor.cpp
  • src/topp/executables.cmake

Comment thread src/tests/topp/CMakeLists.txt Resolved
Comment thread src/topp/OpenSwathPeakMapExtractor.cpp Resolved
Comment thread src/topp/OpenSwathPeakMapExtractor.cpp Resolved

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

Caution

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

⚠️ Outside diff range comments (1)
src/openms/source/ANALYSIS/OPENSWATH/PeakMapExtractor.cpp (1)

37-40: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Zero-width RT windows currently disable RT filtering.

OpenSwathPeakMapExtractor::prepareExtractionCoordinates_ can intentionally produce rt_start == rt_end when the configured RT window is 0, but both checks here require a strictly positive span. That makes a zero-second RT window extract across the full run and also leaves target_rt as NaN instead of the requested point RT.

Suggested fix
-      if (output[k].rt_end - output[k].rt_start > 0.0)
+      if (output[k].rt_end >= output[k].rt_start)
       {
         output[k].target_rt = (output[k].rt_start + output[k].rt_end) / 2.0;
       }
@@
-        if (coord.rt_end - coord.rt_start > 0 &&
+        if (coord.rt_end >= coord.rt_start &&
             (current_rt < coord.rt_start || current_rt > coord.rt_end))
         {
           continue;
         }

Also applies to: 86-88

🤖 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/OPENSWATH/PeakMapExtractor.cpp` around lines 37 -
40, The RT span check in
OpenSwathPeakMapExtractor::prepareExtractionCoordinates_ is too strict and skips
zero-width windows, which disables RT filtering and leaves target_rt unset.
Update the logic around output[k].rt_start, output[k].rt_end, and target_rt so
that a zero-length window is treated as a valid point RT (not as “no RT
filter”), while still only falling back when the RT bounds are truly absent or
invalid. Apply the same fix to the later matching block referenced by the
comment so both coordinate preparation paths behave consistently.
🤖 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.

Outside diff comments:
In `@src/openms/source/ANALYSIS/OPENSWATH/PeakMapExtractor.cpp`:
- Around line 37-40: The RT span check in
OpenSwathPeakMapExtractor::prepareExtractionCoordinates_ is too strict and skips
zero-width windows, which disables RT filtering and leaves target_rt unset.
Update the logic around output[k].rt_start, output[k].rt_end, and target_rt so
that a zero-length window is treated as a valid point RT (not as “no RT
filter”), while still only falling back when the RT bounds are truly absent or
invalid. Apply the same fix to the later matching block referenced by the
comment so both coordinate preparation paths behave consistently.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: ac8abd10-0d8b-4a82-8fe2-ffdae66259e2

📥 Commits

Reviewing files that changed from the base of the PR and between 187e5b1 and 4b611bd.

📒 Files selected for processing (11)
  • CHANGELOG
  • src/openms/include/OpenMS/ANALYSIS/OPENSWATH/PeakMapExtractor.h
  • src/openms/include/OpenMS/FORMAT/ArrowSchemaRegistry.h
  • src/openms/source/ANALYSIS/OPENSWATH/PeakMapExtractor.cpp
  • src/openms/source/FORMAT/XIPMParquetFile.cpp
  • src/pyOpenMS/pyopenms/addons/xipmparquetfile.py
  • src/pyOpenMS/tests/unittests/test_XIPMParquetFile.py
  • src/tests/class_tests/openms/source/PeakMapExtractor_test.cpp
  • src/tests/class_tests/openms/source/XIPMParquetFile_test.cpp
  • src/tests/topp/CMakeLists.txt
  • src/topp/OpenSwathPeakMapExtractor.cpp
✅ Files skipped from review due to trivial changes (1)
  • CHANGELOG
🚧 Files skipped from review as they are similar to previous changes (8)
  • src/openms/include/OpenMS/FORMAT/ArrowSchemaRegistry.h
  • src/openms/include/OpenMS/ANALYSIS/OPENSWATH/PeakMapExtractor.h
  • src/pyOpenMS/tests/unittests/test_XIPMParquetFile.py
  • src/tests/topp/CMakeLists.txt
  • src/tests/class_tests/openms/source/XIPMParquetFile_test.cpp
  • src/topp/OpenSwathPeakMapExtractor.cpp
  • src/openms/source/FORMAT/XIPMParquetFile.cpp
  • src/pyOpenMS/pyopenms/addons/xipmparquetfile.py

@timosachsenberg

Copy link
Copy Markdown
Contributor

Review — full peak-map extraction + XIPM parquet

Reviewed with Claude Code (Opus) + Codex, cross-checked against CodeRabbit. Every finding below was traced to the current source on the branch. Nice PR overall — the int32/2 GB Arrow buffer-flush accounting and the checked-append error handling are careful work.

CI: ✅ all green (build/test on 5 platforms, all wheels + Python 3.10–3.14, sphinx).

CodeRabbit Majors — all already addressed ✅

Confirmed against current source so they don't get re-litigated:

  • XIPMParquetFile.cpp — validateXIPMTable_() now runs after CombineChunks before any typed cast; empty-table early return (if (rows == 0) return;) present.
  • xipmparquetfile.py — get_analyte_dict force-reads all precursor/transition grouping fields regardless of projection, so distinct precursors can't collapse.
  • Edge-inclusion in PeakMapExtractor is now inclusive (<=/>=); empty-dir smoke test + doxygen done.

🔴 Major — close-error retry can truncate the output file to empty

XIPMParquetConsumer.cpp:380-400 and MobilogramParquetConsumer.cpp:332-352.

finalize() closes the writer (and resets it), then closes outfile_, and only sets wrote_ = true at the very end. If outfile_->Close() fails after the writer already closed successfully (e.g. an IO error on a file whose row groups + footer are already on disk), it throws with wrote_ still false and writer_ already null. The TOPP tool calls finalize() explicitly (OpenSwathPeakMapExtractor.cpp:868, 876), so that exception propagates and the consumer is then destroyed → the destructor calls finalize() again → with wrote_==false and writer_==null the else if (!writer_) branch runs openWriterIfNeeded_(), which reopens the path in truncate mode and writes an empty table. A complete file is silently overwritten with zero rows.

MSChromatogramParquetConsumer::write_() (lines 506-539) already has the safe pattern and is a good reference: it resets each handle immediately after Close() (before the !ok throw) and sets wrote_ = true before closing outfile_, so the destructor's retry is a no-op. Suggest mirroring that in both XIPMParquetConsumer::finalize() and MobilogramParquetConsumer::finalize().

🟠 Minor — trailing empty chromatograms can be dropped

MSChromatogramParquetConsumer.cpp:449-456. The empty-chromatogram branch appends to all data + metadata builders (column lengths stay consistent ✅) but returns before incrementing accumulated_rows_. If a flush has already opened outfile_ (counter reset) and only empty chromatograms follow before write_(), flushBuffers_() sees accumulated_rows_ == 0 with an existing writer and returns early (:550-555), discarding those appended rows. Narrow trigger, but silent data loss. Fix: bump accumulated_rows_ (and the binary-byte tally) in the empty branch and run the same flush check.

🟡 By-design (flagging for confirmation, not bugs)

  • RT/IM zero-width window ⇒ filter disabled (PeakMapExtractor.cpp:86, 105): matches the OpenSWATH window <= 0 convention; target_rt is consistently only set for a positive RT window. Worth one line in the TOPP param docs.
  • Targets with zero extracted points are skipped (OpenSwathPeakMapExtractor.cpp:444-447): deliberate "don't emit empty rows". Since the XIPM format can store empty payloads, just confirming this is the intended behavior (downstream can't distinguish "extracted-but-empty" from "not considered").

OpenSwathParquetExporter refactor

The target/decoy-labeling refactor (+139/−126) looks behavior-preserving — it keeps the source-row fields and mainly adds checked Arrow appends; OpenSwathParquetExporter_test + CI pass. Suggest a CHANGELOG note that the labeling change is intentional.


Automated assist; please sanity-check the two consumer-finalize() flagged paths against your intended close semantics.

@timosachsenberg
timosachsenberg merged commit 5692b27 into OpenMS:develop Jul 1, 2026
39 checks passed
timosachsenberg pushed a commit that referenced this pull request Jul 1, 2026
…XIPMParquetFile Doxygen

- OpenSwathPercolatorScoring (added in #9695) had no Python binding, unlike
  sibling OSW classes (OpenSwathOSWWriter, Percolator); expose the class,
  its Level enum, and ScoreSummary struct following the existing
  Percolator binding pattern (def_DefaultParamHandler, nested types scoped
  under the class handle).
- XIPMParquetFile.h (added in #9684) had only a one-line class @brief and
  no per-member documentation; bring it in line with the XICParquetFile.h /
  XIMParquetFile.h sibling readers added in the same PR wave.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Po25Mh5kdPa6b8AFn5hagb
timosachsenberg pushed a commit that referenced this pull request Jul 2, 2026
PR #9684 added the XIPMParquetFile/XIPMParquetConsumer/PeakMapExtractor
library classes (.xipm Parquet peak-map format) but the CHANGELOG only
covered the resulting OpenSwathPeakMapExtractor TOPP tool, not the
underlying library additions.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_013zL9kz6gU1NgJvqWHwStUB
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants