Repository navigation
[OpenSwathWorkflow, Parquet] Add Parquet output support for XIC chromatograms (C++ core) - #8737
Conversation
This PR adds support for OpenSWATH chromatogram Parquet files (.xic). It introduces a Parquet writer for chromatograms, a reader with filtering and predicate pushdown, and test coverage including TOPP regression checks. The schema uses a similar (expanded) schema that was implemented in PyProphet to convert the sqMass chromatograms to parquet. Adding parquet xic output directly to OpenSwathWorkflow skips the additional extra conversion step, and provides storage benefits from using parquet compared to sqMass. Additions: - MSChromatogramParquetConsumer: writes .xic Parquet files with a PyProphet-compatible schema (metadata + compressed RT/intensity arrays) - XICParquetFile: reads .xic files with filter expressions; supports multi-file input and Arrow Dataset predicate pushdown with compute fallback - ParquetFilter: typed, chainable Parquet filter builder for predicate pushdown - TextExporter: now supports .xic input, exporting summary or exploded TSV/CSV/TXT for testable text output - OpenSwathWorkflow: added -out_chrom_ext xic option for Parquet output - Unit and TOPP tests for the new functionality Note: Python bindings will be added in a follow-up PR. Based on work from PR #8725 by @singjc. Co-Authored-By: singjc <[email protected]> Co-Authored-By: Claude Opus 4.5 <[email protected]>
This PR adds Python bindings for reading XIC data from Parquet files,
enabling integration with pandas, pyarrow, and pyopenms_viz.
Additions:
- XICParquetFile Python bindings with:
- list-of-files constructor support
- get_data_dict, get_chromatograms, to_df, to_arrow
- get_analyte_dict, get_analyte_df, get_run_dict, get_run_df
- df_columns for column discovery
- Filter expressions with predicate pushdown support
- ParquetFilter/ParquetFilterBuilder Python bindings for typed filter construction
- ParquetQuery/ChromatogramQuery for chainable querying
- Unit tests for Python bindings
Example usage:
```python
import pyopenms as poms
import glob
files = glob.glob('*.xic')
xic_h = poms.XICParquetFile(files)
xic_h.get_chromatograms(filter="precursor_id=1318 & annotation=y3^1").plot(
kind="chromatogram", x="rt", y="intensity", by="source_file"
)
```
Depends on PR #8737 (C++ core).
Based on work from PR #8725 by @singjc.
Co-Authored-By: singjc <[email protected]>
Co-Authored-By: Claude Opus 4.5 <[email protected]>
📝 WalkthroughWalkthroughAdds Parquet/XIC support across OpenMS: new reader/writer (XICParquetFile, MSChromatogramParquetConsumer), Parquet filter API, build-system WITH_PARQUET propagation, TOPP/TextExporter/OpenSwathWorkflow integration, and tests; also hides some ArrowExport Arrow-table APIs behind internal linkage. Changes
Sequence Diagram(s)sequenceDiagram
participant TOPP as OpenSwathWorkflow
participant Base as OpenSwathBase
participant Consumer as MSChromatogramParquetConsumer
participant Parquet as Parquet File
Base->>Base: FileHandler::getType(out_chrom)
Base->>Base: detect CHROMPARQUET
Base->>Consumer: construct(filename, run_id, source_file, transition_exp)
TOPP->>Consumer: consumeChromatogram(chrom)
Consumer->>Consumer: encode RT/INT, build Arrow arrays
Consumer->>Parquet: write Parquet table
Consumer->>Base: finalize / report errors
sequenceDiagram
participant App as TextExporter
participant Reader as XICParquetFile
participant Arrow as Arrow/Parquet I/O
participant Filter as ParquetFilter
App->>Reader: new XICParquetFile(file)
App->>Filter: build filter expression
App->>Reader: getChromatograms(output, filter)
Reader->>Arrow: open/read schema (dataset optional)
Reader->>Arrow: apply filter (pushdown if available)
Arrow->>Reader: return filtered rows
Reader->>Reader: decode RT/INT blobs (zlib/numpress)
Reader->>App: return XICChromatogram objects (summary or explode)
Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches🧪 Generate unit tests (beta)
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.
Actionable comments posted: 3
🤖 Fix all issues with AI agents
In `@src/openms/include/OpenMS/FORMAT/XICParquetFile.h`:
- Around line 226-259: The getAnalytes signature currently requires columns but
the doc says they are optional; change the declaration of getAnalytes in
XICParquetFile.h to provide a default empty vector for the columns parameter
(e.g., const std::vector<String>& columns = {}) and mirror the same default in
the corresponding definition/implementation (function named getAnalytes) so
callers can omit the argument; if you prefer not to add a default, instead
update the doc comment to remove the word "optional" and clarify that columns
are required—ensure the declaration, implementation, and docs remain consistent.
- Around line 63-143: The three public structs XICChromatogram, XICRunInfo, and
XICAnalyte must be exported on Windows: add the OPENMS_DLLAPI macro to each
struct declaration (i.e., change "struct XICChromatogram", "struct XICRunInfo",
and "struct XICAnalyte" to "struct OPENMS_DLLAPI XICChromatogram", "struct
OPENMS_DLLAPI XICRunInfo", and "struct OPENMS_DLLAPI XICAnalyte") so their
typeinfo and symbols are properly exported for the public API.
In `@src/topp/TextExporter.cpp`:
- Around line 1681-1683: The CHROMPARQUET branch creates an ofstream named
outstr and immediately constructs an SVOutStream (symbols: ofstream
outstr(out.c_str()), SVOutStream output(...), output.modifyStrings(false)) but
doesn't validate that the output file was successfully opened; add the same
check used in the mzML branch after creating outstr (e.g., test outstr.is_open()
or outstr.fail()), and if the file open failed emit a clear error/log and
return/throw the same error path used by the mzML branch so the function exits
early instead of continuing with a bad stream.
🧹 Nitpick comments (5)
src/openms/source/FORMAT/DATAACCESS/MSChromatogramParquetConsumer.cpp (1)
445-448: Consider making compression strategy configurable.The
use_lossy_compressionflag is hardcoded totrue. While MSNumpress lossy compression is a reasonable default for chromatogram data (especially since this targets PyProphet compatibility), consider exposing this as a constructor parameter for use cases requiring lossless export.src/openms/include/OpenMS/FORMAT/ParquetFilter.h (1)
239-366: Consider whether ParquetFilterBuilder provides value over ParquetFilter.
ParquetFilterBuilderappears to duplicate the entireParquetFilterinterface, simply forwarding all calls to an internalParquetFilterinstance. Both classes offer the same fluent builder pattern.If the intent is API stability (allowing
ParquetFilterinternals to change whileParquetFilterBuilderremains stable), this is reasonable. Otherwise, consider whether one class would suffice to reduce maintenance burden.src/openms/source/FORMAT/XICParquetFile.cpp (3)
1027-1121: Manual filter fallback is correct but memory-intensive.The row-by-row slicing approach (
batch->Slice(row, 1)) creates many small RecordBatch objects, which may be inefficient for large datasets. However, this is a fallback path when Arrow compute filtering fails, so the trade-off is acceptable.
1487-1493: Post-filter validation is redundant but harmless.These checks duplicate the Arrow/compute filter conditions. While they add a small performance overhead, they serve as a defensive safety net in case of filter implementation bugs.
1609-1609: Minor: Inconsistent indentation.The
std::shared_ptr<arrow::Schema>declaration appears to have leading whitespace inconsistency compared to surrounding lines.📝 Proposed fix for indentation
- std::shared_ptr<arrow::Schema> schema = readParquetSchemaAllFiles_(filenames_); + std::shared_ptr<arrow::Schema> schema = readParquetSchemaAllFiles_(filenames_);
| @brief Lightweight chromatogram container for XIC parquet rows. | ||
| */ | ||
| struct XICChromatogram | ||
| { | ||
| Int64 run_id{0}; | ||
| String source_file; | ||
| Int64 ms_level{0}; | ||
|
|
||
| bool has_precursor_id{false}; | ||
| Int64 precursor_id{0}; | ||
| bool has_transition_id{false}; | ||
| Int64 transition_id{0}; | ||
| String modified_sequence; | ||
| bool has_precursor_charge{false}; | ||
| Int64 precursor_charge{0}; | ||
| bool has_product_charge{false}; | ||
| Int64 product_charge{0}; | ||
| bool has_detecting_transition{false}; | ||
| Int64 detecting_transition{0}; | ||
| bool has_precursor_decoy{false}; | ||
| Int64 precursor_decoy{0}; | ||
| bool has_product_decoy{false}; | ||
| Int64 product_decoy{0}; | ||
| bool has_transition_ordinal{false}; | ||
| Int64 transition_ordinal{0}; | ||
| String transition_type; | ||
| String annotation; | ||
|
|
||
| std::vector<double> rt; | ||
| std::vector<double> intensity; | ||
| }; | ||
|
|
||
| /** | ||
| @brief Unique run information (run_id, source_file). | ||
| */ | ||
| struct XICRunInfo | ||
| { | ||
| Int64 run_id{0}; | ||
| String source_file; | ||
| }; | ||
|
|
||
| /** | ||
| @brief Analyte metadata container. | ||
|
|
||
| If @p nest_transitions is false in getAnalytes(), transition-level fields | ||
| are stored in the scalar members (transition_id, product_charge, etc.). | ||
| If @p nest_transitions is true, transition-level fields are stored in the | ||
| vector members (transition_ids, product_charges, etc.), with one entry | ||
| per unique transition belonging to the precursor. | ||
| */ | ||
| struct XICAnalyte | ||
| { | ||
| bool has_precursor_id{false}; | ||
| Int64 precursor_id{0}; | ||
| String modified_sequence; | ||
| bool has_precursor_charge{false}; | ||
| Int64 precursor_charge{0}; | ||
| bool has_precursor_decoy{false}; | ||
| Int64 precursor_decoy{0}; | ||
|
|
||
| bool has_transition_id{false}; | ||
| Int64 transition_id{0}; | ||
| bool has_product_charge{false}; | ||
| Int64 product_charge{0}; | ||
| bool has_transition_ordinal{false}; | ||
| Int64 transition_ordinal{0}; | ||
| bool has_detecting_transition{false}; | ||
| Int64 detecting_transition{0}; | ||
| bool has_product_decoy{false}; | ||
| Int64 product_decoy{0}; | ||
| String transition_type; | ||
| String annotation; | ||
|
|
||
| std::vector<Int64> transition_ids; | ||
| std::vector<Int64> product_charges; | ||
| std::vector<Int64> transition_ordinals; | ||
| std::vector<Int64> detecting_transitions; | ||
| std::vector<Int64> product_decoys; | ||
| std::vector<String> transition_types; | ||
| std::vector<String> annotations; | ||
| }; |
There was a problem hiding this comment.
Export the nested public structs with OPENMS_DLLAPI.
These nested structs are part of the public API; without explicit export they can cause typeinfo/linkage issues on Windows.
🛠️ Suggested fix
- struct XICChromatogram
+ struct OPENMS_DLLAPI XICChromatogram
{
Int64 run_id{0};
String source_file;
Int64 ms_level{0};
@@
- struct XICRunInfo
+ struct OPENMS_DLLAPI XICRunInfo
{
Int64 run_id{0};
String source_file;
};
@@
- struct XICAnalyte
+ struct OPENMS_DLLAPI XICAnalyte
{
bool has_precursor_id{false};
Int64 precursor_id{0};
String modified_sequence;As per coding guidelines: Add OPENMS_DLLAPI macro to all non-template exported classes, structs, functions, and variables in headers.
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| @brief Lightweight chromatogram container for XIC parquet rows. | |
| */ | |
| struct XICChromatogram | |
| { | |
| Int64 run_id{0}; | |
| String source_file; | |
| Int64 ms_level{0}; | |
| bool has_precursor_id{false}; | |
| Int64 precursor_id{0}; | |
| bool has_transition_id{false}; | |
| Int64 transition_id{0}; | |
| String modified_sequence; | |
| bool has_precursor_charge{false}; | |
| Int64 precursor_charge{0}; | |
| bool has_product_charge{false}; | |
| Int64 product_charge{0}; | |
| bool has_detecting_transition{false}; | |
| Int64 detecting_transition{0}; | |
| bool has_precursor_decoy{false}; | |
| Int64 precursor_decoy{0}; | |
| bool has_product_decoy{false}; | |
| Int64 product_decoy{0}; | |
| bool has_transition_ordinal{false}; | |
| Int64 transition_ordinal{0}; | |
| String transition_type; | |
| String annotation; | |
| std::vector<double> rt; | |
| std::vector<double> intensity; | |
| }; | |
| /** | |
| @brief Unique run information (run_id, source_file). | |
| */ | |
| struct XICRunInfo | |
| { | |
| Int64 run_id{0}; | |
| String source_file; | |
| }; | |
| /** | |
| @brief Analyte metadata container. | |
| If @p nest_transitions is false in getAnalytes(), transition-level fields | |
| are stored in the scalar members (transition_id, product_charge, etc.). | |
| If @p nest_transitions is true, transition-level fields are stored in the | |
| vector members (transition_ids, product_charges, etc.), with one entry | |
| per unique transition belonging to the precursor. | |
| */ | |
| struct XICAnalyte | |
| { | |
| bool has_precursor_id{false}; | |
| Int64 precursor_id{0}; | |
| String modified_sequence; | |
| bool has_precursor_charge{false}; | |
| Int64 precursor_charge{0}; | |
| bool has_precursor_decoy{false}; | |
| Int64 precursor_decoy{0}; | |
| bool has_transition_id{false}; | |
| Int64 transition_id{0}; | |
| bool has_product_charge{false}; | |
| Int64 product_charge{0}; | |
| bool has_transition_ordinal{false}; | |
| Int64 transition_ordinal{0}; | |
| bool has_detecting_transition{false}; | |
| Int64 detecting_transition{0}; | |
| bool has_product_decoy{false}; | |
| Int64 product_decoy{0}; | |
| String transition_type; | |
| String annotation; | |
| std::vector<Int64> transition_ids; | |
| std::vector<Int64> product_charges; | |
| std::vector<Int64> transition_ordinals; | |
| std::vector<Int64> detecting_transitions; | |
| std::vector<Int64> product_decoys; | |
| std::vector<String> transition_types; | |
| std::vector<String> annotations; | |
| }; | |
| /** | |
| `@brief` Lightweight chromatogram container for XIC parquet rows. | |
| */ | |
| struct OPENMS_DLLAPI XICChromatogram | |
| { | |
| Int64 run_id{0}; | |
| String source_file; | |
| Int64 ms_level{0}; | |
| bool has_precursor_id{false}; | |
| Int64 precursor_id{0}; | |
| bool has_transition_id{false}; | |
| Int64 transition_id{0}; | |
| String modified_sequence; | |
| bool has_precursor_charge{false}; | |
| Int64 precursor_charge{0}; | |
| bool has_product_charge{false}; | |
| Int64 product_charge{0}; | |
| bool has_detecting_transition{false}; | |
| Int64 detecting_transition{0}; | |
| bool has_precursor_decoy{false}; | |
| Int64 precursor_decoy{0}; | |
| bool has_product_decoy{false}; | |
| Int64 product_decoy{0}; | |
| bool has_transition_ordinal{false}; | |
| Int64 transition_ordinal{0}; | |
| String transition_type; | |
| String annotation; | |
| std::vector<double> rt; | |
| std::vector<double> intensity; | |
| }; | |
| /** | |
| `@brief` Unique run information (run_id, source_file). | |
| */ | |
| struct OPENMS_DLLAPI XICRunInfo | |
| { | |
| Int64 run_id{0}; | |
| String source_file; | |
| }; | |
| /** | |
| `@brief` Analyte metadata container. | |
| If `@p` nest_transitions is false in getAnalytes(), transition-level fields | |
| are stored in the scalar members (transition_id, product_charge, etc.). | |
| If `@p` nest_transitions is true, transition-level fields are stored in the | |
| vector members (transition_ids, product_charges, etc.), with one entry | |
| per unique transition belonging to the precursor. | |
| */ | |
| struct OPENMS_DLLAPI XICAnalyte | |
| { | |
| bool has_precursor_id{false}; | |
| Int64 precursor_id{0}; | |
| String modified_sequence; | |
| bool has_precursor_charge{false}; | |
| Int64 precursor_charge{0}; | |
| bool has_precursor_decoy{false}; | |
| Int64 precursor_decoy{0}; | |
| bool has_transition_id{false}; | |
| Int64 transition_id{0}; | |
| bool has_product_charge{false}; | |
| Int64 product_charge{0}; | |
| bool has_transition_ordinal{false}; | |
| Int64 transition_ordinal{0}; | |
| bool has_detecting_transition{false}; | |
| Int64 detecting_transition{0}; | |
| bool has_product_decoy{false}; | |
| Int64 product_decoy{0}; | |
| String transition_type; | |
| String annotation; | |
| std::vector<Int64> transition_ids; | |
| std::vector<Int64> product_charges; | |
| std::vector<Int64> transition_ordinals; | |
| std::vector<Int64> detecting_transitions; | |
| std::vector<Int64> product_decoys; | |
| std::vector<String> transition_types; | |
| std::vector<String> annotations; | |
| }; |
🤖 Prompt for AI Agents
In `@src/openms/include/OpenMS/FORMAT/XICParquetFile.h` around lines 63 - 143, The
three public structs XICChromatogram, XICRunInfo, and XICAnalyte must be
exported on Windows: add the OPENMS_DLLAPI macro to each struct declaration
(i.e., change "struct XICChromatogram", "struct XICRunInfo", and "struct
XICAnalyte" to "struct OPENMS_DLLAPI XICChromatogram", "struct OPENMS_DLLAPI
XICRunInfo", and "struct OPENMS_DLLAPI XICAnalyte") so their typeinfo and
symbols are properly exported for the public API.
| /** | ||
| @brief Return unique run metadata (run_id, source_file). | ||
|
|
||
| This method never decodes RT/intensity arrays and always returns distinct | ||
| rows. | ||
| */ | ||
| void getRuns(std::vector<XICRunInfo>& output) const; | ||
|
|
||
| /** | ||
| @brief Return unique analyte metadata. | ||
|
|
||
| If @p nest_transitions is false, each row represents a unique | ||
| precursor-transition pair. If @p nest_transitions is true, each row | ||
| represents a unique precursor with transition-level fields aggregated | ||
| into vectors. | ||
|
|
||
| This method never decodes RT/intensity arrays and always returns distinct | ||
| entries. | ||
|
|
||
| @param[out] output Output analyte metadata | ||
| @param[in] columns Optional list of analyte columns to return (empty for defaults) | ||
| @param[in] nest_transitions Aggregate transition fields per precursor | ||
| */ | ||
| void getAnalytes(std::vector<XICAnalyte>& output, | ||
| const std::vector<String>& columns, | ||
| bool nest_transitions = true) const; | ||
|
|
||
| /** | ||
| @brief Return the parquet schema column names. | ||
|
|
||
| @param[out] output Column names. | ||
| */ | ||
| void getColumns(std::vector<String>& output) const; | ||
|
|
There was a problem hiding this comment.
Align getAnalytes signature with the “optional columns” doc.
The docs say columns are optional, but the signature requires an argument. Consider a default empty list (or update the doc).
💡 Suggested tweak
- void getAnalytes(std::vector<XICAnalyte>& output,
- const std::vector<String>& columns,
- bool nest_transitions = true) const;
+ void getAnalytes(std::vector<XICAnalyte>& output,
+ const std::vector<String>& columns = std::vector<String>(),
+ bool nest_transitions = true) const;🤖 Prompt for AI Agents
In `@src/openms/include/OpenMS/FORMAT/XICParquetFile.h` around lines 226 - 259,
The getAnalytes signature currently requires columns but the doc says they are
optional; change the declaration of getAnalytes in XICParquetFile.h to provide a
default empty vector for the columns parameter (e.g., const std::vector<String>&
columns = {}) and mirror the same default in the corresponding
definition/implementation (function named getAnalytes) so callers can omit the
argument; if you prefer not to add a default, instead update the doc comment to
remove the word "optional" and clarify that columns are required—ensure the
declaration, implementation, and docs remain consistent.
| ofstream outstr(out.c_str()); | ||
| SVOutStream output(outstr, sep, replacement, quoting_method); | ||
| output.modifyStrings(false); |
There was a problem hiding this comment.
Missing output file creation validation.
The mzML branch (lines 1574-1577) validates that the output file was successfully created. The CHROMPARQUET branch should include the same check for consistency and robustness.
🛡️ Proposed fix to add file creation validation
ofstream outstr(out.c_str());
+ if (!outstr)
+ {
+ throw Exception::UnableToCreateFile(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION, out);
+ }
SVOutStream output(outstr, sep, replacement, quoting_method);📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| ofstream outstr(out.c_str()); | |
| SVOutStream output(outstr, sep, replacement, quoting_method); | |
| output.modifyStrings(false); | |
| ofstream outstr(out.c_str()); | |
| if (!outstr) | |
| { | |
| throw Exception::UnableToCreateFile(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION, out); | |
| } | |
| SVOutStream output(outstr, sep, replacement, quoting_method); | |
| output.modifyStrings(false); |
🤖 Prompt for AI Agents
In `@src/topp/TextExporter.cpp` around lines 1681 - 1683, The CHROMPARQUET branch
creates an ofstream named outstr and immediately constructs an SVOutStream
(symbols: ofstream outstr(out.c_str()), SVOutStream output(...),
output.modifyStrings(false)) but doesn't validate that the output file was
successfully opened; add the same check used in the mzML branch after creating
outstr (e.g., test outstr.is_open() or outstr.fail()), and if the file open
failed emit a clear error/log and return/throw the same error path used by the
mzML branch so the function exits early instead of continuing with a bad stream.
When building pyOpenMS standalone via find_package(OpenMS), the
OPENMS_ARROW_TARGET variable is not available because it's only set
in cmake_findExternalLibs.cmake during the main OpenMS build and not
exported in OpenMSConfig.cmake.
This caused wheel builds to fail with:
CMake Error at CMakeLists.txt:347 (get_target_property):
get_target_property called with incorrect number of arguments
Add Arrow discovery logic to find the Arrow target when building
standalone with WITH_PARQUET enabled.
Co-Authored-By: Claude Opus 4.5 <[email protected]>
This PR adds Python bindings for reading XIC data from Parquet files,
enabling integration with pandas, pyarrow, and pyopenms_viz.
Additions:
- XICParquetFile Python bindings with:
- list-of-files constructor support
- get_data_dict, get_chromatograms, to_df, to_arrow
- get_analyte_dict, get_analyte_df, get_run_dict, get_run_df
- df_columns for column discovery
- Filter expressions with predicate pushdown support
- ParquetFilter/ParquetFilterBuilder Python bindings for typed filter construction
- ParquetQuery/ChromatogramQuery for chainable querying
- Unit tests for Python bindings
Example usage:
```python
import pyopenms as poms
import glob
files = glob.glob('*.xic')
xic_h = poms.XICParquetFile(files)
xic_h.get_chromatograms(filter="precursor_id=1318 & annotation=y3^1").plot(
kind="chromatogram", x="rt", y="intensity", by="source_file"
)
```
Depends on PR #8737 (C++ core).
Based on work from PR #8725 by @singjc.
Co-Authored-By: singjc <[email protected]>
Co-Authored-By: Claude Opus 4.5 <[email protected]>
* Add pyOpenMS bindings for XICParquetFile
This PR adds Python bindings for reading XIC data from Parquet files,
enabling integration with pandas, pyarrow, and pyopenms_viz.
Additions:
- XICParquetFile Python bindings with:
- list-of-files constructor support
- get_data_dict, get_chromatograms, to_df, to_arrow
- get_analyte_dict, get_analyte_df, get_run_dict, get_run_df
- df_columns for column discovery
- Filter expressions with predicate pushdown support
- ParquetFilter/ParquetFilterBuilder Python bindings for typed filter construction
- ParquetQuery/ChromatogramQuery for chainable querying
- Unit tests for Python bindings
Example usage:
```python
import pyopenms as poms
import glob
files = glob.glob('*.xic')
xic_h = poms.XICParquetFile(files)
xic_h.get_chromatograms(filter="precursor_id=1318 & annotation=y3^1").plot(
kind="chromatogram", x="rt", y="intensity", by="source_file"
)
```
Depends on PR #8737 (C++ core).
Based on work from PR #8725 by @singjc.
Co-Authored-By: singjc <[email protected]>
Co-Authored-By: Claude Opus 4.5 <[email protected]>
* Fix Windows pyOpenMS build: remove conflicting String cppclass import
Remove `from String cimport String` from XICParquetFile.pyx addon.
This import brought in the C++ cppclass declaration, which conflicts
with the autowrap-generated cdef class wrapper on Windows. The addon
uses `isinstance(x, String)` which requires the Python type (cdef class),
not the cppclass. The cdef class is already available in scope when
the addon is injected into the generated module.
Co-Authored-By: Claude Opus 4.5 <[email protected]>
---------
Co-authored-by: singjc <[email protected]>
Co-authored-by: Claude Opus 4.5 <[email protected]>
…atograms (C++ core) (#8737) * Add Parquet support for XIC chromatogram output (C++ core) This PR adds support for OpenSWATH chromatogram Parquet files (.xic). It introduces a Parquet writer for chromatograms, a reader with filtering and predicate pushdown, and test coverage including TOPP regression checks. The schema uses a similar (expanded) schema that was implemented in PyProphet to convert the sqMass chromatograms to parquet. Adding parquet xic output directly to OpenSwathWorkflow skips the additional extra conversion step, and provides storage benefits from using parquet compared to sqMass. Additions: - MSChromatogramParquetConsumer: writes .xic Parquet files with a PyProphet-compatible schema (metadata + compressed RT/intensity arrays) - XICParquetFile: reads .xic files with filter expressions; supports multi-file input and Arrow Dataset predicate pushdown with compute fallback - ParquetFilter: typed, chainable Parquet filter builder for predicate pushdown - TextExporter: now supports .xic input, exporting summary or exploded TSV/CSV/TXT for testable text output - OpenSwathWorkflow: added -out_chrom_ext xic option for Parquet output - Unit and TOPP tests for the new functionality Note: Python bindings will be added in a follow-up PR. Based on work from PR #8725 by @singjc. Co-Authored-By: singjc <[email protected]> Co-Authored-By: Claude Opus 4.5 <[email protected]> * Fix pyOpenMS standalone build when WITH_PARQUET is enabled When building pyOpenMS standalone via find_package(OpenMS), the OPENMS_ARROW_TARGET variable is not available because it's only set in cmake_findExternalLibs.cmake during the main OpenMS build and not exported in OpenMSConfig.cmake. This caused wheel builds to fail with: CMake Error at CMakeLists.txt:347 (get_target_property): get_target_property called with incorrect number of arguments Add Arrow discovery logic to find the Arrow target when building standalone with WITH_PARQUET enabled. Co-Authored-By: Claude Opus 4.5 <[email protected]> --------- Co-authored-by: singjc <[email protected]> Co-authored-by: Claude Opus 4.5 <[email protected]>
…rrect references (#8759) Add 22 missing PR entries across all sections (TOPP tools, PyOpenMS, OpenMS Library, Fixes, Build System) and fix two incorrect PR number references (#8633→#8637 for SpectrumNativeIDParser, #8725→#8737/#8738 for XICParquetFile). Co-authored-by: Claude Opus 4.6 <[email protected]>
Description
This PR adds support for OpenSWATH chromatogram Parquet files (
.xic). It introduces a Parquet writer for chromatograms, a reader with filtering and predicate pushdown, and test coverage including TOPP regression checks.The schema uses a similar (expanded) schema that was implemented in PyProphet to convert the sqMass chromatograms to parquet. Adding parquet xic output directly to OpenSwathWorkflow skips the additional extra conversion step, and we still see the storage benefits from using parquet compared to sqMass.
Additions
.xicParquet files with a PyProphet‑compatible schema (metadata + compressed RT/intensity arrays)..xicfiles with filter expressions; supports multi‑file input and Arrow Dataset predicate pushdown with compute fallback..xicinput, exporting summary or exploded TSV/CSV/TXT for testable text output.-out_chrom_ext xicoption for Parquet output.Note
This is the C++ core part of #8725. Python/Cython bindings will be added in a follow-up PR that depends on this one.
Based on work by @singjc in PR #8725.
Checklist
🤖 Generated with Claude Code
Summary by CodeRabbit