Skip to content

[FEATURE] Add Arrow/Parquet export for MSExperiment - #8655

Merged
timosachsenberg merged 16 commits into
developfrom
feature/cpp-arrow-ms-experiment
Jan 15, 2026
Merged

timosachsenberg merged 16 commits into
developfrom
feature/cpp-arrow-ms-experiment

Conversation

@timosachsenberg

@timosachsenberg timosachsenberg commented Jan 14, 2026 •

Copy link
Copy Markdown
Contributor

Summary

This PR introduces an opt-in C++ helper for exporting MSExperiment to Apache Arrow tables when OpenMS is built with Parquet/Arrow support.

  • Export spectra & chromatograms to Arrow/Parquet formats
  • Long or semi-wide layout options
  • Configurable columns, RT/m/z/MS-level filters
  • Optional precursor and ion-mobility fields
  • Parquet compression tuning
  • Zero-copy Python interop via pyarrow

The code is guarded by WITH_PARQUET and does not change existing behavior.

🚀 PR Summary: Arrow/Parquet Export for MSExperiment

This PR adds comprehensive Apache Arrow and Parquet export capabilities to pyOpenMS, enabling efficient columnar data export with zero-copy interoperability with pandas, polars, and other Arrow-compatible tools.


✨ Key Features

Feature Description
Arrow Export Export spectra & chromatograms to Apache Arrow Tables
Parquet Export Write directly to compressed Parquet files (ZSTD)
Two Formats Long format (1 row/peak) or Semi-wide (1 row/spectrum)
Filtering Filter by MS level, RT range, m/z range
Column Selection Export only the columns you need
Zero-Copy Direct memory sharing with pandas 2.0+ and polars
Precursor Info Optional precursor m/z, charge, intensity columns
Ion Mobility Optional ion mobility column support

📚 New Python API

MSExperiment Methods

Method Description
exp.to_arrow(...) Export to Arrow Table (spectra, chromatograms, or both)
exp.arrow_columns(...) Discover available column names before export
exp.to_df(...) Export to pandas DataFrame
exp.df_columns(...) Discover DataFrame column names

Method Signature

exp.to_arrow(
    data='spectra',           # 'spectra', 'chromatograms', or 'both'
    format='long',            # 'long' or 'semi_wide'
    columns=None,             # List of columns to include (None = all)
    ms_levels=None,           # Filter by MS levels [1], [2], [1,2], etc.
    min_rt=None, max_rt=None, # RT range filter
    min_mz=None, max_mz=None, # m/z range filter
    include_precursor_info=True,
    include_ion_mobility=True
) -> pyarrow.Table

📊 Output Formats

Long Format (default) - One row per peak

Best for: Peak-level analysis, filtering, aggregations

┌──────────┬───────────┬────────┬────────────────┬──────────┬───────────┐
│ mz       │ intensity │ rt     │ spectrum_index │ ms_level │ native_id │
├──────────┼───────────┼────────┼────────────────┼──────────┼───────────┤
│ 100.0512 │ 1234.5    │ 60.5   │ 0              │ 1        │ scan=1    │
│ 200.1024 │ 5678.9    │ 60.5   │ 0              │ 1        │ scan=1    │
│ 150.0768 │ 2345.6    │ 61.2   │ 1              │ 2        │ scan=2    │
└──────────┴───────────┴────────┴────────────────┴──────────┴───────────┘

Semi-Wide Format - One row per spectrum

Best for: Spectrum-level operations, machine learning input

┌────────────────┬────────┬──────────┬───────────┬─────────────────┬─────────────────┐
│ spectrum_index │ rt     │ ms_level │ native_id │ mz              │ intensity       │
├────────────────┼────────┼──────────┼───────────┼─────────────────┼─────────────────┤
│ 0              │ 60.5   │ 1        │ scan=1    │ [100.05, 200.1] │ [1234.5, 5678.9]│
│ 1              │ 61.2   │ 2        │ scan=2    │ [150.08]        │ [2345.6]        │
└────────────────┴────────┴──────────┴───────────┴─────────────────┴─────────────────┘

📋 Column Schemas

Spectra - Long Format

Column Type Description
mz float64 Mass-to-charge ratio
intensity float32 Peak intensity
rt float32 Retention time (seconds)
ion_mobility float32 Ion mobility value (optional)
spectrum_index uint32 Spectrum index in experiment
ms_level uint8 MS level (1, 2, etc.)
native_id string Native spectrum identifier
precursor_mz float64 Precursor m/z (optional)
precursor_charge int32 Precursor charge (optional)
precursor_intensity float32 Precursor intensity (optional)
isolation_lower float64 Isolation window lower offset (optional)
isolation_upper float64 Isolation window upper offset (optional)

Spectra - Semi-Wide Format

Column Type Description
spectrum_index uint32 Spectrum index
rt float32 Retention time
ms_level uint8 MS level
native_id string Native identifier
mz list<float64> Array of m/z values
intensity list<float32> Array of intensities
ion_mobility list<float32> Array of IM values (optional)
precursor_* various Precursor columns (optional)

Chromatograms

Column Type Description
rt float32 Retention time
intensity float32 Intensity
chromatogram_index uint32 Chromatogram index
native_id string Native identifier
precursor_mz float64 Precursor m/z
product_mz float64 Product m/z

💻 Example Code

Basic Export

import pyopenms as oms

# Load data
exp = oms.MSExperiment()
oms.MzMLFile().load("sample.mzML", exp)

# Export to Arrow Table
table = exp.to_arrow()
print(f"Exported {table.num_rows} peaks")

# Convert to pandas (zero-copy with pandas 2.0+)
df = table.to_pandas()

# Convert to polars
import polars as pl
df = pl.from_arrow(table)

Filtered Export

# Export only MS2 spectra in RT range 100-500s
table = exp.to_arrow(
    ms_levels=[2],
    min_rt=100.0,
    max_rt=500.0
)

# Export specific columns only
table = exp.to_arrow(
    columns=['mz', 'intensity', 'rt', 'precursor_mz']
)

# Export without precursor info (smaller output)
table = exp.to_arrow(include_precursor_info=False)

Semi-Wide Format for ML

# One row per spectrum - good for ML pipelines
table = exp.to_arrow(format='semi_wide')

# Each row has arrays for mz/intensity
for batch in table.to_batches():
    mz_arrays = batch['mz'].to_pylist()
    int_arrays = batch['intensity'].to_pylist()

Export Both Spectra and Chromatograms

# Get both as dict of tables
tables = exp.to_arrow(data='both')
spectra_table = tables['spectra']
chrom_table = tables['chromatograms']

# Or export chromatograms only
chrom_table = exp.to_arrow(data='chromatograms')

Column Discovery

# Discover available columns before export
cols = exp.arrow_columns(data='spectra', format='long')
print(cols)
# ['mz', 'intensity', 'rt', 'spectrum_index', 'ms_level', 'native_id', ...]

# Get columns for semi-wide format
cols = exp.arrow_columns(format='semi_wide')
print(cols)
# ['spectrum_index', 'rt', 'ms_level', 'native_id', 'mz', 'intensity', ...]

Direct Parquet Export (C++ API)

from pyopenms import ArrowExport, ArrowSpectraExportConfig, ParquetWriteConfig

# Configure export
config = ArrowSpectraExportConfig()
config.ms_levels = [2]
config.include_precursor_info = True

# Configure Parquet compression
parquet_config = ParquetWriteConfig()
parquet_config.compression_level = 3  # ZSTD level

# Export directly to Parquet file
exporter = ArrowExport()
exporter.exportSpectraToParquet(exp, "spectra.parquet", config, parquet_config)

🔄 Migration Guide

Methods have been renamed for consistency with pandas/polars conventions:

Old Name (deprecated) New Name
get_df() to_df()
get_df_columns() df_columns()
get_arrow_column_names() arrow_columns()

The old names still work but emit DeprecationWarning:

# Old way (deprecated, still works)
df = exp.get_df()  # DeprecationWarning

# New way (recommended)
df = exp.to_df()

⚡ Performance Notes

Scenario Recommendation
Large files Use to_arrow() + polars for best performance
Pandas analysis to_arrow().to_pandas() is zero-copy with pandas 2.0+
Disk storage Use Parquet export for 3-5x compression
Memory limited Use column selection to reduce memory
ML pipelines Semi-wide format avoids per-peak overhead

📁 Files Changed

Category Files
C++ Core ArrowExport.h, ArrowExport.cpp (+1,685 lines)
Python Bindings ArrowExport.pxd, _arrow_zerocopy.pyx
Python API MSExperiment.pyx addon (+697 lines)
Tests ArrowExport_test.cpp, test_dataframe_columns.py
Other Addons Updated 8 addon files for Pythonic naming

✅ Test Coverage

  • C++ unit tests for Arrow/Parquet export
  • Python tests for to_arrow(), arrow_columns(), to_df()
  • Tests for both long and semi-wide formats
  • Tests for filtering (MS level, RT, m/z)
  • Tests for column selection
  • Backward compatibility tests for deprecated methods

Test plan

  • C++ unit tests (ArrowExport_test.cpp)
  • Python tests (test_dataframe_columns.py)
  • Build with WITH_PARQUET=ON and verify Arrow export works
  • Test Parquet file output

Notes

This is a rebased and squashed version of PR #8577, synced with latest develop.

