Repository navigation
[FEATURE] Add Arrow/Parquet export for MSExperiment - #8655
Conversation
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]>
|
Note Other AI code review bot(s) detectedCodeRabbit 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. 📝 WalkthroughWalkthroughAdds 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
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)
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
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. Comment |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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 usingget_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
FloatDataArrayhas aget_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.parquetsuffix 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@notedocumentation for consistency withArrowSpectraExportConfig.The struct is functionally correct, but the Doxygen documentation is less detailed than
ArrowSpectraExportConfig. Adding@notesections 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
📒 Files selected for processing (13)
src/openms/include/OpenMS/FORMAT/ArrowExport.hsrc/openms/include/OpenMS/FORMAT/sources.cmakesrc/openms/source/FORMAT/ArrowExport.cppsrc/openms/source/FORMAT/HANDLERS/MzMLHandler.cppsrc/openms/source/FORMAT/sources.cmakesrc/pyOpenMS/CMakeLists.txtsrc/pyOpenMS/addons/MSExperiment.pyxsrc/pyOpenMS/pxds/ArrowExport.pxdsrc/pyOpenMS/pyopenms/_arrow_zerocopy.pyxsrc/pyOpenMS/tests/unittests/test_dataframe_columns.pysrc/tests/class_tests/openms/CMakeLists.txtsrc/tests/class_tests/openms/executables.cmakesrc/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, andmzDatawhich use specific capitalization
Files:
src/tests/class_tests/openms/executables.cmakesrc/openms/source/FORMAT/sources.cmakesrc/tests/class_tests/openms/source/ArrowExport_test.cppsrc/openms/source/FORMAT/HANDLERS/MzMLHandler.cppsrc/pyOpenMS/pyopenms/_arrow_zerocopy.pyxsrc/pyOpenMS/CMakeLists.txtsrc/pyOpenMS/tests/unittests/test_dataframe_columns.pysrc/pyOpenMS/pxds/ArrowExport.pxdsrc/pyOpenMS/addons/MSExperiment.pyxsrc/tests/class_tests/openms/CMakeLists.txtsrc/openms/source/FORMAT/ArrowExport.cppsrc/openms/include/OpenMS/FORMAT/ArrowExport.hsrc/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: UseSTART_TEST,START_SECTION, andEND_SECTIONmacros fromOpenMS/CONCEPT/ClassTest.hfor unit test structure
Wrap template method calls with 2 or more arguments in parentheses withinSTART_SECTIONmacro to avoid parser issues
UseNEW_TMP_FILE(filename)for each output file in tests to avoid side effects and conflicts
UseFuzzyDifffor 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.cppsrc/openms/source/FORMAT/ArrowExport.cppsrc/openms/include/OpenMS/FORMAT/ArrowExport.h
src/openms/**/*.cpp
📄 CodeRabbit inference engine (AGENTS.md)
Use
using namespaceandusing std::...declarations allowed only in implementation files
Files:
src/openms/source/FORMAT/HANDLERS/MzMLHandler.cppsrc/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.hand.cpppair
Do not modify files insrc/openms/extern/; this directory contains third-party vendored code
Files:
src/openms/source/FORMAT/HANDLERS/MzMLHandler.cppsrc/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 fromOpenMS/CONCEPT/Types.h(e.g.,Size,SignedSize) for STL container sizes instead ofstd::size_t
Avoid pointers; prefer references where possible for safer memory management
Use Doxygen documentation with/** */block comments and@tags (not backslash);@briefis required
Comments should comprise at least ~5% of code; use//style comments in plain English describing the next few lines
Avoidstd::endlfor performance; prefer\nwhen outputting to streams
Use OpenMS logging macros andOpenMS::LogStreaminstead ofstd::coutorstd::cerr
Exceptions must derive fromException::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
UseOPENMS_LOG_WARN,OPENMS_LOG_INFO,OPENMS_LOG_DEBUGand other OpenMS logging macros for all logging output
PreferString::fromNumber()andString::toDouble()from OpenMS for numeric formatting and parsing over standard C++ methods
Files:
src/openms/source/FORMAT/HANDLERS/MzMLHandler.cppsrc/openms/source/FORMAT/ArrowExport.cppsrc/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.pyxsrc/pyOpenMS/tests/unittests/test_dataframe_columns.pysrc/pyOpenMS/pxds/ArrowExport.pxdsrc/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
Avoidcdeftyped variables for autowrap return values insidedefmethods; use Python type checks instead
Keep addon methods minimal; avoid redundant aliases that duplicate C++ functionality
Files:
src/pyOpenMS/pyopenms/_arrow_zerocopy.pyxsrc/pyOpenMS/addons/MSExperiment.pyx
**/CMakeLists.txt
📄 CodeRabbit inference engine (CLAUDE.md)
**/CMakeLists.txt: Use-DBOOST_USE_STATIC_LIBS=OFFwhen 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-DCMake option
Files:
src/pyOpenMS/CMakeLists.txtsrc/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: UsePeptideIdentificationListtype (not Python list) when callingsetPeptideIdentifications()in pyOpenMS
Only use valid amino acid letters (A-Z except B, J, O, U, X, Z) withAASequence.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.pxdfiles - 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.pxdfiles for all wrapped classes
Usecimportfor Cython imports, not Pythonimport, in.pxddeclaration files
For non-inheriting classes in.pxdfiles, usecdef 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.pxdfiles
Files:
src/pyOpenMS/pxds/ArrowExport.pxd
src/pyOpenMS/**/*.pxd
📄 CodeRabbit inference engine (AGENTS.md)
src/pyOpenMS/**/*.pxd: Keep.pxdsignatures synchronized with C++ API changes; update or removewrap-ignorehints when wrapping changes
Do not add Python-only methods to.pxdfiles; use addons or_dataframes.pywrappers instead
Files:
src/pyOpenMS/pxds/ArrowExport.pxd
src/pyOpenMS/addons/**/*.pyx
📄 CodeRabbit inference engine (CLAUDE.md)
src/pyOpenMS/addons/**/*.pyx: Create addon files atsrc/pyOpenMS/addons/<ClassName>.pyxto 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
Implementget_data_dict()in Cython addons to return numpy arrays, and wrap withget_df()in_dataframes.pyto 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 liketoString()andgetSequence()- autowrap already returns Python strings
Do not declarecdef class ClassName:in pyOpenMS addon files - methods are injected as indented code into the generated class
Do not usecdeftyped variables for autowrap return values insidedefmethods - 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
Useself.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 includecdef classdeclarations; use only Pythondefsyntax with proper indentation
Implementget_data_dict()method returning numpy arrays for DataFrame conversion; implementget_df()insrc/pyOpenMS/pyopenms/_dataframes.pyto 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 addusing namespaceorusing 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 theOPENMS_DLLAPImacro
Do not includeOPENMS_DLLAPIon template classes or functions
File names must match the class name; store one class per file with corresponding.hand.cpppair
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@briefdocumentation 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@ingroupDoxygen tags to categorize classes (e.g.,@ingroup Analysis_ID,@ingroup Analysis) for documentation organization
Use@todoDoxygen 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.cmakesrc/tests/class_tests/openms/source/ArrowExport_test.cppsrc/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.cmakesrc/tests/class_tests/openms/source/ArrowExport_test.cppsrc/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.cmakesrc/tests/class_tests/openms/source/ArrowExport_test.cppsrc/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.cmakesrc/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.cmakesrc/tests/class_tests/openms/source/ArrowExport_test.cppsrc/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.cmakesrc/tests/class_tests/openms/source/ArrowExport_test.cppsrc/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.cmakesrc/tests/class_tests/openms/source/ArrowExport_test.cppsrc/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.cmakesrc/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.cmakesrc/tests/class_tests/openms/CMakeLists.txtsrc/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.cmakesrc/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.cppsrc/pyOpenMS/addons/MSExperiment.pyxsrc/openms/source/FORMAT/ArrowExport.cppsrc/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.pyxsrc/pyOpenMS/CMakeLists.txtsrc/pyOpenMS/pxds/ArrowExport.pxdsrc/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.pyxsrc/pyOpenMS/CMakeLists.txtsrc/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.pyxsrc/pyOpenMS/CMakeLists.txtsrc/pyOpenMS/pxds/ArrowExport.pxdsrc/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.pyxsrc/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.pyxsrc/pyOpenMS/CMakeLists.txtsrc/pyOpenMS/pxds/ArrowExport.pxdsrc/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.pyxsrc/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.pyxsrc/pyOpenMS/CMakeLists.txtsrc/pyOpenMS/pxds/ArrowExport.pxdsrc/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.txtsrc/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.txtsrc/pyOpenMS/pxds/ArrowExport.pxdsrc/pyOpenMS/addons/MSExperiment.pyxsrc/tests/class_tests/openms/CMakeLists.txtsrc/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.txtsrc/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.txtsrc/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.pxdsrc/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.cppsrc/openms/include/OpenMS/FORMAT/ArrowExport.hsrc/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.cppsrc/openms/include/OpenMS/FORMAT/ArrowExport.hsrc/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_pointermethod correctly retrieves the underlying C++ object address for use by the zero-copy Arrow bridge. The implementation uses proper Cython typing withuintptr_tcast.
387-504: Well-structured API with proper deprecation handling and validation.The
to_arrowmethod provides a clean unified interface for exporting spectra and chromatograms. The deprecation warning forlong_formatwithstacklevel=2correctly 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
getSpectraArrowColumnsandgetChromatogramArrowColumnsare declared as direct C++ extern bindings returninglibcpp_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_testis correctly added to the test list under theWITH_PARQUETconditional, 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.hheader is correctly added under theWITH_PARQUETconditional, following the same pattern asHDF5Connector.hunderWITH_HDF5. Both conditional blocks are properly closed withendif().src/openms/source/FORMAT/sources.cmake (1)
106-109: LGTM - Source file registration.The
ArrowExport.cppsource file is correctly added under theWITH_PARQUETconditional, 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 incmake/cmake_findExternalLibs.cmakewithin aif (WITH_PARQUET)block with fallback logic that always selects one available target or fails withFATAL_ERROR. All usages in the codebase are properly guarded byif(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
TestMSExperimentUnifiedToArrowclass 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:
- Allocates
ArrowSchema/ArrowArraystruct containers withmalloc- Zero-initializes them with
memset- Calls C++ export which populates structs and sets release callbacks
- Imports into PyArrow which takes ownership via release callbacks
- Frees the struct containers (not the Arrow data)
- Error paths properly call release callbacks before freeing
221-312: Chromatograms export follows the same correct pattern.The
chromatograms_to_arrow()function mirrorsspectra_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
cimportfor 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_PARQUETand 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
!= 0to 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
UnsafeAppendafterReservefor performance- Correctly calculates
peak_idxfromspec.begin()for IM array access (line 254)- Proper error handling with
OPENMS_LOG_ERRORandnullptrreturnsThe 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:
- Builds the Arrow table via
exportSpectraToArrow- Combines chunks to a single
RecordBatch- Exports schema and record batch to C Data Interface structs
- 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 priorok()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=ONbecauseOPENMS_ARROW_TARGETis not exported throughOpenMSConfig.cmake. Line 333'sget_target_property()call will fail with an undefined target error, and line 362'starget_link_libraries()references an undefined variable.This block only works in in-tree builds where
OPENMS_ARROW_TARGETis defined bycmake/cmake_findExternalLibs.cmake. For standalone builds usingfind_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_TARGETand related variables throughOpenMSConfig.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 codesrc/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 onceguard is used correctly, and theWITH_PARQUETconditional 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 (
UIntfor ms_levels), follows naming conventions, and includes comprehensive@notedocumentation 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_tfor byte sizes aligns with Arrow/Parquet API expectations.
176-249: LGTM - Well-designed public API with thorough schema documentation.The
@experimentaltag appropriately signals that the API may evolve. The detailed schema documentation inexportSpectraToArrow(including data types and nullability) is excellent for users and will help with cross-language interoperability. The@ingroup FileIOcategorization 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
Stringtype for filename parameters follows the established conventions.
✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.
Co-authored-by: Copilot <[email protected]>
|
@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]>
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]>
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]>
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]>
…ctraArrowColumnNames Co-Authored-By: Claude Opus 4.5 <[email protected]>
This comment was marked as duplicate.
This comment was marked as duplicate.
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]>
* 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]>
Summary
This PR introduces an opt-in C++ helper for exporting
MSExperimentto Apache Arrow tables when OpenMS is built with Parquet/Arrow support.The code is guarded by
WITH_PARQUETand 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
📚 New Python API
MSExperiment Methods
exp.to_arrow(...)exp.arrow_columns(...)exp.to_df(...)exp.df_columns(...)Method Signature
📊 Output Formats
Long Format (default) - One row per peak
Best for: Peak-level analysis, filtering, aggregations
Semi-Wide Format - One row per spectrum
Best for: Spectrum-level operations, machine learning input
📋 Column Schemas
Spectra - Long Format
mzintensityrtion_mobilityspectrum_indexms_levelnative_idprecursor_mzprecursor_chargeprecursor_intensityisolation_lowerisolation_upperSpectra - Semi-Wide Format
spectrum_indexrtms_levelnative_idmzintensityion_mobilityprecursor_*Chromatograms
rtintensitychromatogram_indexnative_idprecursor_mzproduct_mz💻 Example Code
Basic Export
Filtered Export
Semi-Wide Format for ML
Export Both Spectra and Chromatograms
Column Discovery
Direct Parquet Export (C++ API)
🔄 Migration Guide
Methods have been renamed for consistency with pandas/polars conventions:
get_df()to_df()get_df_columns()df_columns()get_arrow_column_names()arrow_columns()The old names still work but emit
DeprecationWarning:⚡ Performance Notes
to_arrow()+ polars for best performanceto_arrow().to_pandas()is zero-copy with pandas 2.0+📁 Files Changed
ArrowExport.h,ArrowExport.cpp(+1,685 lines)ArrowExport.pxd,_arrow_zerocopy.pyxMSExperiment.pyxaddon (+697 lines)ArrowExport_test.cpp,test_dataframe_columns.py✅ Test Coverage
to_arrow(),arrow_columns(),to_df()Test plan
ArrowExport_test.cpp)test_dataframe_columns.py)WITH_PARQUET=ONand verify Arrow export worksNotes
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
API
Documentation
Bug Fixes
Tests
✏️ Tip: You can customize this high-level summary in your review settings.