Repository navigation
Add QPX feature-format Arrow/DataFrame/Parquet export for ConsensusMap - #8729
Conversation
|
Caution Review failedThe pull request is closed. 📝 WalkthroughWalkthroughAdds a new ConsensusMap → Arrow/Parquet exporter (C++ + pyOpenMS), unit tests, build/test wiring under Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant CMap as ConsensusMap
participant Export as ConsensusMapArrowExport
participant Arrow as arrow::Table
participant Parquet as ParquetWriter
Client->>Export: exportToArrow(cmap)
Export->>CMap: iterate features & metadata
Export->>Export: build scalars, lists, structs (mods/intensities/scores/metavals)
Export->>Arrow: append columns & finalize table
Arrow-->>Export: arrow::Table
Export-->>Client: return arrow::Table
Client->>Export: exportToParquet(cmap, filename, config)
Export->>Export: call exportToArrow(cmap)
Export->>Parquet: write table with compression/config
Parquet-->>Client: success / failure
sequenceDiagram
participant Python as pyOpenMS
participant PyCMap as ConsensusMap (py)
participant CppExport as ConsensusMapArrowExport (C++)
participant PyArrow as pyarrow
participant Pandas as pandas
participant ParquetFile as ParquetFile
Python->>PyCMap: to_feature_arrow(args)
PyCMap->>CppExport: exportToArrow(cmap)
CppExport->>PyArrow: return arrow::Table (C bindings)
PyArrow-->>PyCMap: table
PyCMap->>Pandas: table.to_pandas()
Pandas-->>Python: DataFrame
Python->>PyCMap: to_feature_parquet(path, config)
PyCMap->>CppExport: exportToParquet(cmap, path, config)
CppExport->>ParquetFile: write with compression/config
ParquetFile-->>Python: success/failure
Possibly related PRs
Suggested labels
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: 1
🤖 Fix all issues with AI agents
In `@src/topp/ProteomicsLFQ.cpp`:
- Around line 1694-1704: The export failure currently only logs an error; update
the block that calls ConsensusMapArrowExport::exportToParquet (where out_parquet
is read via getStringOption_) so that on a false return it aborts the run with a
non-zero failure instead of continuing; locate the if
(!ConsensusMapArrowExport::exportToParquet(consensus, out_parquet)) branch in
ProteomicsLFQ.cpp and either throw an appropriate runtime/IO exception
(including the out_parquet path in the message) or call the existing process
exit mechanism (exit/non-zero return) used elsewhere in the tool to ensure the
process fails when Parquet export cannot be written.
🧹 Nitpick comments (9)
src/pyOpenMS/addons/PeptideIdentificationList.pyx (1)
161-164: Consistent delegation pattern, minor performance note.The delegation to
to_arrow()avoids duplicating metavalue discovery logic, which is good for maintainability. However, callingto_arrow()constructs the full table just to retrieve column names. For very large datasets, users callingdf_columns()before export would incur double the work.Consider adding a
schema_only=Trueparameter or caching discovered columns if this becomes a performance concern in practice.src/openms/source/FORMAT/ConsensusMapArrowExport.cpp (4)
58-726: Very complex method - consider documentation or factoring helpers.The static analysis correctly flagged this as "Very Complex Method". At ~670 lines,
exportToArrowhandles many responsibilities. While the complexity is somewhat inherent to building a 33-column Arrow table with nested types, consider:
- Adding a high-level comment block explaining the column groups (scalar columns, list columns, struct columns)
- Extracting helper functions for repeated patterns (e.g., modification extraction at lines 227-309)
That said, for a data export routine of this nature, the linear structure aids readability and the complexity is acceptable for the "Chill" review setting.
737-738: Prefer\noverstd::endlfor logging.Per coding guidelines, avoid
std::endland prefer\nfor better performance in logging and output operations.Suggested fix
- OPENMS_LOG_ERROR << "ConsensusMapArrowExport: Failed to create Arrow table" << std::endl; + OPENMS_LOG_ERROR << "ConsensusMapArrowExport: Failed to create Arrow table\n";
745-746: Prefer\noverstd::endlfor logging.Suggested fix
- OPENMS_LOG_ERROR << "ConsensusMapArrowExport: Failed to open file: " << filename << std::endl; + OPENMS_LOG_ERROR << "ConsensusMapArrowExport: Failed to open file: " << filename << "\n";
792-794: Prefer\noverstd::endlfor logging.Suggested fix
- OPENMS_LOG_ERROR << "ConsensusMapArrowExport: Failed to write Parquet: " - << status.ToString() << std::endl; + OPENMS_LOG_ERROR << "ConsensusMapArrowExport: Failed to write Parquet: " + << status.ToString() << "\n";src/pyOpenMS/addons/ConsensusMap.pyx (1)
915-915: Minor: Move constant set outside the loop.
_excluded_feature_mvsis redefined on every iteration of the feature loop. Moving it outside (e.g., near line 653 with the other excluded sets) would be slightly more efficient.Suggested fix
# Excluded metavalues (have dedicated columns) _excluded_metavalues = {b"target_decoy", b"predicted_RT", b"predicted_rt"} + _excluded_feature_mvs = {b"rt_start", b"rt_stop", b"start_ion_mobility", b"stop_ion_mobility"} def _get_value_type(val): ... for cf in self: ... # feature_metavalues feature_mvs = [] cf_keys = [] cf.getKeys(cf_keys) - _excluded_feature_mvs = {b"rt_start", b"rt_stop", b"start_ion_mobility", b"stop_ion_mobility"} for key in cf_keys:src/pyOpenMS/tests/unittests/test_feature_dataframe.py (1)
309-344: Consider using pytest'stmp_pathfixture for cleaner test code.The Parquet tests use
tempfile.NamedTemporaryFilewith manual cleanup. While this works, pytest'stmp_pathfixture (already used intest_psm_dataframe.py) provides automatic cleanup.Example refactor
class TestFeatureParquet: """Tests for to_feature_parquet().""" def test_write_read(self, tmp_path): import pyarrow.parquet as pq cmap = create_test_consensus_map() path = tmp_path / "test.parquet" cmap.to_feature_parquet(str(path)) table = pq.read_table(path) assert table.num_rows == 3 assert "sequence" in table.column_namessrc/topp/IsobaricWorkflow.cpp (1)
860-872: Prefer\noverstd::endlfor logging.Per coding guidelines, avoid
std::endland prefer\nfor better performance.Suggested fix
`#ifdef` WITH_PARQUET { String out_parquet = getStringOption_("out_parquet"); if (!out_parquet.empty()) { - OPENMS_LOG_INFO << "Exporting feature-level Parquet file..." << std::endl; + OPENMS_LOG_INFO << "Exporting feature-level Parquet file...\n"; if (!ConsensusMapArrowExport::exportToParquet(cmap, out_parquet)) { - OPENMS_LOG_ERROR << "Failed to write Parquet file: " << out_parquet << std::endl; + OPENMS_LOG_ERROR << "Failed to write Parquet file: " << out_parquet << "\n"; } } } `#endif`src/topp/ProteomicsLFQ.cpp (1)
1699-1702: Replace std::endl with \n in logging output for better performance.
std::endl forces a flush; use\nto keep logging efficient.🔧 Suggested change
- OPENMS_LOG_INFO << "Exporting feature-level Parquet file..." << std::endl; + OPENMS_LOG_INFO << "Exporting feature-level Parquet file...\n"; if (!ConsensusMapArrowExport::exportToParquet(consensus, out_parquet)) { - OPENMS_LOG_ERROR << "Failed to write Parquet file: " << out_parquet << std::endl; + OPENMS_LOG_ERROR << "Failed to write Parquet file: " << out_parquet << '\n';
There was a problem hiding this comment.
Actionable comments posted: 4
🤖 Fix all issues with AI agents
In `@src/openms/source/FORMAT/ConsensusMapArrowExport.cpp`:
- Around line 897-903: The builder is only conditionally calling
builder.enable_statistics() when config.write_statistics is true, leaving the
default state when false; update the conditional around
builder.enable_statistics() in ConsensusMapArrowExport.cpp to add an explicit
else branch that calls builder.disable_statistics() so the builder's statistics
mode matches config.write_statistics (refer to builder.data_pagesize,
builder.enable_statistics, builder.disable_statistics and the
config.write_statistics flag to locate the change).
In `@src/pyOpenMS/addons/ConsensusMap.pyx`:
- Around line 873-883: The current de-duplication uses list(set(...)) which
randomizes order; update the post-processing of gg_acc and gg_nam in
ConsensusMap.pyx so you preserve the original iteration order (matching the C++
path) by using an order-preserving dedup (e.g., replace list(set(gg_acc)) and
list(set(gg_nam)) with an order-preserving approach such as
list(dict.fromkeys(gg_acc)) and list(dict.fromkeys(gg_nam))) when assigning
all_gg_accessions and all_gg_names, keeping the existing conditional fallback to
[] when the lists are empty; reference variables: gg_acc, gg_nam,
all_gg_accessions, all_gg_names, gg_accessions_lookup, gg_names_lookup,
protein_accessions.
In `@src/pyOpenMS/addons/PeptideIdentificationList.pyx`:
- Around line 327-328: The score column in PeptideIdentificationList.to_arrow
currently uses pa.float32 while to_psm_arrow uses pa.float64; update the
to_arrow implementation so data_dict["score"] is created with pa.float64() (find
the to_arrow method in PeptideIdentificationList.pyx and replace the pa.float32
usage for the "score" field) to make precision consistent across export methods.
- Around line 227-231: The decode_mv_name function should guard against ontology
lookup failures: wrap the cv.getTerm(name) call inside a try/except around the
branch in decode_mv_name (the function itself) so that if cv.getTerm(name)
raises Exception (e.g., Exception::InvalidValue) you catch it and simply return
the raw name; ensure you only attempt the lookup when cv is not None and
name.startswith("MS:"), and on any exception fall back to returning name to
avoid export failures.
🧹 Nitpick comments (1)
src/openms/source/FORMAT/ConsensusMapArrowExport.cpp (1)
61-713: Consider extracting helpers to reduceexportToArrowcomplexity.The method spans many responsibilities (builder init, per-feature extraction, finalization). Splitting into helpers will improve maintainability and testability, and aligns with the static-analysis complexity warning.
0aefcb1 to
bfe9f58
Compare
There was a problem hiding this comment.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/pyOpenMS/addons/PeptideIdentificationList.pyx (1)
77-130:⚠️ Potential issue | 🟡 MinorUpdate
to_df()docstring for the new metavalue shape.
to_df()now returns a singlemetavalueslist column (viato_arrow()), but the docstring still implies separate per-metavalue columns. This is user-facing documentation and should match the new output.✏️ Proposed docstring fix
- and additional meta value columns from PeptideHit. + and a `metavalues` column (list of {"name", "value", "value_type"}) + from the best PeptideHit.
🧹 Nitpick comments (5)
src/openms/source/FORMAT/ConsensusMapArrowExport.cpp (3)
61-713: Consider splittingexportToArrowinto focused helpers.This method mixes builder setup, per-feature extraction, and finalization in one very large block. Extracting phases into private helpers (e.g., init builders, fill per-feature columns, finalize arrays/schema) would reduce complexity and improve maintainability.
156-212: Avoidstd::endlin logging; use"\n"instead.
std::endlflushes the stream every time and is discouraged in OpenMS logging. Replace with"\n"across the error logs in this file.♻️ Example change
- if (!status.ok()) { OPENMS_LOG_ERROR << "ConsensusMapArrowExport: sequence_builder Reserve failed: " << status.ToString() << std::endl; return nullptr; } + if (!status.ok()) { OPENMS_LOG_ERROR << "ConsensusMapArrowExport: sequence_builder Reserve failed: " << status.ToString() << "\n"; return nullptr; }As per coding guidelines: Avoid std::endl; prefer \n for better performance in logging and output operations.
304-351: Prefer OpenMS::String for numeric formatting (UNIMOD IDs/positions).The use of
std::to_stringfor numeric formatting diverges from OpenMS conventions. ConsiderOpenMS::String::number(...)and then converting tostd::stringfor Arrow builders (same for scan number formatting).As per coding guidelines: Prefer OpenMS::String for numeric formatting and parsing due to precision and performance advantages.
src/pyOpenMS/addons/PeptideIdentificationList.pyx (2)
221-246: Consider caching the PSI‑MS ontology load.
cv.loadFromOBO(...)runs on every call withdecode_ontology=True, which can become a bottleneck in tight loops. IfControlledVocabularyinstances are safe to reuse, a module-level cache would avoid repeated disk I/O.⚙️ Example cache sketch (if safe to reuse)
+cdef object _PSIMS_CV = None- cv = None - if decode_ontology: - cv = _ControlledVocabulary() - cv.loadFromOBO("psims", _File.getOpenMSDataPath() + "/CV/psi-ms.obo") + global _PSIMS_CV + cv = None + if decode_ontology: + if _PSIMS_CV is None: + _PSIMS_CV = _ControlledVocabulary() + _PSIMS_CV.loadFromOBO("psims", _File.getOpenMSDataPath() + "/CV/psi-ms.obo") + cv = _PSIMS_CV
701-985: Verify ProForma conversion failure handling.
_ProForma.fromAASequence(seq)can throw for unsupported/unknown modifications; if that happens, the entire export will abort. Please verify behavior on edge cases and consider a fallback or clearer error path.🧪 Possible guard (choose preferred fallback)
- pf = _ProForma.fromAASequence(seq) - all_peptidoform.append(_ProForma.toString(pf, _ProForma.WriteMode.CANONICAL)) + try: + pf = _ProForma.fromAASequence(seq) + all_peptidoform.append(_ProForma.toString(pf, _ProForma.WriteMode.CANONICAL)) + except Exception: + # Fallback or raise with context (verify preferred behavior) + all_peptidoform.append(str(seq))
Add feature-level export following the QPX (Quantitative Proteomics Exchange) schema to ConsensusMap (Python addon) and as a C++ class, with integration into ProteomicsLFQ and IsobaricWorkflow TOPP tools. Python (ConsensusMap.pyx): - to_feature_arrow(): Core Arrow Table export with full QPX feature schema - to_feature_df(): Thin pandas wrapper - to_feature_parquet(): Direct Parquet export with compression options - to_qpx(): QPX dict format with file_metadata and features array - feature_columns(): Column name discovery C++ (ConsensusMapArrowExport): - exportToArrow(): Arrow Table construction with column builders - exportToParquet(): Parquet file writing with configurable compression TOPP tools: - ProteomicsLFQ: out_parquet parameter, export after protein inference/FDR - IsobaricWorkflow: out_parquet parameter, export after FDR filtering Co-Authored-By: Claude Opus 4.5 <[email protected]>
… delegation - to_df() now delegates to to_arrow().to_pandas() instead of duplicating data extraction logic (~100 lines removed) - df_columns() now delegates to to_arrow().column_names (~25 lines removed) - Extract _add_mod() helper for modification extraction in to_psm_df() - Fix ConsensusMapArrowExport.cpp: getOneLetterCode() returns String not char Co-Authored-By: Claude Opus 4.5 <[email protected]>
- Fix ConsensusMap.pyx: Decode bytes to str for protein group accession lookup (pg.accessions and ig.accessions are bytes, need to match string accessions from PeptideEvidence) - Fix test_feature_dataframe.py: Use BaseFeature with insert(map_idx, bf) instead of FeatureHandle, use PeptideIdentificationList instead of Python list, use set comparison for column filtering test - Fix test_psm_dataframe.py: Accept UNIMOD:35 in ProForma peptidoform (ProForma canonical notation uses UNIMOD accessions, not names) Co-Authored-By: Claude Opus 4.5 <[email protected]>
Test coverage for: - exportToArrow(): empty map, basic export, column types, modifications - exportToParquet(): basic export, empty map, compression options (SNAPPY, ZSTD, NONE) Tests are conditionally compiled with WITH_PARQUET guard. Co-Authored-By: Claude Opus 4.5 <[email protected]>
…d naming - Add Arrow Reserve() and Finish() status checking in C++ export - Deduplicate protein accessions before unique/qvalue logic - Use minimum q-value across all protein accessions (not first match) - Add missing <limits>, <map>, <vector> includes - Use AppendNull for missing values instead of empty strings - Remove unused pg_membership code from ConsensusMap.pyx - Rename to_qpx() to to_feature_qpx()/to_psm_qpx() for clarity - Refactor legacy to_arrow()/df_columns() to use key-value pairs for metavalues (consistent with QPX-style APIs, eliminates dynamic column discovery) - Update tests for renamed methods Co-Authored-By: Claude Opus 4.5 <[email protected]>
- Remove unused numpy import from test_feature_dataframe.py - Add exception handling for ontology term lookup in decode_mv_name - Use float64 for score column (consistency with to_psm_arrow) - Add explicit disable_statistics() when write_statistics is false Co-Authored-By: Claude Opus 4.5 <[email protected]>
- Use SpectrumNativeIDParser for efficient native ID parsing (replaces loop over CV accessions) - Return CANNOT_WRITE_OUTPUT_FILE when Parquet export fails in ProteomicsLFQ and IsobaricWorkflow - Rename out_parquet to out_feature_qpx in ProteomicsLFQ and IsobaricWorkflow Co-Authored-By: Claude Opus 4.5 <[email protected]>
9db6a78 to
68a8177
Compare
There was a problem hiding this comment.
Actionable comments posted: 4
🤖 Fix all issues with AI agents
In `@src/openms/include/OpenMS/FORMAT/ConsensusMapArrowExport.h`:
- Around line 31-69: Add PyBind11/Cython .pxd declarations for the new C++ class
ConsensusMapArrowExport so the API is available from Python: declare the class
with its static methods exportToArrow(const ConsensusMap&), returning a
shared_ptr to arrow::Table (or an appropriate wrapped type), and
exportToParquet(const ConsensusMap&, const String&, const ParquetWriteConfig& =
ParquetWriteConfig{}). Also add binding declarations for ParquetWriteConfig and
forward-declare ConsensusMap and arrow::Table types used by these methods so the
signatures resolve during compile of the Python bindings; match naming and
signatures exactly to the C++ symbols (ConsensusMapArrowExport, exportToArrow,
exportToParquet, ParquetWriteConfig, ConsensusMap).
In `@src/openms/source/FORMAT/ConsensusMapArrowExport.cpp`:
- Around line 148-203: The error logging in the Reserve failure blocks (e.g.,
sequence_builder.Reserve, peptidoform_builder.Reserve,
anchor_protein_builder.Reserve, reference_file_builder.Reserve,
scan_builder.Reserve, score_type_builder.Reserve,
spectrum_reference_builder.Reserve, scan_ref_file_builder.Reserve,
cv_params_builder.Reserve, additional_intensities_builder.Reserve,
precursor_charge_builder.Reserve, is_decoy_builder.Reserve,
unique_builder.Reserve, calculated_mz_builder.Reserve,
observed_mz_builder.Reserve, rt_builder.Reserve, quality_builder.Reserve,
rt_start_builder.Reserve, rt_stop_builder.Reserve, ion_mobility_builder.Reserve,
predicted_rt_builder.Reserve, start_ion_mobility_builder.Reserve,
stop_ion_mobility_builder.Reserve, pep_builder.Reserve, score_builder.Reserve,
pg_qvalue_builder.Reserve) uses std::endl which forces flushes; change each
OPENMS_LOG_ERROR << "... Reserve failed: " << status.ToString() << std::endl to
use '\n' instead (e.g., << '\n') so the logger can manage flushing and avoid
hot-path flush overhead.
In `@src/pyOpenMS/addons/ConsensusMap.pyx`:
- Around line 645-769: _reserved metavalues are bytes ( _excluded_metavalues )
but best_hit.getKeys() can yield str which lets reserved keys pass the
exclusion; normalize keys to strings before membership checks by decoding bytes
to utf-8 (or str() for non-bytes) when iterating keys in the additional_scores
block (where best_hit.getKeys(keys), for key in keys, key_str = ... and the
membership check if key not in _excluded_metavalues), or alternatively convert
_excluded_metavalues to a set of string names once; ensure you use the
normalized key_str for both the exclusion check and later lookups like
best_hit.getMetaValue(key) where needed (use original key for getMetaValue if
required).
In `@src/pyOpenMS/addons/PeptideIdentificationList.pyx`:
- Around line 298-312: The metavalue handling is decoding autowrap strings and
comparing against byte-based exclusion sets, causing wrong types and leaking
excluded keys; update the logic in PeptideIdentificationList.pyx (around
besthit.getKeys loop and any other places using .decode() like where
decode_mv_name is called) to normalize keys to Python str once (e.g., ensure
mv_name = str(mv) or use a small helper) and remove explicit .decode("utf-8")
calls, and change the exclusion sets (_excluded_* referenced in the file) to use
string literals (e.g., "target_decoy", "predicted_RT") so membership checks
succeed; keep the rest of the metavalues construction (metavalues.append with
name/value/value_type) intact.
🧹 Nitpick comments (1)
src/openms/source/FORMAT/ConsensusMapArrowExport.cpp (1)
53-705: Consider extracting helper routines fromexportToArrowfor maintainability.The method mixes schema definition, data extraction, and builder finalization in one very large function. Splitting into helpers (e.g., builder setup, per-feature fill, finish/assemble) would improve readability and reduce risk in future changes.
| /** | ||
| @brief Export ConsensusMap feature data to Apache Arrow format following QPX feature schema | ||
|
|
||
| This class provides static methods to export ConsensusMap data to Apache Arrow | ||
| Tables and Parquet files. The schema follows the QPX (Quantitative Proteomics | ||
| Exchange) feature format. | ||
|
|
||
| @experimental This API is experimental and may change in future versions. | ||
|
|
||
| @ingroup FileIO | ||
| */ | ||
| class OPENMS_DLLAPI ConsensusMapArrowExport | ||
| { | ||
| public: | ||
| /** | ||
| @brief Export ConsensusMap to Apache Arrow Table | ||
|
|
||
| Exports consensus features following the QPX feature schema. Each | ||
| ConsensusFeature becomes one row with identification, quantification, | ||
| and protein group information. | ||
|
|
||
| @param[in] cmap The ConsensusMap to export | ||
| @return Shared pointer to Arrow Table, or nullptr on error | ||
| */ | ||
| static std::shared_ptr<arrow::Table> exportToArrow(const ConsensusMap& cmap); | ||
|
|
||
| /** | ||
| @brief Export ConsensusMap to Parquet file | ||
|
|
||
| @param[in] cmap The ConsensusMap to export | ||
| @param[in] filename Output file path | ||
| @param[in] config Parquet writing options | ||
| @return true on success, false on error | ||
| */ | ||
| static bool exportToParquet( | ||
| const ConsensusMap& cmap, | ||
| const String& filename, | ||
| const ParquetWriteConfig& config = ParquetWriteConfig{}); | ||
| }; |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Search for ConsensusMapArrowExport references
rg -n "ConsensusMapArrowExport" --type-list | head -20
rg -n "ConsensusMapArrowExport" -g "*.{pxd,pyx,py,cpp,h,hpp}"Repository: OpenMS/OpenMS
Length of output: 16021
🏁 Script executed:
#!/bin/bash
# Check if ConsensusMap has existing bindings to understand the pattern
rg -n "ConsensusMap" -g "*.pxd" -A 3 | head -50Repository: OpenMS/OpenMS
Length of output: 4160
🏁 Script executed:
#!/bin/bash
# Check FileHandler for format registry to see if new format is registered
fd -e "h" -e "hpp" -e "cpp" | xargs rg -l "NamesOfTypes\|FileHandler" | head -5Repository: OpenMS/OpenMS
Length of output: 39
🏁 Script executed:
#!/bin/bash
# Check for any recent pyOpenMS bindings/additions related to Arrow/Parquet
fd -e "pxd" -e "pyx" | xargs rg -l "Arrow\|Parquet\|exportTo" | head -10Repository: OpenMS/OpenMS
Length of output: 39
Add .pxd bindings for ConsensusMapArrowExport to expose the API to pyOpenMS users.
The new public ConsensusMapArrowExport C++ API is currently used in TOPP tools (ProteomicsLFQ, IsobaricWorkflow) and has comprehensive C++ tests, but is not exposed to Python. Add corresponding .pxd declarations in src/pyOpenMS/pxds/ to maintain API parity across C++ and Python users, consistent with how ConsensusMap is handled in existing bindings.
🤖 Prompt for AI Agents
In `@src/openms/include/OpenMS/FORMAT/ConsensusMapArrowExport.h` around lines 31 -
69, Add PyBind11/Cython .pxd declarations for the new C++ class
ConsensusMapArrowExport so the API is available from Python: declare the class
with its static methods exportToArrow(const ConsensusMap&), returning a
shared_ptr to arrow::Table (or an appropriate wrapped type), and
exportToParquet(const ConsensusMap&, const String&, const ParquetWriteConfig& =
ParquetWriteConfig{}). Also add binding declarations for ParquetWriteConfig and
forward-declare ConsensusMap and arrow::Table types used by these methods so the
signatures resolve during compile of the Python bindings; match naming and
signatures exactly to the C++ symbols (ConsensusMapArrowExport, exportToArrow,
exportToParquet, ParquetWriteConfig, ConsensusMap).
| // Reserve for simple column builders (one value per feature) | ||
| status = sequence_builder.Reserve(num_features); | ||
| if (!status.ok()) { OPENMS_LOG_ERROR << "ConsensusMapArrowExport: sequence_builder Reserve failed: " << status.ToString() << std::endl; return nullptr; } | ||
| status = peptidoform_builder.Reserve(num_features); | ||
| if (!status.ok()) { OPENMS_LOG_ERROR << "ConsensusMapArrowExport: peptidoform_builder Reserve failed: " << status.ToString() << std::endl; return nullptr; } | ||
| status = anchor_protein_builder.Reserve(num_features); | ||
| if (!status.ok()) { OPENMS_LOG_ERROR << "ConsensusMapArrowExport: anchor_protein_builder Reserve failed: " << status.ToString() << std::endl; return nullptr; } | ||
| status = reference_file_builder.Reserve(num_features); | ||
| if (!status.ok()) { OPENMS_LOG_ERROR << "ConsensusMapArrowExport: reference_file_builder Reserve failed: " << status.ToString() << std::endl; return nullptr; } | ||
| status = scan_builder.Reserve(num_features); | ||
| if (!status.ok()) { OPENMS_LOG_ERROR << "ConsensusMapArrowExport: scan_builder Reserve failed: " << status.ToString() << std::endl; return nullptr; } | ||
| status = score_type_builder.Reserve(num_features); | ||
| if (!status.ok()) { OPENMS_LOG_ERROR << "ConsensusMapArrowExport: score_type_builder Reserve failed: " << status.ToString() << std::endl; return nullptr; } | ||
| status = spectrum_reference_builder.Reserve(num_features); | ||
| if (!status.ok()) { OPENMS_LOG_ERROR << "ConsensusMapArrowExport: spectrum_reference_builder Reserve failed: " << status.ToString() << std::endl; return nullptr; } | ||
| status = scan_ref_file_builder.Reserve(num_features); | ||
| if (!status.ok()) { OPENMS_LOG_ERROR << "ConsensusMapArrowExport: scan_ref_file_builder Reserve failed: " << status.ToString() << std::endl; return nullptr; } | ||
| status = cv_params_builder.Reserve(num_features); | ||
| if (!status.ok()) { OPENMS_LOG_ERROR << "ConsensusMapArrowExport: cv_params_builder Reserve failed: " << status.ToString() << std::endl; return nullptr; } | ||
| status = additional_intensities_builder.Reserve(num_features); | ||
| if (!status.ok()) { OPENMS_LOG_ERROR << "ConsensusMapArrowExport: additional_intensities_builder Reserve failed: " << status.ToString() << std::endl; return nullptr; } | ||
|
|
||
| status = precursor_charge_builder.Reserve(num_features); | ||
| if (!status.ok()) { OPENMS_LOG_ERROR << "ConsensusMapArrowExport: precursor_charge_builder Reserve failed: " << status.ToString() << std::endl; return nullptr; } | ||
| status = is_decoy_builder.Reserve(num_features); | ||
| if (!status.ok()) { OPENMS_LOG_ERROR << "ConsensusMapArrowExport: is_decoy_builder Reserve failed: " << status.ToString() << std::endl; return nullptr; } | ||
| status = unique_builder.Reserve(num_features); | ||
| if (!status.ok()) { OPENMS_LOG_ERROR << "ConsensusMapArrowExport: unique_builder Reserve failed: " << status.ToString() << std::endl; return nullptr; } | ||
|
|
||
| status = calculated_mz_builder.Reserve(num_features); | ||
| if (!status.ok()) { OPENMS_LOG_ERROR << "ConsensusMapArrowExport: calculated_mz_builder Reserve failed: " << status.ToString() << std::endl; return nullptr; } | ||
| status = observed_mz_builder.Reserve(num_features); | ||
| if (!status.ok()) { OPENMS_LOG_ERROR << "ConsensusMapArrowExport: observed_mz_builder Reserve failed: " << status.ToString() << std::endl; return nullptr; } | ||
| status = rt_builder.Reserve(num_features); | ||
| if (!status.ok()) { OPENMS_LOG_ERROR << "ConsensusMapArrowExport: rt_builder Reserve failed: " << status.ToString() << std::endl; return nullptr; } | ||
| status = quality_builder.Reserve(num_features); | ||
| if (!status.ok()) { OPENMS_LOG_ERROR << "ConsensusMapArrowExport: quality_builder Reserve failed: " << status.ToString() << std::endl; return nullptr; } | ||
| status = rt_start_builder.Reserve(num_features); | ||
| if (!status.ok()) { OPENMS_LOG_ERROR << "ConsensusMapArrowExport: rt_start_builder Reserve failed: " << status.ToString() << std::endl; return nullptr; } | ||
| status = rt_stop_builder.Reserve(num_features); | ||
| if (!status.ok()) { OPENMS_LOG_ERROR << "ConsensusMapArrowExport: rt_stop_builder Reserve failed: " << status.ToString() << std::endl; return nullptr; } | ||
| status = ion_mobility_builder.Reserve(num_features); | ||
| if (!status.ok()) { OPENMS_LOG_ERROR << "ConsensusMapArrowExport: ion_mobility_builder Reserve failed: " << status.ToString() << std::endl; return nullptr; } | ||
| status = predicted_rt_builder.Reserve(num_features); | ||
| if (!status.ok()) { OPENMS_LOG_ERROR << "ConsensusMapArrowExport: predicted_rt_builder Reserve failed: " << status.ToString() << std::endl; return nullptr; } | ||
| status = start_ion_mobility_builder.Reserve(num_features); | ||
| if (!status.ok()) { OPENMS_LOG_ERROR << "ConsensusMapArrowExport: start_ion_mobility_builder Reserve failed: " << status.ToString() << std::endl; return nullptr; } | ||
| status = stop_ion_mobility_builder.Reserve(num_features); | ||
| if (!status.ok()) { OPENMS_LOG_ERROR << "ConsensusMapArrowExport: stop_ion_mobility_builder Reserve failed: " << status.ToString() << std::endl; return nullptr; } | ||
|
|
||
| status = pep_builder.Reserve(num_features); | ||
| if (!status.ok()) { OPENMS_LOG_ERROR << "ConsensusMapArrowExport: pep_builder Reserve failed: " << status.ToString() << std::endl; return nullptr; } | ||
| status = score_builder.Reserve(num_features); | ||
| if (!status.ok()) { OPENMS_LOG_ERROR << "ConsensusMapArrowExport: score_builder Reserve failed: " << status.ToString() << std::endl; return nullptr; } | ||
| status = pg_qvalue_builder.Reserve(num_features); | ||
| if (!status.ok()) { OPENMS_LOG_ERROR << "ConsensusMapArrowExport: pg_qvalue_builder Reserve failed: " << status.ToString() << std::endl; return nullptr; } |
There was a problem hiding this comment.
Avoid std::endl in error logging hot paths.
std::endl forces a flush on every log line and can become costly in large exports. Prefer '\n' and let the logger handle flushing.
🧹 Suggested pattern (apply across this file)
- if (!status.ok()) { OPENMS_LOG_ERROR << "ConsensusMapArrowExport: sequence_builder Reserve failed: " << status.ToString() << std::endl; return nullptr; }
+ if (!status.ok()) { OPENMS_LOG_ERROR << "ConsensusMapArrowExport: sequence_builder Reserve failed: " << status.ToString() << '\n'; return nullptr; }📝 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.
| // Reserve for simple column builders (one value per feature) | |
| status = sequence_builder.Reserve(num_features); | |
| if (!status.ok()) { OPENMS_LOG_ERROR << "ConsensusMapArrowExport: sequence_builder Reserve failed: " << status.ToString() << std::endl; return nullptr; } | |
| status = peptidoform_builder.Reserve(num_features); | |
| if (!status.ok()) { OPENMS_LOG_ERROR << "ConsensusMapArrowExport: peptidoform_builder Reserve failed: " << status.ToString() << std::endl; return nullptr; } | |
| status = anchor_protein_builder.Reserve(num_features); | |
| if (!status.ok()) { OPENMS_LOG_ERROR << "ConsensusMapArrowExport: anchor_protein_builder Reserve failed: " << status.ToString() << std::endl; return nullptr; } | |
| status = reference_file_builder.Reserve(num_features); | |
| if (!status.ok()) { OPENMS_LOG_ERROR << "ConsensusMapArrowExport: reference_file_builder Reserve failed: " << status.ToString() << std::endl; return nullptr; } | |
| status = scan_builder.Reserve(num_features); | |
| if (!status.ok()) { OPENMS_LOG_ERROR << "ConsensusMapArrowExport: scan_builder Reserve failed: " << status.ToString() << std::endl; return nullptr; } | |
| status = score_type_builder.Reserve(num_features); | |
| if (!status.ok()) { OPENMS_LOG_ERROR << "ConsensusMapArrowExport: score_type_builder Reserve failed: " << status.ToString() << std::endl; return nullptr; } | |
| status = spectrum_reference_builder.Reserve(num_features); | |
| if (!status.ok()) { OPENMS_LOG_ERROR << "ConsensusMapArrowExport: spectrum_reference_builder Reserve failed: " << status.ToString() << std::endl; return nullptr; } | |
| status = scan_ref_file_builder.Reserve(num_features); | |
| if (!status.ok()) { OPENMS_LOG_ERROR << "ConsensusMapArrowExport: scan_ref_file_builder Reserve failed: " << status.ToString() << std::endl; return nullptr; } | |
| status = cv_params_builder.Reserve(num_features); | |
| if (!status.ok()) { OPENMS_LOG_ERROR << "ConsensusMapArrowExport: cv_params_builder Reserve failed: " << status.ToString() << std::endl; return nullptr; } | |
| status = additional_intensities_builder.Reserve(num_features); | |
| if (!status.ok()) { OPENMS_LOG_ERROR << "ConsensusMapArrowExport: additional_intensities_builder Reserve failed: " << status.ToString() << std::endl; return nullptr; } | |
| status = precursor_charge_builder.Reserve(num_features); | |
| if (!status.ok()) { OPENMS_LOG_ERROR << "ConsensusMapArrowExport: precursor_charge_builder Reserve failed: " << status.ToString() << std::endl; return nullptr; } | |
| status = is_decoy_builder.Reserve(num_features); | |
| if (!status.ok()) { OPENMS_LOG_ERROR << "ConsensusMapArrowExport: is_decoy_builder Reserve failed: " << status.ToString() << std::endl; return nullptr; } | |
| status = unique_builder.Reserve(num_features); | |
| if (!status.ok()) { OPENMS_LOG_ERROR << "ConsensusMapArrowExport: unique_builder Reserve failed: " << status.ToString() << std::endl; return nullptr; } | |
| status = calculated_mz_builder.Reserve(num_features); | |
| if (!status.ok()) { OPENMS_LOG_ERROR << "ConsensusMapArrowExport: calculated_mz_builder Reserve failed: " << status.ToString() << std::endl; return nullptr; } | |
| status = observed_mz_builder.Reserve(num_features); | |
| if (!status.ok()) { OPENMS_LOG_ERROR << "ConsensusMapArrowExport: observed_mz_builder Reserve failed: " << status.ToString() << std::endl; return nullptr; } | |
| status = rt_builder.Reserve(num_features); | |
| if (!status.ok()) { OPENMS_LOG_ERROR << "ConsensusMapArrowExport: rt_builder Reserve failed: " << status.ToString() << std::endl; return nullptr; } | |
| status = quality_builder.Reserve(num_features); | |
| if (!status.ok()) { OPENMS_LOG_ERROR << "ConsensusMapArrowExport: quality_builder Reserve failed: " << status.ToString() << std::endl; return nullptr; } | |
| status = rt_start_builder.Reserve(num_features); | |
| if (!status.ok()) { OPENMS_LOG_ERROR << "ConsensusMapArrowExport: rt_start_builder Reserve failed: " << status.ToString() << std::endl; return nullptr; } | |
| status = rt_stop_builder.Reserve(num_features); | |
| if (!status.ok()) { OPENMS_LOG_ERROR << "ConsensusMapArrowExport: rt_stop_builder Reserve failed: " << status.ToString() << std::endl; return nullptr; } | |
| status = ion_mobility_builder.Reserve(num_features); | |
| if (!status.ok()) { OPENMS_LOG_ERROR << "ConsensusMapArrowExport: ion_mobility_builder Reserve failed: " << status.ToString() << std::endl; return nullptr; } | |
| status = predicted_rt_builder.Reserve(num_features); | |
| if (!status.ok()) { OPENMS_LOG_ERROR << "ConsensusMapArrowExport: predicted_rt_builder Reserve failed: " << status.ToString() << std::endl; return nullptr; } | |
| status = start_ion_mobility_builder.Reserve(num_features); | |
| if (!status.ok()) { OPENMS_LOG_ERROR << "ConsensusMapArrowExport: start_ion_mobility_builder Reserve failed: " << status.ToString() << std::endl; return nullptr; } | |
| status = stop_ion_mobility_builder.Reserve(num_features); | |
| if (!status.ok()) { OPENMS_LOG_ERROR << "ConsensusMapArrowExport: stop_ion_mobility_builder Reserve failed: " << status.ToString() << std::endl; return nullptr; } | |
| status = pep_builder.Reserve(num_features); | |
| if (!status.ok()) { OPENMS_LOG_ERROR << "ConsensusMapArrowExport: pep_builder Reserve failed: " << status.ToString() << std::endl; return nullptr; } | |
| status = score_builder.Reserve(num_features); | |
| if (!status.ok()) { OPENMS_LOG_ERROR << "ConsensusMapArrowExport: score_builder Reserve failed: " << status.ToString() << std::endl; return nullptr; } | |
| status = pg_qvalue_builder.Reserve(num_features); | |
| if (!status.ok()) { OPENMS_LOG_ERROR << "ConsensusMapArrowExport: pg_qvalue_builder Reserve failed: " << status.ToString() << std::endl; return nullptr; } | |
| // Reserve for simple column builders (one value per feature) | |
| status = sequence_builder.Reserve(num_features); | |
| if (!status.ok()) { OPENMS_LOG_ERROR << "ConsensusMapArrowExport: sequence_builder Reserve failed: " << status.ToString() << '\n'; return nullptr; } | |
| status = peptidoform_builder.Reserve(num_features); | |
| if (!status.ok()) { OPENMS_LOG_ERROR << "ConsensusMapArrowExport: peptidoform_builder Reserve failed: " << status.ToString() << '\n'; return nullptr; } | |
| status = anchor_protein_builder.Reserve(num_features); | |
| if (!status.ok()) { OPENMS_LOG_ERROR << "ConsensusMapArrowExport: anchor_protein_builder Reserve failed: " << status.ToString() << '\n'; return nullptr; } | |
| status = reference_file_builder.Reserve(num_features); | |
| if (!status.ok()) { OPENMS_LOG_ERROR << "ConsensusMapArrowExport: reference_file_builder Reserve failed: " << status.ToString() << '\n'; return nullptr; } | |
| status = scan_builder.Reserve(num_features); | |
| if (!status.ok()) { OPENMS_LOG_ERROR << "ConsensusMapArrowExport: scan_builder Reserve failed: " << status.ToString() << '\n'; return nullptr; } | |
| status = score_type_builder.Reserve(num_features); | |
| if (!status.ok()) { OPENMS_LOG_ERROR << "ConsensusMapArrowExport: score_type_builder Reserve failed: " << status.ToString() << '\n'; return nullptr; } | |
| status = spectrum_reference_builder.Reserve(num_features); | |
| if (!status.ok()) { OPENMS_LOG_ERROR << "ConsensusMapArrowExport: spectrum_reference_builder Reserve failed: " << status.ToString() << '\n'; return nullptr; } | |
| status = scan_ref_file_builder.Reserve(num_features); | |
| if (!status.ok()) { OPENMS_LOG_ERROR << "ConsensusMapArrowExport: scan_ref_file_builder Reserve failed: " << status.ToString() << '\n'; return nullptr; } | |
| status = cv_params_builder.Reserve(num_features); | |
| if (!status.ok()) { OPENMS_LOG_ERROR << "ConsensusMapArrowExport: cv_params_builder Reserve failed: " << status.ToString() << '\n'; return nullptr; } | |
| status = additional_intensities_builder.Reserve(num_features); | |
| if (!status.ok()) { OPENMS_LOG_ERROR << "ConsensusMapArrowExport: additional_intensities_builder Reserve failed: " << status.ToString() << '\n'; return nullptr; } | |
| status = precursor_charge_builder.Reserve(num_features); | |
| if (!status.ok()) { OPENMS_LOG_ERROR << "ConsensusMapArrowExport: precursor_charge_builder Reserve failed: " << status.ToString() << '\n'; return nullptr; } | |
| status = is_decoy_builder.Reserve(num_features); | |
| if (!status.ok()) { OPENMS_LOG_ERROR << "ConsensusMapArrowExport: is_decoy_builder Reserve failed: " << status.ToString() << '\n'; return nullptr; } | |
| status = unique_builder.Reserve(num_features); | |
| if (!status.ok()) { OPENMS_LOG_ERROR << "ConsensusMapArrowExport: unique_builder Reserve failed: " << status.ToString() << '\n'; return nullptr; } | |
| status = calculated_mz_builder.Reserve(num_features); | |
| if (!status.ok()) { OPENMS_LOG_ERROR << "ConsensusMapArrowExport: calculated_mz_builder Reserve failed: " << status.ToString() << '\n'; return nullptr; } | |
| status = observed_mz_builder.Reserve(num_features); | |
| if (!status.ok()) { OPENMS_LOG_ERROR << "ConsensusMapArrowExport: observed_mz_builder Reserve failed: " << status.ToString() << '\n'; return nullptr; } | |
| status = rt_builder.Reserve(num_features); | |
| if (!status.ok()) { OPENMS_LOG_ERROR << "ConsensusMapArrowExport: rt_builder Reserve failed: " << status.ToString() << '\n'; return nullptr; } | |
| status = quality_builder.Reserve(num_features); | |
| if (!status.ok()) { OPENMS_LOG_ERROR << "ConsensusMapArrowExport: quality_builder Reserve failed: " << status.ToString() << '\n'; return nullptr; } | |
| status = rt_start_builder.Reserve(num_features); | |
| if (!status.ok()) { OPENMS_LOG_ERROR << "ConsensusMapArrowExport: rt_start_builder Reserve failed: " << status.ToString() << '\n'; return nullptr; } | |
| status = rt_stop_builder.Reserve(num_features); | |
| if (!status.ok()) { OPENMS_LOG_ERROR << "ConsensusMapArrowExport: rt_stop_builder Reserve failed: " << status.ToString() << '\n'; return nullptr; } | |
| status = ion_mobility_builder.Reserve(num_features); | |
| if (!status.ok()) { OPENMS_LOG_ERROR << "ConsensusMapArrowExport: ion_mobility_builder Reserve failed: " << status.ToString() << '\n'; return nullptr; } | |
| status = predicted_rt_builder.Reserve(num_features); | |
| if (!status.ok()) { OPENMS_LOG_ERROR << "ConsensusMapArrowExport: predicted_rt_builder Reserve failed: " << status.ToString() << '\n'; return nullptr; } | |
| status = start_ion_mobility_builder.Reserve(num_features); | |
| if (!status.ok()) { OPENMS_LOG_ERROR << "ConsensusMapArrowExport: start_ion_mobility_builder Reserve failed: " << status.ToString() << '\n'; return nullptr; } | |
| status = stop_ion_mobility_builder.Reserve(num_features); | |
| if (!status.ok()) { OPENMS_LOG_ERROR << "ConsensusMapArrowExport: stop_ion_mobility_builder Reserve failed: " << status.ToString() << '\n'; return nullptr; } | |
| status = pep_builder.Reserve(num_features); | |
| if (!status.ok()) { OPENMS_LOG_ERROR << "ConsensusMapArrowExport: pep_builder Reserve failed: " << status.ToString() << '\n'; return nullptr; } | |
| status = score_builder.Reserve(num_features); | |
| if (!status.ok()) { OPENMS_LOG_ERROR << "ConsensusMapArrowExport: score_builder Reserve failed: " << status.ToString() << '\n'; return nullptr; } | |
| status = pg_qvalue_builder.Reserve(num_features); | |
| if (!status.ok()) { OPENMS_LOG_ERROR << "ConsensusMapArrowExport: pg_qvalue_builder Reserve failed: " << status.ToString() << '\n'; return nullptr; } |
🤖 Prompt for AI Agents
In `@src/openms/source/FORMAT/ConsensusMapArrowExport.cpp` around lines 148 - 203,
The error logging in the Reserve failure blocks (e.g., sequence_builder.Reserve,
peptidoform_builder.Reserve, anchor_protein_builder.Reserve,
reference_file_builder.Reserve, scan_builder.Reserve,
score_type_builder.Reserve, spectrum_reference_builder.Reserve,
scan_ref_file_builder.Reserve, cv_params_builder.Reserve,
additional_intensities_builder.Reserve, precursor_charge_builder.Reserve,
is_decoy_builder.Reserve, unique_builder.Reserve, calculated_mz_builder.Reserve,
observed_mz_builder.Reserve, rt_builder.Reserve, quality_builder.Reserve,
rt_start_builder.Reserve, rt_stop_builder.Reserve, ion_mobility_builder.Reserve,
predicted_rt_builder.Reserve, start_ion_mobility_builder.Reserve,
stop_ion_mobility_builder.Reserve, pep_builder.Reserve, score_builder.Reserve,
pg_qvalue_builder.Reserve) uses std::endl which forces flushes; change each
OPENMS_LOG_ERROR << "... Reserve failed: " << status.ToString() << std::endl to
use '\n' instead (e.g., << '\n') so the logger can manage flushing and avoid
hot-path flush overhead.
getKeys() returns strings (autowrap converts libcpp_vector[String]), but exclusion sets used bytes literals causing membership checks to always pass. Changed exclusion sets to string literals and removed unnecessary .decode() calls. Co-Authored-By: Claude Opus 4.5 <[email protected]>
There was a problem hiding this comment.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/pyOpenMS/addons/PeptideIdentificationList.pyx (1)
132-164:⚠️ Potential issue | 🟡 MinorBreaking change:
decode_ontologyparameter removed fromdf_columns().The signature changed from
df_columns(self, decode_ontology: bool = True)todf_columns(self). Users callingdf_columns(decode_ontology=...)will get aTypeError. If this is intentional, consider adding a deprecation path or documenting the change.
getKeys() may return bytes in some edge cases despite being typed as returning strings. Add defensive decoding to handle both cases for: - Exclusion set membership checks - Score type lookups - Metavalue name storage in output dicts Co-Authored-By: Claude Opus 4.5 <[email protected]>
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@src/pyOpenMS/addons/PeptideIdentificationList.pyx`:
- Around line 123-130: to_df() now delegates to to_arrow(), which requires
pyarrow, so update to_df() to either document the pyarrow dependency in its
docstring or catch the ImportError at the method boundary and raise a clear
message; specifically, wrap the call to self.to_arrow(...) in a try/except
ImportError (or inspect the exception raised by to_arrow()) and raise a new
ImportError that tells users pyarrow is required for to_df() and how to install
it (e.g., "pip install pyopenms[dataframes]" or "pip install pyarrow"), or
alternatively add a sentence to the to_df() docstring stating that pyarrow is
required when converting via to_arrow().
- Update docstring to document pyarrow requirement - Wrap to_arrow() call with try/except ImportError - Provide helpful installation instructions in error message Co-Authored-By: Claude Opus 4.5 <[email protected]>
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@src/pyOpenMS/addons/PeptideIdentificationList.pyx`:
- Around line 158-170: The schema hint for metavalues in the return list of
df_columns() (in PeptideIdentificationList.pyx) is incorrect: update the inline
comment for "metavalues" to reflect the actual emitted key name by changing
{"name": str, "value": str, "type": str} to {"name": str, "value": str,
"value_type": str} so the df_columns() documentation matches the real field
name.
The new name follows the pattern of ConsensusMapArrowExport, making the purpose of each export class clear from its name. Co-Authored-By: Claude Opus 4.5 <[email protected]>
Update ConsensusMapArrowExport.h to include the renamed MSExperimentArrowExport.h Co-Authored-By: Claude Opus 4.5 <[email protected]>
There was a problem hiding this comment.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
src/openms/include/OpenMS/FORMAT/MSExperimentArrowExport.h (1)
307-324:⚠️ Potential issue | 🟡 MinorUpdate the example snippet to use MSExperimentArrowExport.
The example still referencesArrowExport(e.g., Line 313 and Line 323), which was renamed and may confuse users.📝 Suggested doc fix
- ArrowExport::exportSpectraToParquet(exp, "spectra.parquet"); + MSExperimentArrowExport::exportSpectraToParquet(exp, "spectra.parquet"); ... - ArrowExport::exportSpectraToParquet(exp, "ms2_spectra.parquet", config, pq_config); + MSExperimentArrowExport::exportSpectraToParquet(exp, "ms2_spectra.parquet", config, pq_config);src/pyOpenMS/addons/MSExperiment.pyx (1)
638-647:⚠️ Potential issue | 🟡 MinorAlign Python fallback RT sentinels with C++ “no filter” semantics.
Line 640 defaultsmin_rtto0.0, which will drop negative RTs in the Python fallback while the C++ path treats(0, 0)as “no filter.” This can create inconsistent results between zerocopy and fallback modes. Consider using-inf(or conditional checks) to preserve parity.🛠️ Suggested fix
- # Use sentinel values: min -> 0.0, max -> inf (consistent with C++ MSExperimentArrowExport) + # Use sentinel values: min -> -inf, max -> inf (mirrors C++ "no filter" semantics) - if min_rt is None: - min_rt = 0.0 + if min_rt is None: + min_rt = float('-inf')
The test includes arrow/api.h and needs Arrow libraries linked. Co-Authored-By: Claude Opus 4.5 <[email protected]>
The comment said "type" but the actual field name is "value_type". Co-Authored-By: Claude Opus 4.5 <[email protected]>
Summary
Add feature-level export following the QPX (Quantitative Proteomics Exchange) schema to
ConsensusMap, with integration intoProteomicsLFQandIsobaricWorkflowTOPP tools.Changes
Python (ConsensusMap.pyx)
to_feature_arrow(): Core Arrow Table export with full QPX feature schema (33 columns)to_feature_df(): Thin pandas wrapperto_feature_parquet(): Direct Parquet export with compression optionsto_qpx(): QPX dict format with file_metadata and features arrayfeature_columns(): Column name discoveryC++ (ConsensusMapArrowExport)
exportToArrow(): Arrow Table construction with column buildersexportToParquet(): Parquet file writing with configurable compression#ifdef WITH_PARQUETTOPP Tools
ProteomicsLFQ: Added-out_parquetoption for feature-level exportIsobaricWorkflow: Added-out_parquetoption for feature-level exportOther
PeptideIdentificationList.pyx: Updated peptidoform to use ProForma canonical notationQPX Schema Columns
Core:
sequence,peptidoform,modifications,precursor_charge,calculated_mz,observed_mz,rtScores:
posterior_error_probability,is_decoy,additional_scoresQuantification:
intensities,additional_intensitiesProtein:
pg_accessions,anchor_protein,unique,pg_global_qvalue,gg_accessions,gg_namesOpenMS-specific:
quality,score,score_type,spectrum_reference,feature_metavaluesTest Plan
🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Python
Workflows
Refactor
Tests