Refs #8574

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Arrow & Parquet export for spectra and chromatograms (long / semi-wide), with column selection, RT/m/z/MS‑level filters, Parquet write options, and zero‑copy Python exports.
  • API

    • Unified Python export: to_arrow() and get_arrow_column_names(); DataFrame discovery methods renamed to df_columns()/to_df().
  • Documentation

    • Updated README and wrapping guidance for new APIs and return types.
  • Bug Fixes

    • Corrected mzML CV term for time‑delayed fragmentation.
  • Tests

    • Added extensive unit tests for Arrow/Parquet exports and Python paths.

✏️ Tip: You can customize this high-level summary in your review settings.

Add opt-in C++ helper for exporting MSExperiment to Apache Arrow tables
when OpenMS is built with Parquet/Arrow support.

Features:
- Export spectra & chromatograms to Arrow/Parquet formats
- Long or semi-wide layout options
- Configurable columns, RT/m/z/MS-level filters
- Optional precursor and ion-mobility fields
- Parquet compression tuning
- Zero-copy Python interop via pyarrow

The code is guarded by WITH_PARQUET and does not change existing behavior.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@coderabbitai

coderabbitai Bot commented Jan 14, 2026 •

Copy link
Copy Markdown
Contributor

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

📝 Walkthrough

Walkthrough

Adds a WITH_PARQUET‑gated Arrow/Parquet export subsystem: new C++ API (configs, enum, ArrowExport class), Arrow C Data Interface zero‑copy support, Parquet writing, pyOpenMS Cython bindings and extension, build/CMake integration, tests, and a minor mzML CV accession update.

Changes

Cohort / File(s) Summary
Core Arrow/Parquet API
src/openms/include/OpenMS/FORMAT/ArrowExport.h, src/openms/source/FORMAT/ArrowExport.cpp
New public types (ArrowExportFormat, ArrowSpectraExportConfig, ArrowChromatogramExportConfig, ParquetWriteConfig) and OpenMS::ArrowExport static API to export spectra/chromatograms to Arrow (Long/SemiWide), Arrow C Data Interface (zero‑copy), and Parquet (compression, row_group_size, stats); filtering and column selection implemented.
OpenMS CMake sources
src/openms/include/OpenMS/FORMAT/sources.cmake, src/openms/source/FORMAT/sources.cmake
Conditional inclusion of ArrowExport header and addition of ArrowExport.cpp to build under WITH_PARQUET; small HDF5 include block movement noted.
pyOpenMS CMake / Python extension
src/pyOpenMS/CMakeLists.txt
Adds a cythonized Python extension target _arrow_zerocopy / arrow_zerocopy when WITH_PARQUET is enabled (duplicate insertion blocks present); locates Arrow includes, cythonizes sources, links against OpenMS and Arrow, and installs module.
Cython bindings & zero‑copy module
src/pyOpenMS/pxds/ArrowExport.pxd, src/pyOpenMS/pyopenms/_arrow_zerocopy.pyx
pxd bindings for ArrowExport and config structs; _arrow_zerocopy exposes spectra_to_arrow / chromatograms_to_arrow that allocate ArrowSchema/ArrowArray, call C++ export to fill them, and import into PyArrow (zero‑copy).
pyOpenMS MSExperiment API & Python builders
src/pyOpenMS/addons/MSExperiment.pyx
Extended to_arrow() signature/behavior, added get_arrow_column_names(), Python fallback Arrow table builders, and zero‑copy invocation path using the new Cython module.
pxd bindings for Python wrappers
src/pyOpenMS/pxds/ArrowExport.pxd
New Cython declarations exposing ArrowSpectraExportConfig, ArrowChromatogramExportConfig, ArrowExport column discovery and Parquet write methods for use from Cython.
Python API renames across addons
src/pyOpenMS/addons/*.pyx, src/pyOpenMS/README.md, src/pyOpenMS/README_WRAPPING_NEW_CLASSES
Widespread rename of DataFrame APIs: get_df → to_df, get_df_columns → df_columns (and related renames in MRM/FeatureMap/ConsensusMap/MSSpectrum/Mobilogram/etc.), and updated wrapping guidance to prefer libcpp_utf8_output_string in containers.
Python zero‑copy usage & tests
src/pyOpenMS/pyopenms/_arrow_zerocopy.pyx, src/pyOpenMS/tests/unittests/test_dataframe_columns.py
New zero‑copy Cython module implementation; expanded Python tests for to_arrow, column discovery, formats, filters, and empty-case behavior.
C++ tests & test harness
src/tests/class_tests/openms/source/ArrowExport_test.cpp, src/tests/class_tests/openms/CMakeLists.txt, src/tests/class_tests/openms/executables.cmake
New comprehensive C++ unit tests for Arrow/Parquet export, configs, Parquet write checks, and test CMake entries updated to include ArrowExport_test.
Minor mzML handler edit
src/openms/source/FORMAT/HANDLERS/MzMLHandler.cpp
CV accession updated from MS:1000789 to MS:1000790 for time‑delayed fragmentation in two write locations.

Sequence Diagram(s)

sequenceDiagram
    participant User as Python User
    participant MSExp as MSExperiment (pyopenms)
    participant ZeroCopy as _arrow_zerocopy (Cython)
    participant ArrowExport as ArrowExport (C++)
    participant ArrowCDI as Arrow C Data Interface
    participant PyArrow as PyArrow

    User->>MSExp: to_arrow(format, filters, columns)
    MSExp->>ZeroCopy: spectra_to_arrow/chromatograms_to_arrow(exp_ptr, config)
    ZeroCopy->>ArrowExport: export...ToArrowCDataInterface(exp, config, schema_ptr, array_ptr)
    ArrowExport->>ArrowCDI: populate schema & array (zero-copy buffers)
    ArrowCDI-->>ZeroCopy: filled schema & array
    ZeroCopy->>PyArrow: RecordBatch._import_from_c(schema_ptr, array_ptr)
    PyArrow-->>User: Table (zero-copy)
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

Suggested reviewers

  • jpfeuffer
  • poshul
  • cbielow

Poem

🐇
I hop through rows and lists so light,
From C++ burrow to Python bright,
Zero‑copy leaps without a fight,
Spectra and chroma all aligned,
Parquet keeps each byte just right.

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title '[FEATURE] Add Arrow/Parquet export for MSExperiment' accurately summarizes the main change: introducing Arrow/Parquet export functionality for MSExperiment data structures.
Docstring Coverage ✅ Passed Docstring coverage is 92.04% which is sufficient. The required threshold is 80.00%.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

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

✨ Finishing touches
  • 📝 Generate docstrings

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.

Copilot AI 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.

Pull request overview

This PR adds Arrow/Parquet export functionality for MSExperiment, enabling efficient columnar data export for mass spectrometry data. The feature is opt-in and guarded by WITH_PARQUET build flag.

Changes:

  • New C++ ArrowExport class with filtering, format options (long/semi-wide), and Parquet compression support
  • Python bindings via pyOpenMS with zero-copy interop through Arrow C Data Interface
  • Comprehensive test coverage for C++ and Python

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
ArrowExport.h/.cpp Core C++ implementation for exporting MSExperiment to Arrow/Parquet
ArrowExport.pxd Cython declarations for pyOpenMS bindings
_arrow_zerocopy.pyx Zero-copy Python/Arrow interop using C Data Interface
MSExperiment.pyx Python-facing to_arrow() and get_arrow_columns() methods with fallback
ArrowExport_test.cpp Comprehensive C++ unit tests
test_dataframe_columns.py Python unit tests for the new API
MzMLHandler.cpp Unrelated bug fix (corrected CV term accession)
sources.cmake files Build system updates to include new files
CMakeLists.txt CMake configuration for Arrow zerocopy module

@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

🤖 Fix all issues with AI agents
In `@src/tests/class_tests/openms/source/ArrowExport_test.cpp`:
- Around line 102-245: Tests assert exact Arrow physical types for fields (mz,
intensity, rt, ms_level) despite the API being marked `@experimental`; relax these
assertions in ArrowExport_test.cpp's exportSpectraToArrow tests (the sections
that get schema and check mz_field, intensity_field, rt_field, ms_level_field)
so they validate structural/behavioral properties instead of exact arrow::Type
IDs — e.g., ensure fields exist, mz is a floating-point type (double or float),
intensity is numeric, rt is scalar numeric (not list), ms_level is an
integer-like scalar, and list-vs-scalar expectations (for SemiWide) remain;
alternatively if you want to lock the contract, remove `@experimental` in
OpenMS/FORMAT/ArrowExport.h and keep exact-type assertions, but do one of the
two and make the tests consistent with that choice.
🧹 Nitpick comments (3)
src/pyOpenMS/addons/MSExperiment.pyx (1)

760-774: Consider using get_data() for more efficient ion mobility array access.

Line 764 constructs the numpy array by iterating element-by-element, which is inefficient for large arrays. If FloatDataArray has a get_data() method (similar to other pyOpenMS containers), it would be more efficient.

♻️ Suggested optimization
                if spec.containsIMData():
                    im_idx, _ = spec.getIMData()
                    im_arr = spec.getFloatDataArrays()[im_idx]
-                   im_data = np.array([im_arr[i] for i in range(len(im_arr))])
+                   im_data = np.asarray(im_arr.get_data())
src/tests/class_tests/openms/source/ArrowExport_test.cpp (1)

441-574: Parquet export tests are good end-to-end smoke checks; consider using a .parquet suffix for tmp files.

Not required for correctness, but it makes local debugging and tooling (file association/readers) nicer.

Proposed tweak (keep behavior identical)
-  String filename;
-  NEW_TMP_FILE(filename);
+  String filename;
+  NEW_TMP_FILE(filename);
+  filename += ".parquet";
src/openms/include/OpenMS/FORMAT/ArrowExport.h (1)

104-121: Consider adding @note documentation for consistency with ArrowSpectraExportConfig.

The struct is functionally correct, but the Doxygen documentation is less detailed than ArrowSpectraExportConfig. Adding @note sections explaining the semantics (e.g., "When columns is empty, all available columns are exported" and "RT ranges of (0, 0) indicate no filtering") would improve consistency across the API.

📝 Suggested documentation enhancement
 /**
   `@brief` Configuration for Arrow export of chromatogram data
+
+  Allows filtering by RT range and column selection.
+
+  `@note` When columns is empty, all available columns are exported.
+  `@note` RT ranges of (0, 0) indicate no filtering.
 */
 struct OPENMS_DLLAPI ArrowChromatogramExportConfig
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 87cad5a and dc0561e.

