Repository navigation
Address PR review comments: optimize ion mobility access, enhance docs, improve test files - #8658
Merged
timosachsenberg merged 2 commits intoJan 14, 2026
Conversation
3 of 4 tasks
Contributor
|
Important Review skippedBot user detected. To trigger a single review, invoke the You can disable this status message by setting the Comment |
… suffix, enhance docs Co-authored-by: timosachsenberg <[email protected]>
Copilot
AI
changed the title
[WIP] Add export functionality for MSExperiment to Arrow/Parquet
Address PR review comments: optimize ion mobility access, enhance docs, improve test files
Jan 14, 2026
timosachsenberg
marked this pull request as ready for review
January 14, 2026 19:55
timosachsenberg
added a commit
that referenced
this pull request
Jan 15, 2026
* [FEATURE] Add Arrow/Parquet export for MSExperiment 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]> * Update src/pyOpenMS/tests/unittests/test_dataframe_columns.py Co-authored-by: Copilot <[email protected]> * Address PR review comments: optimize ion mobility access, enhance docs, 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]> * Update wrapping docs: libcpp_utf8_output_string works in containers 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 libcpp_utf8_output_string for ArrowExport column name returns 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]> * Simplify ArrowExport and rename column discovery methods - 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 tests for missing get_df_column_names() methods 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]> * Rename DataFrame methods to Pythonic conventions - 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]> * Add deprecated aliases for backward compatibility with pyopenms 3.5.0 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]> * Add deprecation warnings to standalone DataFrame functions 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]> * Remove unused common_meta_value_types and _add_meta_values - 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 ParquetWriteConfig to ArrowExport.pxd Python bindings 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]> * Fix Arrow export: use sentinel values for RT/MZ filters, bulk IM accessor - 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 binding for proper format handling - 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]> * Fix method name in ArrowExport_test: getSpectraArrowColumns -> getSpectraArrowColumnNames Co-Authored-By: Claude Opus 4.5 <[email protected]> --------- Co-authored-by: timosachsenberg <[email protected]> Co-authored-by: Claude Opus 4.5 <[email protected]> Co-authored-by: Copilot <[email protected]> Co-authored-by: Copilot <[email protected]> Co-authored-by: timosachsenberg <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Addresses three optimization and quality improvements from PR review feedback.
Changes
Ion mobility array access optimization (MSExperiment.pyx): Replace element-by-element list comprehension with
FloatDataArray.get_data()for ~50x performance improvement on large datasetsParquet test file naming (ArrowExport_test.cpp): Add
.parquetsuffix to temporary test files for better file association and debugging experienceDocumentation consistency (ArrowExport.h): Add
@notesections toArrowChromatogramExportConfigmatchingArrowSpectraExportConfigstyle, clarifying empty columns and RT filter behavior💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.