📒 Files selected for processing (13)
  • src/openms/include/OpenMS/FORMAT/ArrowExport.h
  • src/openms/include/OpenMS/FORMAT/sources.cmake
  • src/openms/source/FORMAT/ArrowExport.cpp
  • src/openms/source/FORMAT/HANDLERS/MzMLHandler.cpp
  • src/openms/source/FORMAT/sources.cmake
  • src/pyOpenMS/CMakeLists.txt
  • src/pyOpenMS/addons/MSExperiment.pyx
  • src/pyOpenMS/pxds/ArrowExport.pxd
  • src/pyOpenMS/pyopenms/_arrow_zerocopy.pyx
  • src/pyOpenMS/tests/unittests/test_dataframe_columns.py
  • src/tests/class_tests/openms/CMakeLists.txt
  • src/tests/class_tests/openms/executables.cmake
  • src/tests/class_tests/openms/source/ArrowExport_test.cpp
🧰 Additional context used
📓 Path-based instructions (19)
src/tests/class_tests/**/executables.cmake

📄 CodeRabbit inference engine (AGENTS.md)

Register new C++ unit tests by adding test source files to the appropriate executables.cmake

Files:

  • src/tests/class_tests/openms/executables.cmake
src/**

📄 CodeRabbit inference engine (AGENTS.md)

File extensions should be lowercase, except for ML, XML, and mzData which use specific capitalization

Files:

  • src/tests/class_tests/openms/executables.cmake
  • src/openms/source/FORMAT/sources.cmake
  • src/tests/class_tests/openms/source/ArrowExport_test.cpp
  • src/openms/source/FORMAT/HANDLERS/MzMLHandler.cpp
  • src/pyOpenMS/pyopenms/_arrow_zerocopy.pyx
  • src/pyOpenMS/CMakeLists.txt
  • src/pyOpenMS/tests/unittests/test_dataframe_columns.py
  • src/pyOpenMS/pxds/ArrowExport.pxd
  • src/pyOpenMS/addons/MSExperiment.pyx
  • src/tests/class_tests/openms/CMakeLists.txt
  • src/openms/source/FORMAT/ArrowExport.cpp
  • src/openms/include/OpenMS/FORMAT/ArrowExport.h
  • src/openms/include/OpenMS/FORMAT/sources.cmake
src/tests/class_tests/openms/**/*.cpp

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Write unit tests for new functionality

Files:

  • src/tests/class_tests/openms/source/ArrowExport_test.cpp
src/tests/class_tests/**/*_test.cpp

📄 CodeRabbit inference engine (AGENTS.md)

src/tests/class_tests/**/*_test.cpp: Use START_TEST, START_SECTION, and END_SECTION macros from OpenMS/CONCEPT/ClassTest.h for unit test structure
Wrap template method calls with 2 or more arguments in parentheses within START_SECTION macro to avoid parser issues
Use NEW_TMP_FILE(filename) for each output file in tests to avoid side effects and conflicts
Use FuzzyDiff for numeric comparisons in tests; keep test data small; use whitelist for unstable lines

Files:

  • src/tests/class_tests/openms/source/ArrowExport_test.cpp
src/openms/**/*.{cpp,h,hpp,cc,cxx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

src/openms/**/*.{cpp,h,hpp,cc,cxx}: Follow the existing C++ coding conventions in the codebase
Use the established naming patterns for classes, methods, and variables
Use OpenMS data structures (e.g., MSExperiment, FeatureMap, PeptideIdentification)
Follow the established error handling patterns
Utilize OpenMS logging mechanisms
Be mindful of memory usage when processing large datasets
Consider algorithmic complexity for data processing operations
Use appropriate OpenMS containers and algorithms

Files:

  • src/openms/source/FORMAT/HANDLERS/MzMLHandler.cpp
  • src/openms/source/FORMAT/ArrowExport.cpp
  • src/openms/include/OpenMS/FORMAT/ArrowExport.h
src/openms/**/*.cpp

📄 CodeRabbit inference engine (AGENTS.md)

Use using namespace and using std::... declarations allowed only in implementation files

Files:

  • src/openms/source/FORMAT/HANDLERS/MzMLHandler.cpp
  • src/openms/source/FORMAT/ArrowExport.cpp
src/openms/source/**/*.cpp

📄 CodeRabbit inference engine (AGENTS.md)

src/openms/source/**/*.cpp: Each C++ implementation file must have a file preamble containing the $Maintainer:$ marker
File names must match the class name; store one class per file with corresponding .h and .cpp pair
Do not modify files in src/openms/extern/; this directory contains third-party vendored code

Files:

  • src/openms/source/FORMAT/HANDLERS/MzMLHandler.cpp
  • src/openms/source/FORMAT/ArrowExport.cpp
src/openms/**/*.{h,cpp}

📄 CodeRabbit inference engine (AGENTS.md)

src/openms/**/*.{h,cpp}: Use 2-space indentation (not tabs) with Unix line endings (LF) for C++ files
Use lowerCamelCase for method and function names
Use snake_case for variable and parameter names
Private and protected member variables must end with a trailing underscore (e.g., intensity_)
Use UPPER_SNAKE_CASE for enum values and preprocessor macros
Opening and closing braces must align and be on separate lines; always use braces even for single-line blocks (trivial one-liners may stay on one line)
Add a space after control flow keywords (if, for, while, switch)
Add spaces around binary operators for readability
Use OpenMS primitive types from OpenMS/CONCEPT/Types.h (e.g., Size, SignedSize) for STL container sizes instead of std::size_t
Avoid pointers; prefer references where possible for safer memory management
Use Doxygen documentation with /** */ block comments and @ tags (not backslash); @brief is required
Comments should comprise at least ~5% of code; use // style comments in plain English describing the next few lines
Avoid std::endl for performance; prefer \n when outputting to streams
Use OpenMS logging macros and OpenMS::LogStream instead of std::cout or std::cerr
Exceptions must derive from Exception::Base; throw with file/line/OPENMS_PRETTY_FUNCTION; catch by reference; document possible exceptions in Doxygen
Follow Rule-of-0 (no custom constructors/destructors) or Rule-of-6 (all six special member functions); do not mix partial implementations
Use OPENMS_LOG_WARN, OPENMS_LOG_INFO, OPENMS_LOG_DEBUG and other OpenMS logging macros for all logging output
Prefer String::fromNumber() and String::toDouble() from OpenMS for numeric formatting and parsing over standard C++ methods

Files:

  • src/openms/source/FORMAT/HANDLERS/MzMLHandler.cpp
  • src/openms/source/FORMAT/ArrowExport.cpp
  • src/openms/include/OpenMS/FORMAT/ArrowExport.h
src/pyOpenMS/**/*.{py,pyx,pxd}

📄 CodeRabbit inference engine (AGENTS.md)

Use 4-space indentation (PEP 8 standard) for Python and Cython files

Files:

  • src/pyOpenMS/pyopenms/_arrow_zerocopy.pyx
  • src/pyOpenMS/tests/unittests/test_dataframe_columns.py
  • src/pyOpenMS/pxds/ArrowExport.pxd
  • src/pyOpenMS/addons/MSExperiment.pyx
src/pyOpenMS/**/*.pyx

📄 CodeRabbit inference engine (AGENTS.md)

src/pyOpenMS/**/*.pyx: Use snake_case for Python-facing method names and DataFrame column names in pyOpenMS
Avoid custom __init__ in Cython classes unless required; it overrides autowrap dispatchers and causes unexpected behavior
Autowrap returns Python strings; do NOT call .decode() on autowrap return values
Avoid cdef typed variables for autowrap return values inside def methods; use Python type checks instead
Keep addon methods minimal; avoid redundant aliases that duplicate C++ functionality

Files:

  • src/pyOpenMS/pyopenms/_arrow_zerocopy.pyx
  • src/pyOpenMS/addons/MSExperiment.pyx
**/CMakeLists.txt

📄 CodeRabbit inference engine (CLAUDE.md)

**/CMakeLists.txt: Use -DBOOST_USE_STATIC_LIBS=OFF when configuring CMake to avoid Boost linker errors on macOS due to incomplete transitive dependency declarations
Use semicolons (;) as list separators in CMAKE_PREFIX_PATH when using the -D CMake option

Files:

  • src/pyOpenMS/CMakeLists.txt
  • src/tests/class_tests/openms/CMakeLists.txt
src/pyOpenMS/tests/**/*.py

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Write pyOpenMS tests for new Python bindings

Files:

  • src/pyOpenMS/tests/unittests/test_dataframe_columns.py
src/pyOpenMS/**/*.py

📄 CodeRabbit inference engine (CLAUDE.md)

src/pyOpenMS/**/*.py: Use PeptideIdentificationList type (not Python list) when calling setPeptideIdentifications() in pyOpenMS
Only use valid amino acid letters (A-Z except B, J, O, U, X, Z) with AASequence.fromString() in pyOpenMS - numbers and special characters will fail

Files:

  • src/pyOpenMS/tests/unittests/test_dataframe_columns.py
src/pyOpenMS/pxds/**/*.pxd

📄 CodeRabbit inference engine (CLAUDE.md)

src/pyOpenMS/pxds/**/*.pxd: Do not add Python-only method declarations to .pxd files - they attempt to wrap non-existent C++ methods
Ensure autowrap annotation format like # wrap-doc: is properly indented inside the class block with strict whitespace parsing

src/pyOpenMS/pxds/**/*.pxd: Declare default and copy constructors in .pxd files for all wrapped classes
Use cimport for Cython imports, not Python import, in .pxd declaration files
For non-inheriting classes in .pxd files, use cdef cppclass ClassName: without a base class specification
Wrap-doc comments must use exactly # (hash + 2 spaces) for all continuation lines; # or # (1 space) will break the parser
Autowrap hints (wrap-ignore, wrap-as, wrap-iter-begin/end, wrap-instances, wrap-attach, wrap-upper-limit, wrap-inherits) control wrapping behavior in .pxd files

Files:

  • src/pyOpenMS/pxds/ArrowExport.pxd
src/pyOpenMS/**/*.pxd

📄 CodeRabbit inference engine (AGENTS.md)

src/pyOpenMS/**/*.pxd: Keep .pxd signatures synchronized with C++ API changes; update or remove wrap-ignore hints when wrapping changes
Do not add Python-only methods to .pxd files; use addons or _dataframes.py wrappers instead

Files:

  • src/pyOpenMS/pxds/ArrowExport.pxd
src/pyOpenMS/addons/**/*.pyx

📄 CodeRabbit inference engine (CLAUDE.md)

src/pyOpenMS/addons/**/*.pyx: Create addon files at src/pyOpenMS/addons/<ClassName>.pyx to add custom Python methods like __repr__ and __len__ to generated Cython classes
In pyOpenMS addon files, indent custom methods with 4 spaces without declaring a class - methods are injected into the generated class
Implement get_data_dict() in Cython addons to return numpy arrays, and wrap with get_df() in _dataframes.py to add pandas functionality
Do not add custom __init__ methods in pyOpenMS addon files unless you need special behavior - autowrap auto-generates __init__ dispatchers for multiple constructors
Do not call .decode('utf-8') on return values from autowrap-wrapped methods like toString() and getSequence() - autowrap already returns Python strings
Do not declare cdef class ClassName: in pyOpenMS addon files - methods are injected as indented code into the generated class
Do not use cdef typed variables for autowrap return values inside def methods - use Python type introspection instead
Use __str__ for simple/short output in pyOpenMS classes and __repr__ for detailed debug info with class name and key properties
Use self.size() or wrap with __len__ for container-like pyOpenMS classes
Keep pyOpenMS addons minimal - only add methods that cannot be auto-generated (like __repr__, __str__), not redundant aliases

src/pyOpenMS/addons/**/*.pyx: Python-only methods in addons must not include cdef class declarations; use only Python def syntax with proper indentation
Implement get_data_dict() method returning numpy arrays for DataFrame conversion; implement get_df() in src/pyOpenMS/pyopenms/_dataframes.py to wrap with pandas

Files:

  • src/pyOpenMS/addons/MSExperiment.pyx
src/openms/include/OpenMS/**/*.h

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Add Doxygen comments for new public methods and classes

Files:

  • src/openms/include/OpenMS/FORMAT/ArrowExport.h
src/openms/**/*.h

📄 CodeRabbit inference engine (AGENTS.md)

src/openms/**/*.h: Do not add using namespace or using std::... declarations in header files
Use PascalCase for class names, namespaces, and types

Files:

  • src/openms/include/OpenMS/FORMAT/ArrowExport.h
src/openms/include/**/*.h

📄 CodeRabbit inference engine (AGENTS.md)

src/openms/include/**/*.h: Each C++ header file must have a file preamble containing the $Maintainer:$ marker
Export all non-template classes, structs, functions, and global variables using the OPENMS_DLLAPI macro
Do not include OPENMS_DLLAPI on template classes or functions
File names must match the class name; store one class per file with corresponding .h and .cpp pair
Use forward declarations in headers instead of including full definitions when possible; only include base class headers and headers for non-pointer members
Include Doxygen @brief documentation on all public classes and methods with parameter directions [in], [out], or [in,out]
Accessor methods should use get/set pairs for protected/private members; do not use reference getters for primitive types
Include @ingroup Doxygen tags to categorize classes (e.g., @ingroup Analysis_ID, @ingroup Analysis) for documentation organization
Use @todo Doxygen tag with assignee name (e.g., @todo JohnDoe fix this) for tracking pending work

Files:

  • src/openms/include/OpenMS/FORMAT/ArrowExport.h
🧠 Learnings (44)
📓 Common learnings
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/openms/**/*.{cpp,h,hpp,cc,cxx} : Use OpenMS data structures (e.g., MSExperiment, FeatureMap, PeptideIdentification)
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-14T18:52:46.294Z
Learning: Applies to src/pyOpenMS/addons/**/*.pyx : Implement `get_data_dict()` method returning numpy arrays for DataFrame conversion; implement `get_df()` in `src/pyOpenMS/pyopenms/_dataframes.py` to wrap with pandas
📚 Learning: 2026-01-14T18:52:46.294Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-14T18:52:46.294Z
Learning: Applies to src/tests/class_tests/**/executables.cmake : Register new C++ unit tests by adding test source files to the appropriate `executables.cmake`

Applied to files:

  • src/tests/class_tests/openms/executables.cmake
📚 Learning: 2025-09-03T12:58:20.032Z
Learnt from: timosachsenberg
Repo: OpenMS/OpenMS PR: 8177
File: src/tests/topp/CMakeLists.txt:1857-1865
Timestamp: 2025-09-03T12:58:20.032Z
Learning: OpenMS tests: When adding new TOPP tests in src/tests/topp/CMakeLists.txt that compare outputs via FuzzyDiff, always add set_tests_properties("<tool>_<n>_out<m>" PROPERTIES DEPENDS "<tool>_<n>") to avoid flakiness under parallel CTest runs.

Applied to files:

  • src/tests/class_tests/openms/executables.cmake
  • src/tests/class_tests/openms/source/ArrowExport_test.cpp
  • src/tests/class_tests/openms/CMakeLists.txt
📚 Learning: 2026-01-14T18:52:46.294Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-14T18:52:46.294Z
Learning: Applies to src/tests/class_tests/openms_gui/**/*_test.cpp : GUI tests use Qt TestLib macros; set `QT_QPA_PLATFORM=minimal` environment variable for headless test execution

Applied to files:

  • src/tests/class_tests/openms/executables.cmake
  • src/tests/class_tests/openms/source/ArrowExport_test.cpp
  • src/tests/class_tests/openms/CMakeLists.txt
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/tests/class_tests/openms/**/*.cpp : Write unit tests for new functionality

Applied to files:

  • src/tests/class_tests/openms/executables.cmake
  • src/tests/class_tests/openms/source/ArrowExport_test.cpp
  • src/tests/class_tests/openms/CMakeLists.txt
📚 Learning: 2026-01-14T18:52:46.294Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-14T18:52:46.294Z
Learning: Applies to src/tests/topp/**/*.cpp : TOPP integration tests must be registered in `src/tests/topp/CMakeLists.txt` with corresponding test data

Applied to files:

  • src/tests/class_tests/openms/executables.cmake
  • src/tests/class_tests/openms/CMakeLists.txt
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/tests/class_tests/openms/*Test.cpp : Follow naming convention: `ClassNameTest.cpp` for `ClassName`

Applied to files:

  • src/tests/class_tests/openms/executables.cmake
  • src/tests/class_tests/openms/source/ArrowExport_test.cpp
  • src/tests/class_tests/openms/CMakeLists.txt
📚 Learning: 2026-01-14T18:52:46.294Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-14T18:52:46.294Z
Learning: Applies to src/tests/class_tests/**/*_test.cpp : Use `FuzzyDiff` for numeric comparisons in tests; keep test data small; use whitelist for unstable lines

Applied to files:

  • src/tests/class_tests/openms/executables.cmake
  • src/tests/class_tests/openms/source/ArrowExport_test.cpp
  • src/tests/class_tests/openms/CMakeLists.txt
📚 Learning: 2026-01-14T18:52:46.294Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-14T18:52:46.294Z
Learning: Applies to src/tests/class_tests/**/*_test.cpp : Use `NEW_TMP_FILE(filename)` for each output file in tests to avoid side effects and conflicts

Applied to files:

  • src/tests/class_tests/openms/executables.cmake
📚 Learning: 2026-01-14T18:52:46.294Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-14T18:52:46.294Z
Learning: Applies to src/tests/class_tests/**/*_test.cpp : Use `START_TEST`, `START_SECTION`, and `END_SECTION` macros from `OpenMS/CONCEPT/ClassTest.h` for unit test structure

Applied to files:

  • src/tests/class_tests/openms/executables.cmake
  • src/tests/class_tests/openms/source/ArrowExport_test.cpp
  • src/tests/class_tests/openms/CMakeLists.txt
📚 Learning: 2026-01-14T18:52:46.294Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-14T18:52:46.294Z
Learning: Applies to src/topp/**/*.cpp : TOPP tools must be registered in `src/topp/executables.cmake` and `src/openms/source/APPLICATIONS/ToolHandler.cpp`

Applied to files:

  • src/tests/class_tests/openms/executables.cmake
  • src/openms/source/FORMAT/sources.cmake
📚 Learning: 2026-01-14T18:52:46.294Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-14T18:52:46.294Z
Learning: Applies to src/openms/source/**/*.cpp : Do not modify files in `src/openms/extern/`; this directory contains third-party vendored code

Applied to files:

  • src/openms/source/FORMAT/sources.cmake
  • src/tests/class_tests/openms/CMakeLists.txt
  • src/openms/include/OpenMS/FORMAT/sources.cmake
📚 Learning: 2026-01-14T18:52:46.294Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-14T18:52:46.294Z
Learning: Applies to src/openms/source/**/*.cpp : Each C++ implementation file must have a file preamble containing the `$Maintainer:$` marker

Applied to files:

  • src/openms/source/FORMAT/sources.cmake
  • src/openms/include/OpenMS/FORMAT/sources.cmake
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/openms/**/*.{cpp,h,hpp,cc,cxx} : Use OpenMS data structures (e.g., MSExperiment, FeatureMap, PeptideIdentification)

Applied to files:

  • src/tests/class_tests/openms/source/ArrowExport_test.cpp
  • src/pyOpenMS/addons/MSExperiment.pyx
  • src/openms/source/FORMAT/ArrowExport.cpp
  • src/openms/include/OpenMS/FORMAT/ArrowExport.h
📚 Learning: 2025-12-04T16:25:07.026Z
Learnt from: timosachsenberg
Repo: OpenMS/OpenMS PR: 8177
File: src/openms/source/FORMAT/HANDLERS/MzMLHandler.cpp:5069-5074
Timestamp: 2025-12-04T16:25:07.026Z
Learning: In OpenMS mzML writing, PSI-MS term MS:1003441 "ion mobility centroid frame" is a spectrum-level cvParam. It should be written at spectrum level (not scan level).

Applied to files:

  • src/openms/source/FORMAT/HANDLERS/MzMLHandler.cpp
📚 Learning: 2025-07-29T10:06:14.860Z
Learnt from: poshul
Repo: OpenMS/OpenMS PR: 8133
File: src/tests/class_tests/openms/data/MRMAssay_uisTransitions_output_4_boost58.TraML:30-30
Timestamp: 2025-07-29T10:06:14.860Z
Learning: The user corrected me that my claim about MS:1003050 being the accession for "peptidoform group label" was inaccurate. I should verify PSI-MS CV terms before making such claims.

Applied to files:

  • src/openms/source/FORMAT/HANDLERS/MzMLHandler.cpp
📚 Learning: 2025-07-29T10:06:14.860Z
Learnt from: poshul
Repo: OpenMS/OpenMS PR: 8133
File: src/tests/class_tests/openms/data/MRMAssay_uisTransitions_output_4_boost58.TraML:30-30
Timestamp: 2025-07-29T10:06:14.860Z
Learning: MS:1000893 in PSI-MS controlled vocabulary refers to "peptide group label", not "peptidoform group label". There is no official PSI-MS CV term for "peptidoform group label" with accession MS:1003050 as I incorrectly claimed.

Applied to files:

  • src/openms/source/FORMAT/HANDLERS/MzMLHandler.cpp
📚 Learning: 2026-01-14T18:52:46.294Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-14T18:52:46.294Z
Learning: Applies to src/pyOpenMS/**/*.pyx : Keep addon methods minimal; avoid redundant aliases that duplicate C++ functionality

Applied to files:

  • src/pyOpenMS/pyopenms/_arrow_zerocopy.pyx
  • src/pyOpenMS/CMakeLists.txt
  • src/pyOpenMS/pxds/ArrowExport.pxd
  • src/pyOpenMS/addons/MSExperiment.pyx
📚 Learning: 2026-01-14T18:52:46.294Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-14T18:52:46.294Z
Learning: Applies to src/pyOpenMS/pxds/**/*.pxd : Use `cimport` for Cython imports, not Python `import`, in `.pxd` declaration files

Applied to files:

  • src/pyOpenMS/pyopenms/_arrow_zerocopy.pyx
  • src/pyOpenMS/CMakeLists.txt
  • src/pyOpenMS/pxds/ArrowExport.pxd
📚 Learning: 2026-01-14T18:52:46.294Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-14T18:52:46.294Z
Learning: Applies to src/pyOpenMS/**/*.pxd : Do not add Python-only methods to `.pxd` files; use addons or `_dataframes.py` wrappers instead

Applied to files:

  • src/pyOpenMS/pyopenms/_arrow_zerocopy.pyx
  • src/pyOpenMS/CMakeLists.txt
  • src/pyOpenMS/pxds/ArrowExport.pxd
  • src/pyOpenMS/addons/MSExperiment.pyx
📚 Learning: 2026-01-14T18:51:46.085Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-01-14T18:51:46.085Z
Learning: Applies to src/pyOpenMS/addons/**/*.pyx : Implement `get_data_dict()` in Cython addons to return numpy arrays, and wrap with `get_df()` in `_dataframes.py` to add pandas functionality

Applied to files:

  • src/pyOpenMS/pyopenms/_arrow_zerocopy.pyx
  • src/pyOpenMS/addons/MSExperiment.pyx
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/pyOpenMS/**/*.h : Add Doxygen comments for new public methods and classes in pyOpenMS bindings

Applied to files:

  • src/pyOpenMS/pyopenms/_arrow_zerocopy.pyx
  • src/pyOpenMS/CMakeLists.txt
  • src/pyOpenMS/pxds/ArrowExport.pxd
  • src/pyOpenMS/addons/MSExperiment.pyx
📚 Learning: 2026-01-14T18:52:46.294Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-14T18:52:46.294Z
Learning: Applies to src/pyOpenMS/addons/**/*.pyx : Implement `get_data_dict()` method returning numpy arrays for DataFrame conversion; implement `get_df()` in `src/pyOpenMS/pyopenms/_dataframes.py` to wrap with pandas

Applied to files:

  • src/pyOpenMS/pyopenms/_arrow_zerocopy.pyx
  • src/pyOpenMS/addons/MSExperiment.pyx
📚 Learning: 2026-01-14T18:52:46.294Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-14T18:52:46.294Z
Learning: Applies to src/pyOpenMS/**/*.pxd : Keep `.pxd` signatures synchronized with C++ API changes; update or remove `wrap-ignore` hints when wrapping changes

Applied to files:

  • src/pyOpenMS/pyopenms/_arrow_zerocopy.pyx
  • src/pyOpenMS/CMakeLists.txt
  • src/pyOpenMS/pxds/ArrowExport.pxd
  • src/pyOpenMS/addons/MSExperiment.pyx
📚 Learning: 2026-01-14T18:52:46.294Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-14T18:52:46.294Z
Learning: Regenerate pyOpenMS after addon changes: delete `OpenMS-build/pyOpenMS/.cpp_extension_generated` and rebuild with `cmake --build . --target pyopenms`

Applied to files:

  • src/pyOpenMS/CMakeLists.txt
📚 Learning: 2026-01-12T12:26:12.890Z
Learnt from: jpfeuffer
Repo: OpenMS/OpenMS PR: 8530
File: src/pyOpenMS/CMakeLists.txt:78-80
Timestamp: 2026-01-12T12:26:12.890Z
Learning: In the OpenMS build system (src/pyOpenMS/CMakeLists.txt and related), when building pyOpenMS in standalone mode (via find_package(OpenMS REQUIRED)), the OpenMSConfig.cmake automatically finds all necessary public dependencies including Qt6, so Qt6_VERSION and related variables are available in both standalone and in-tree builds.

Applied to files:

  • src/pyOpenMS/CMakeLists.txt
  • src/tests/class_tests/openms/CMakeLists.txt
📚 Learning: 2026-01-14T18:52:46.294Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-14T18:52:46.294Z
Learning: When making C++ API changes: update `.pxd` files, update pyOpenMS addons, update tests, and update relevant documentation; tag commits with `API`

Applied to files:

  • src/pyOpenMS/CMakeLists.txt
  • src/pyOpenMS/pxds/ArrowExport.pxd
  • src/pyOpenMS/addons/MSExperiment.pyx
  • src/tests/class_tests/openms/CMakeLists.txt
  • src/openms/include/OpenMS/FORMAT/ArrowExport.h
📚 Learning: 2026-01-14T18:51:46.085Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-01-14T18:51:46.085Z
Learning: Applies to src/pyOpenMS/addons/**/*.pyx : Keep pyOpenMS addons minimal - only add methods that cannot be auto-generated (like `__repr__`, `__str__`), not redundant aliases

Applied to files:

  • src/pyOpenMS/CMakeLists.txt
  • src/pyOpenMS/addons/MSExperiment.pyx
📚 Learning: 2026-01-14T18:52:46.294Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-14T18:52:46.294Z
Learning: When adding a new C++ class: add `.h`/`.cpp` pair, include Doxygen documentation, write a class test, add `OPENMS_DLLAPI` to class, and register in CMake lists

Applied to files:

  • src/pyOpenMS/CMakeLists.txt
  • src/tests/class_tests/openms/CMakeLists.txt
📚 Learning: 2026-01-14T18:51:46.085Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-01-14T18:51:46.085Z
Learning: After modifying pyOpenMS addon files, delete the `.cpp_extension_generated` stamp file and rebuild to force code regeneration

Applied to files:

  • src/pyOpenMS/CMakeLists.txt
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/pyOpenMS/tests/**/*.py : Write pyOpenMS tests for new Python bindings

Applied to files:

  • src/pyOpenMS/tests/unittests/test_dataframe_columns.py
📚 Learning: 2026-01-04T21:35:37.785Z
Learnt from: timosachsenberg
Repo: OpenMS/OpenMS PR: 8588
File: src/pyOpenMS/tests/unittests/test_TargetedQuantitation.py:1-456
Timestamp: 2026-01-04T21:35:37.785Z
Learning: For Python files in the repository, follow PEP 8: use 4-space indentation, avoid tabs, and ensure Unix LF line endings. The 2-space indentation and Unix line endings guideline applies to C/Cython in their respective languages; Python files should adhere to Python style (PEP 8) regardless of other language rules.

Applied to files:

  • src/pyOpenMS/tests/unittests/test_dataframe_columns.py
📚 Learning: 2026-01-14T18:52:46.294Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-14T18:52:46.294Z
Learning: Applies to src/pyOpenMS/pxds/**/*.pxd : Declare default and copy constructors in `.pxd` files for all wrapped classes

Applied to files:

  • src/pyOpenMS/pxds/ArrowExport.pxd
📚 Learning: 2026-01-14T18:51:46.085Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-01-14T18:51:46.085Z
Learning: Applies to src/pyOpenMS/pxds/**/*.pxd : Do not add Python-only method declarations to `.pxd` files - they attempt to wrap non-existent C++ methods

Applied to files:

  • src/pyOpenMS/pxds/ArrowExport.pxd
  • src/pyOpenMS/addons/MSExperiment.pyx
📚 Learning: 2025-06-16T15:48:09.667Z
Learnt from: FreezB11
Repo: OpenMS/OpenMS PR: 7969
File: src/pyOpenMS/pxds/TMTThirtyTwoPlexQuantitationMethod.pxd:4-4
Timestamp: 2025-06-16T15:48:09.667Z
Learning: In OpenMS .pxd files, the established pattern for extern from statements is to include angle brackets inside the string literal, like `cdef extern from "<OpenMS/PATH/TO/FILE.h>" namespace "OpenMS":`. This is consistent across all existing quantitation method .pxd files and other .pxd files in the OpenMS codebase.

Applied to files:

  • src/pyOpenMS/pxds/ArrowExport.pxd
📚 Learning: 2025-11-18T20:08:08.900Z
Learnt from: timosachsenberg
Repo: OpenMS/OpenMS PR: 8374
File: src/pyOpenMS/pxds/SimpleSVM.pxd:0-0
Timestamp: 2025-11-18T20:08:08.900Z
Learning: In pyOpenMS .pxd files, copy constructors should be declared for wrapped C++ classes (e.g., `ClassName(ClassName&) except + nogil`) even when the C++ class has a deleted copy constructor. This is a standard pyOpenMS/Cython convention required for proper wrapper generation and Python object semantics.

Applied to files:

  • src/pyOpenMS/pxds/ArrowExport.pxd
📚 Learning: 2026-01-14T18:52:46.294Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-14T18:52:46.294Z
Learning: Applies to src/openms/include/**/*.h : Export all non-template classes, structs, functions, and global variables using the `OPENMS_DLLAPI` macro

Applied to files:

  • src/openms/source/FORMAT/ArrowExport.cpp
  • src/openms/include/OpenMS/FORMAT/ArrowExport.h
  • src/openms/include/OpenMS/FORMAT/sources.cmake
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/openms/include/OpenMS/**/*.h : Add Doxygen comments for new public methods and classes

Applied to files:

  • src/openms/source/FORMAT/ArrowExport.cpp
  • src/openms/include/OpenMS/FORMAT/ArrowExport.h
  • src/openms/include/OpenMS/FORMAT/sources.cmake
📚 Learning: 2026-01-14T18:52:46.294Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-14T18:52:46.294Z
Learning: Applies to src/openms/include/**/*.h : Use forward declarations in headers instead of including full definitions when possible; only include base class headers and headers for non-pointer members

Applied to files:

  • src/openms/include/OpenMS/FORMAT/sources.cmake
📚 Learning: 2026-01-14T18:52:46.294Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-14T18:52:46.294Z
Learning: Applies to src/openms/include/**/*.h : Each C++ header file must have a file preamble containing the `$Maintainer:$` marker

Applied to files:

  • src/openms/include/OpenMS/FORMAT/sources.cmake
📚 Learning: 2026-01-14T18:52:46.294Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-14T18:52:46.294Z
Learning: Applies to src/openms/include/**/*.h : Do not include `OPENMS_DLLAPI` on template classes or functions

Applied to files:

  • src/openms/include/OpenMS/FORMAT/sources.cmake
📚 Learning: 2026-01-14T18:52:46.294Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-14T18:52:46.294Z
Learning: Applies to src/openms/**/*.h : Do not add `using namespace` or `using std::...` declarations in header files

Applied to files:

  • src/openms/include/OpenMS/FORMAT/sources.cmake
📚 Learning: 2026-01-14T18:52:46.294Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-14T18:52:46.294Z
Learning: Applies to src/openms/**/*.{h,cpp} : Use Doxygen documentation with `/** */` block comments and `@` tags (not backslash); `brief` is required

Applied to files:

  • src/openms/include/OpenMS/FORMAT/sources.cmake
📚 Learning: 2026-01-14T18:52:46.294Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-14T18:52:46.294Z
Learning: Applies to src/openms/**/*.cpp : Use `using namespace` and `using std::...` declarations allowed only in implementation files

Applied to files:

  • src/openms/include/OpenMS/FORMAT/sources.cmake
🧬 Code graph analysis (3)
src/tests/class_tests/openms/source/ArrowExport_test.cpp (2)
src/openms/source/FORMAT/ArrowExport.cpp (10)
  • exportSpectraToArrow (749-765)
  • exportSpectraToArrow (749-751)
  • getSpectraArrowColumns (768-827)
  • getSpectraArrowColumns (768-770)
  • exportChromatogramsToArrow (830-1075)
  • exportChromatogramsToArrow (830-832)
  • exportSpectraToParquet (1316-1332)
  • exportSpectraToParquet (1316-1320)
  • exportChromatogramsToParquet (1335-1351)
  • exportChromatogramsToParquet (1335-1339)
src/openms/include/OpenMS/FORMAT/ArrowExport.h (5)
  • ArrowSpectraExportConfig (69-102)
  • ArrowChromatogramExportConfig (108-121)
  • ParquetWriteConfig (139-403)
  • exportSpectraToParquet (377-380)
  • exportChromatogramsToParquet (396-399)
src/openms/source/FORMAT/ArrowExport.cpp (1)
src/openms/include/OpenMS/FORMAT/ArrowExport.h (2)
  • exportSpectraToParquet (377-380)
  • exportChromatogramsToParquet (396-399)
src/openms/include/OpenMS/FORMAT/ArrowExport.h (1)
src/openms/source/FORMAT/ArrowExport.cpp (16)
  • exportSpectraToArrow (749-765)
  • exportSpectraToArrow (749-751)
  • getSpectraArrowColumns (768-827)
  • getSpectraArrowColumns (768-770)
  • exportChromatogramsToArrow (830-1075)
  • exportChromatogramsToArrow (830-832)
  • getChromatogramArrowColumns (1078-1108)
  • getChromatogramArrowColumns (1078-1080)
  • exportSpectraToArrowCDataInterface (1111-1159)
  • exportSpectraToArrowCDataInterface (1111-1115)
  • exportChromatogramsToArrowCDataInterface (1162-1210)
  • exportChromatogramsToArrowCDataInterface (1162-1166)
  • exportSpectraToParquet (1316-1332)
  • exportSpectraToParquet (1316-1320)
  • exportChromatogramsToParquet (1335-1351)
  • exportChromatogramsToParquet (1335-1339)
🪛 GitHub Check: CodeFactor
src/openms/source/FORMAT/ArrowExport.cpp

[warning] 830-1077: src/openms/source/FORMAT/ArrowExport.cpp#L830-L1077
Very Complex Method


[warning] 460-748: src/openms/source/FORMAT/ArrowExport.cpp#L460-L748
Very Complex Method


[warning] 152-459: src/openms/source/FORMAT/ArrowExport.cpp#L152-L459
Very Complex Method

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (10)
  • GitHub Check: build-wheels-macos
  • GitHub Check: build-wheels-linux
  • GitHub Check: build-wheels-linux-arm
  • GitHub Check: build-wheels-windows
  • GitHub Check: build-and-test (macos-14, xcode, 15.4)
  • GitHub Check: build-and-test (ubuntu-24.04-arm, g++, 13)
  • GitHub Check: build-and-test (ubuntu-24.04, clang++, 17)
  • GitHub Check: build-and-test (ubuntu-24.04, g++, 13)
  • GitHub Check: build-and-test (windows-2025, cl.exe, 14.44)
  • GitHub Check: cppcheck-test
🔇 Additional comments (30)
src/pyOpenMS/addons/MSExperiment.pyx (4)

6-15: LGTM - Internal helper for zero-copy export.

The _get_cpp_pointer method correctly retrieves the underlying C++ object address for use by the zero-copy Arrow bridge. The implementation uses proper Cython typing with uintptr_t cast.


387-504: Well-structured API with proper deprecation handling and validation.

The to_arrow method provides a clean unified interface for exporting spectra and chromatograms. The deprecation warning for long_format with stacklevel=2 correctly points to the caller, and parameter validation is thorough.


894-975: LGTM - Chromatogram Arrow table builder.

The implementation correctly handles both long and semi-wide formats with RT filtering and column selection. The pattern is consistent with the spectra builder.


269-273: No action needed—the .decode('utf-8') calls are correct.

The methods getSpectraArrowColumns and getChromatogramArrowColumns are declared as direct C++ extern bindings returning libcpp_vector[libcpp_string], not autowrap-wrapped methods. When iterating over these vectors in Cython, each element is a C++ libcpp_string (bytes), so calling .decode('utf-8') is necessary to convert them to Python strings.

The coding guideline against .decode() applies specifically to autowrap-wrapped methods, which automatically handle string conversion. These ArrowExport methods use direct C++ bindings and require manual decoding.

Likely an incorrect or invalid review comment.

src/tests/class_tests/openms/executables.cmake (1)

283-285: LGTM - Test registration for ArrowExport.

The ArrowExport_test is correctly added to the test list under the WITH_PARQUET conditional, following the established pattern for Parquet-dependent tests. Based on learnings, this is the correct approach for registering new C++ unit tests.

src/openms/include/OpenMS/FORMAT/sources.cmake (1)

114-120: LGTM - Header file registration.

The ArrowExport.h header is correctly added under the WITH_PARQUET conditional, following the same pattern as HDF5Connector.h under WITH_HDF5. Both conditional blocks are properly closed with endif().

src/openms/source/FORMAT/sources.cmake (1)

106-109: LGTM - Source file registration.

The ArrowExport.cpp source file is correctly added under the WITH_PARQUET conditional, properly paired with the header registration in the include sources.cmake.

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

32-74: Helper experiment construction is clear and appropriately minimal.

Nice: multiple MS levels + precursor/isolation window coverage without bloating the dataset.

src/tests/class_tests/openms/CMakeLists.txt (1)

78-91: Code is correct: targets are guaranteed to be defined when WITH_PARQUET is enabled.

Verified that ${OPENMS_ARROW_TARGET} and ${OPENMS_PARQUET_TARGET} are set in cmake/cmake_findExternalLibs.cmake within a if (WITH_PARQUET) block with fallback logic that always selects one available target or fails with FATAL_ERROR. All usages in the codebase are properly guarded by if(WITH_PARQUET) conditionals, ensuring these targets are only referenced when they're guaranteed to exist.

src/openms/source/FORMAT/HANDLERS/MzMLHandler.cpp (2)

5147-5150: Spectrum-level TDF cvParam correctly uses MS:1000790 for "time-delayed fragmentation spectrum".

The PSI-MS CV accession has been verified as correct.


4169-4173: Good: keep TDF CV term consistent between fileContent and spectrum-level output.

This switches the written PSI-MS accession for "time-delayed fragmentation spectrum" to MS:1000790, matching the TDF handling elsewhere in the file. The accession is correct per the PSI-MS controlled vocabulary.

src/pyOpenMS/tests/unittests/test_dataframe_columns.py (1)

622-885: Comprehensive test coverage for the new Arrow export API.

The new TestMSExperimentUnifiedToArrow class provides thorough test coverage including:

  • Format variations (long/semi_wide) for both spectra and chromatograms
  • Filter combinations (ms_levels, RT range, m/z range)
  • Column selection and optional field toggles
  • Backward compatibility with deprecation warnings
  • Edge cases (empty experiments, invalid parameters)

The test fixture is well-structured and the use of pytest.importorskip('pyarrow') correctly handles the optional dependency.

src/pyOpenMS/pyopenms/_arrow_zerocopy.pyx (3)

168-218: Memory management pattern is correct for Arrow C Data Interface.

The implementation correctly:

  1. Allocates ArrowSchema/ArrowArray struct containers with malloc
  2. Zero-initializes them with memset
  3. Calls C++ export which populates structs and sets release callbacks
  4. Imports into PyArrow which takes ownership via release callbacks
  5. Frees the struct containers (not the Arrow data)
  6. Error paths properly call release callbacks before freeing

221-312: Chromatograms export follows the same correct pattern.

The chromatograms_to_arrow() function mirrors spectra_to_arrow() with appropriate differences (no IM/precursor toggles for chromatograms). The memory management and error handling are consistent.


145-149: The _get_cpp_pointer() helper method exists in MSExperiment addon and is properly implemented. No issues found.

src/pyOpenMS/pxds/ArrowExport.pxd (1)

1-102: PXD bindings follow pyOpenMS conventions correctly.

The bindings properly:

  • Use cimport for Cython imports (lines 6-11)
  • Declare both default and copy constructors for all classes
  • Include wrap-doc comments with correct formatting
  • Note the enum class limitation with # wrap-ignore
  • Expose static C++ methods as instance methods for autowrap compatibility
src/openms/source/FORMAT/ArrowExport.cpp (7)

1-27: File structure and includes are well-organized.

The implementation is properly guarded by WITH_PARQUET and includes all necessary Arrow/Parquet headers along with OpenMS dependencies.


56-94: Filter boundary checks use 0 as "no filter" sentinel.

The RT and m/z range filters use != 0 to detect if a filter is active. This means filtering from exactly 0 is not possible, but this is a reasonable design choice since RT=0 and m/z=0 are rarely meaningful filter boundaries in MS data.


152-456: Long format table builder is correct despite complexity.

The function is complex due to handling many optional columns, but the logic is sound:

  • Pre-counts peaks for efficient capacity reservation
  • Uses UnsafeAppend after Reserve for performance
  • Correctly calculates peak_idx from spec.begin() for IM array access (line 254)
  • Proper error handling with OPENMS_LOG_ERROR and nullptr returns

The static analysis complexity warning is valid but the function structure is inherently complex due to the number of optional columns.


836-914: Empty chromatogram handling ensures schema consistency.

The code correctly creates an empty table with the proper schema when no chromatograms exist. This ensures downstream consumers receive a valid Arrow table with expected columns, avoiding schema mismatch issues.


1111-1159: C Data Interface export correctly handles ownership transfer.

The implementation:

  1. Builds the Arrow table via exportSpectraToArrow
  2. Combines chunks to a single RecordBatch
  3. Exports schema and record batch to C Data Interface structs
  4. Properly releases schema if array export fails (lines 1150-1154)

The ValueOrDie() calls at lines 1133 and 1184 are safe because they're guarded by prior ok() checks.


1237-1311: Parquet export with configurable compression and proper resource cleanup.

The implementation provides:

  • Configurable compression (NONE, SNAPPY, GZIP, LZ4, ZSTD)
  • Compression level for algorithms that support it
  • Data page size and statistics configuration
  • Explicit file close with error checking

617-631: No changes required. The ion mobility index calculation is correct and properly handles m/z filtering by using absolute peak positions relative to the spectrum start.

src/pyOpenMS/CMakeLists.txt (1)

326-397: Fix OPENMS_ARROW_TARGET availability in standalone builds.

The code will fail in standalone mode when WITH_PARQUET=ON because OPENMS_ARROW_TARGET is not exported through OpenMSConfig.cmake. Line 333's get_target_property() call will fail with an undefined target error, and line 362's target_link_libraries() references an undefined variable.

This block only works in in-tree builds where OPENMS_ARROW_TARGET is defined by cmake/cmake_findExternalLibs.cmake. For standalone builds using find_package(OpenMS), Arrow/Parquet are private dependencies not exposed in the config file.

Either:

  • Disable Arrow zerocopy module in standalone builds by checking if target exists
  • Export OPENMS_ARROW_TARGET and related variables through OpenMSConfig.cmake.in
  • Make the module conditional on target availability with proper error messaging
⛔ Skipped due to learnings
Learnt from: jpfeuffer
Repo: OpenMS/OpenMS PR: 8530
File: src/pyOpenMS/CMakeLists.txt:78-80
Timestamp: 2026-01-12T12:26:12.890Z
Learning: In the OpenMS build system (src/pyOpenMS/CMakeLists.txt and related), when building pyOpenMS in standalone mode (via find_package(OpenMS REQUIRED)), the OpenMSConfig.cmake automatically finds all necessary public dependencies including Qt6, so Qt6_VERSION and related variables are available in both standalone and in-tree builds.
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-14T18:52:46.294Z
Learning: Applies to src/openms/source/**/*.cpp : Do not modify files in `src/openms/extern/`; this directory contains third-party vendored code
src/openms/include/OpenMS/FORMAT/ArrowExport.h (6)

1-32: LGTM - Well-structured header with proper guards and minimal dependencies.

The file preamble is complete with maintainer info, the #pragma once guard is used correctly, and the WITH_PARQUET conditional compilation properly isolates this optional feature. Forward declarations for Arrow types avoid exposing Arrow headers to consumers, which is good for compilation time and API cleanliness.


37-56: LGTM - Clear documentation of format tradeoffs.

The enum documentation effectively explains when to use each format and includes the important caveat about 32-bit offset limitations for list arrays in SemiWide format.


58-102: LGTM - Well-documented configuration struct.

The struct uses appropriate OpenMS types (UInt for ms_levels), follows naming conventions, and includes comprehensive @note documentation explaining the sentinel value semantics for filtering ranges.


124-173: LGTM - Comprehensive Parquet configuration with excellent documentation.

The struct provides sensible defaults with clear documentation of the tradeoffs. The performance guidelines section is particularly helpful for users unfamiliar with Parquet tuning. Using int64_t for byte sizes aligns with Arrow/Parquet API expectations.


176-249: LGTM - Well-designed public API with thorough schema documentation.

The @experimental tag appropriately signals that the API may evolve. The detailed schema documentation in exportSpectraToArrow (including data types and nullability) is excellent for users and will help with cross-language interoperability. The @ingroup FileIO categorization is appropriate.


251-401: LGTM - Consistent API design with helpful examples.

The C Data Interface methods properly document caller responsibility for release callbacks. The Parquet export methods include practical code examples that demonstrate both simple and advanced usage patterns. Using OpenMS String type for filename parameters follows the established conventions.

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.

Copilot AI commented Jan 14, 2026

Copy link
Copy Markdown
Contributor

@timosachsenberg I've opened a new pull request, #8658, to work on those changes. Once the pull request is ready, I'll request review from you.

…s, improve test files (#8658)

* Initial plan

* Address PR review comments: optimize ion mobility access, add parquet suffix, enhance docs

Co-authored-by: timosachsenberg <[email protected]>

---------

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: timosachsenberg <[email protected]>
coderabbitai[bot]

This comment was marked as resolved.

timosachsenberg and others added 4 commits January 15, 2026 10:51
Document that libcpp_utf8_output_string can be used in container return
types (e.g., libcpp_vector) for automatic conversion to Python strings.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Use automatic string conversion for getSpectraArrowColumns and
getChromatogramArrowColumns return types, removing need for manual
.decode('utf-8') calls in Python code.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
- Remove redundant empty chromatogram handling (81 lines) - the normal
  code path handles empty data correctly and respects column filtering
- Rename C++ methods: getSpectraArrowColumns -> getSpectraArrowColumnNames,
  getChromatogramArrowColumns -> getChromatogramArrowColumnNames
- Rename Python methods: get_df_columns -> get_df_column_names,
  get_arrow_columns -> get_arrow_column_names across all addon files
- Update tests and documentation to use new names

The "Names" suffix clarifies these methods return column name strings,
consistent with Arrow's column_names() convention.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
coderabbitai[bot]

This comment was marked as resolved.

timosachsenberg and others added 2 commits January 15, 2026 20:42
Add test coverage for column name discovery methods that were renamed
but not tested:
- FeatureMap.get_df_column_names()
- ConsensusMap.get_df_column_names()
- MRMTransitionGroupCP.get_chromatogram_df_column_names()
- MRMTransitionGroupCP.get_feature_df_column_names()
- MSExperiment.get_df_column_names()

Co-Authored-By: Claude Opus 4.5 <[email protected]>
- get_df() → to_df() (matches pandas/polars to_pandas(), to_arrow() pattern)
- get_df_column_names() → df_columns() (shorter, cleaner)
- get_arrow_column_names() → arrow_columns()
- get_chromatogram_df_column_names() → chromatogram_df_columns()
- get_feature_df_column_names() → feature_df_columns()
- get_chromatogram_df() → to_chromatogram_df()
- get_feature_df() → to_feature_df()

Updated in MSSpectrum, MSChromatogram, Mobilogram, FeatureMap,
ConsensusMap, MSExperiment, MRMTransitionGroupCP, and
PeptideIdentificationList addons. Tests and documentation updated.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
coderabbitai[bot]

This comment was marked as outdated.

timosachsenberg and others added 7 commits January 15, 2026 21:04
Provides deprecated method aliases that emit DeprecationWarning:
- get_df() -> to_df()
- get_df_columns() -> df_columns()
- get_chromatogram_df() -> to_chromatogram_df()
- get_chromatogram_df_columns() -> chromatogram_df_columns()
- get_feature_df() -> to_feature_df()
- get_feature_df_columns() -> feature_df_columns()

This allows existing user code to continue working while encouraging
migration to the new Pythonic method names. Aliases will be removed
in a future major version.

Also updates _dataframes.py wrapper to call to_df() instead of get_df().

Co-Authored-By: Claude Opus 4.5 <[email protected]>
peptide_identifications_to_df() and update_scores_from_df() now emit
DeprecationWarning encouraging users to use the method-based API:
- peps.to_df() instead of peptide_identifications_to_df(peps)
- peps.update_scores_from_df(df, name) instead of update_scores_from_df(peps, df, name)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
- common_meta_value_types: Was exported but never imported; addon files
  define their own local copies
- _add_meta_values: Completely unused dead code

Also removed unused imports (numpy, DataValue).

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Add missing ParquetWriteConfig struct declaration and update
exportSpectraToParquet/exportChromatogramsToParquet signatures
to include the parquet_config parameter matching the C++ header.

ParquetWriteConfig exposes:
- compression_level: ZSTD level (1-22, default 3)
- row_group_size: Target bytes per row group (default 128MB)
- write_statistics: Enable min/max stats for predicate pushdown
- data_page_size: Granularity within row groups (default 1MB)

Note: Compression enum class is not wrapped (autowrap limitation),
defaults to ZSTD which is optimal for MS data.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
…ssor

- Use 0.0/inf sentinel values for None RT/MZ filters instead of calling
  getMinRT()/getMaxRT()/getMinMZ()/getMaxMZ() - consistent with C++ path
- Use bulk accessor np.asarray(im_arr.get_data()) for ion mobility in
  semi-wide format instead of element-by-element iteration
- Update test docstrings to clarify long_format is a deprecated parameter

Co-Authored-By: Claude Opus 4.5 <[email protected]>
- Add ArrowExportFormat enum class to ArrowExport.pxd (Long, SemiWide)
- Add format field to ArrowSpectraExportConfig and ArrowChromatogramExportConfig
- Update MSExperiment.arrow_columns() to map Python format string to C++ enum
- C++ path now correctly returns columns for the requested format

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@timosachsenberg

This comment was marked as duplicate.

@timosachsenberg
timosachsenberg merged commit 86c8218 into develop Jan 15, 2026
@timosachsenberg
timosachsenberg deleted the feature/cpp-arrow-ms-experiment branch January 15, 2026 22:01
claude Bot pushed a commit that referenced this pull request Jan 18, 2026
Added 19 missing PRs to OpenMS 3.6.0 changelog:

PyOpenMS:
- #8530: Build system modernization with py-build-cmake
- #8633: SpectrumNativeIDParser wrapper
- #8655: Arrow/Parquet export with DataFrame methods (BREAKING: method renames)
- #8661: Build dependency docs
- #8664: Biosaur2Algorithm wrap-inherits
- #8668: wrap-doc documentation
- #8674: Docstring validation tests

TOPP tools:
- #8643: FileInfo FASTA stats
- #8650: FileConverter MSP support
- #8649: PeakPickerHiRes parameter

OpenMS Library:
- #8633: SpectrumNativeIDParser class
- #8655: ArrowExport helper
- #8651, #8656, #8659, #8660, #8662: Performance optimizations

Fixes:
- #8645: DataArray handling in filters
- #8672: Test file correction
- #8678: UniqueIdGenerator seed collision fix

Build System:
- #8675, #8676: Claude CI workflows

Also reorganized misplaced entries from lines 122-129.

Co-authored-by: Timo Sachsenberg <[email protected]>
timosachsenberg added a commit that referenced this pull request Jan 18, 2026
* Add comprehensive changelog for OpenMS 3.6.0

Includes changes from 96 merged PRs since version 3.5.0:

- General: macOS Intel discontinued, Ubuntu 24.04, notarization in CI
- Dependencies: Autowrap >= 0.26.0, Eigen minimum 3.4.0
- PyOpenMS: Pythonic methods (__len__, __str__, __repr__, __hash__),
  DataFrame support, new wrappers, string handling improvements
- TOPP tools: MapAligner spectra transformation, FileInfo improvements,
  IsobaricWorkflow fixes, SageAdapter thread handling
- OpenMS Library: PeakFileOptions, ParamIterator, SpectrumAnnotator
- Breaking changes: Matrix<T> Eigen decoupling, API renames, FileWatcher move
- Bug fixes: NucleicAcidSearchEngine, LogConfigHandler, decoy generation
- Documentation: Targeted Quantitation, parameter annotations, AGENTS.md
- Build: macOS notarization, Parquet support, pytest fixtures

Co-Authored-By: Claude Opus 4.5 <[email protected]>

* Add missing changelog entries for recently merged PRs

Added 19 missing PRs to OpenMS 3.6.0 changelog:

PyOpenMS:
- #8530: Build system modernization with py-build-cmake
- #8633: SpectrumNativeIDParser wrapper
- #8655: Arrow/Parquet export with DataFrame methods (BREAKING: method renames)
- #8661: Build dependency docs
- #8664: Biosaur2Algorithm wrap-inherits
- #8668: wrap-doc documentation
- #8674: Docstring validation tests

TOPP tools:
- #8643: FileInfo FASTA stats
- #8650: FileConverter MSP support
- #8649: PeakPickerHiRes parameter

OpenMS Library:
- #8633: SpectrumNativeIDParser class
- #8655: ArrowExport helper
- #8651, #8656, #8659, #8660, #8662: Performance optimizations

Fixes:
- #8645: DataArray handling in filters
- #8672: Test file correction
- #8678: UniqueIdGenerator seed collision fix

Build System:
- #8675, #8676: Claude CI workflows

Also reorganized misplaced entries from lines 122-129.

Co-authored-by: Timo Sachsenberg <[email protected]>

---------

Co-authored-by: Claude Opus 4.5 <[email protected]>
Co-authored-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com>
Co-authored-by: Timo Sachsenberg <[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.

3 participants