Repository navigation
Add unit tests for OpenSwathParquetExporter - #9681
Conversation
…rquet export) OpenSwathParquetExporter - the 3.6 native-Parquet exporter for OpenSWATH feature- and transition-level score tables - had no test. Adds a class test for both write methods that builds a small score table, writes it to a Parquet file, reads it back via ParquetFile, and verifies the round-tripped key columns: - writeFeatureScores: FEATURE_ID, PROTEIN_ACCESSION, MODIFIED_SEQUENCE, PRECURSOR_MZ and EXP_RT survive the round-trip for two rows; - writeTransitionScores: TRANSITION_ID, PRODUCT_MZ, ANNOTATION and the per-row TRANSITION_DECOY flag survive, and an empty table is accepted and produces a valid 0-row (schema-only) file. Registered in executables.cmake (swath_executables_list, under NOT DISABLE_OPENSWATH). Part of the OpenMS 3.6.0 pre-release testing plan (#9460). Tests only; no production code changes. Co-Authored-By: Claude Opus 4.8 <[email protected]>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughA new ChangesOpenSwathParquetExporter Test
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 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: 2
🧹 Nitpick comments (1)
src/tests/class_tests/openms/source/OpenSwathParquetExporter_test.cpp (1)
27-63: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winCover the empty
writeFeatureScorespath too.The API contract allows schema-only output for empty feature tables as well, but this suite only exercises that behavior through
writeTransitionScores. Since the two writers build separate Arrow schemas, a feature-side empty-table regression would still pass here.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/tests/class_tests/openms/source/OpenSwathParquetExporter_test.cpp` around lines 27 - 63, The OpenSwathParquetExporter::writeFeatureScores test only covers populated rows, so it misses the schema-only empty-table path. Extend the existing OpenSwathParquetExporter_test coverage to call writeFeatureScores with an empty OpenSwathFeatureScoreTable and verify the resulting parquet/table can still be read and has the expected schema or zero rows, similar to the writeTransitionScores empty-case. Use the existing writeFeatureScores helper and OpenSwathFeatureScoreTable to locate the right test block.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/tests/class_tests/openms/source/OpenSwathParquetExporter_test.cpp`:
- Around line 50-52: The OpenSwathParquetExporter_test.cpp round-trip checks
continue using tbl after a failed ParquetFile::readTable result, which can lead
to invalid dereferences. In each test block that uses ParquetFile::readTable and
then TEST_NOT_EQUAL(tbl, nullptr), add an ABORT_IF(tbl == nullptr) immediately
after the null check before any num_rows() or column access. Apply this in both
round-trip sections so the test stops as soon as the read fails.
- Around line 44-47: The temp-file setup in the OpenSwathParquetExporter test
should use the extension-aware helper instead of manually appending the suffix,
because `NEW_TMP_FILE` and `fn += ".parquet"` leave the tracked cleanup path out
of sync with the actual written file. Update the
`OpenSwathParquetExporter::writeFeatureScores` test call site to use
`NEW_TMP_FILE_EXT(..., ".parquet")` so the generated path and cleanup remain
aligned with the other parquet temp-file usages.
---
Nitpick comments:
In `@src/tests/class_tests/openms/source/OpenSwathParquetExporter_test.cpp`:
- Around line 27-63: The OpenSwathParquetExporter::writeFeatureScores test only
covers populated rows, so it misses the schema-only empty-table path. Extend the
existing OpenSwathParquetExporter_test coverage to call writeFeatureScores with
an empty OpenSwathFeatureScoreTable and verify the resulting parquet/table can
still be read and has the expected schema or zero rows, similar to the
writeTransitionScores empty-case. Use the existing writeFeatureScores helper and
OpenSwathFeatureScoreTable to locate the right test block.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 52c37cbe-e07e-4b69-9291-b4036bbd1c43
📒 Files selected for processing (3)
src/tests/class_tests/openms/CMakeLists.txtsrc/tests/class_tests/openms/executables.cmakesrc/tests/class_tests/openms/source/OpenSwathParquetExporter_test.cpp
- use NEW_TMP_FILE_EXT(..., ".parquet") so the tracked cleanup path matches the written file at all call sites - ABORT_IF(tbl == nullptr) after each readTable null-check to stop the section before dereferencing on a failed read - cover the empty-table (schema-only, 0-row) path for writeFeatureScores, mirroring the existing writeTransitionScores empty case Co-Authored-By: Claude Opus 4.8 <[email protected]> Claude-Session: https://claude.ai/code/session_01L9EmQ8VLeYSbFGoeEDAevH
Description
This PR adds comprehensive unit tests for the
OpenSwathParquetExporterclass, which handles exporting OpenSWATH feature and transition score data to Parquet format.The test suite covers:
OpenSwathFeatureScoreTabledata to Parquet, verifying that key columns (FEATURE_ID, PROTEIN_ACCESSION, MODIFIED_SEQUENCE, PRECURSOR_MZ, EXP_RT, etc.) are correctly serialized and deserialized.OpenSwathTransitionScoreTabledata to Parquet, including validation of transition identifiers, product m/z values, annotations, and boolean flags (TRANSITION_DECOY).The tests use the existing
ParquetFileutility API to verify data integrity after round-tripping through the Parquet format.Checklist
https://claude.ai/code/session_01L9EmQ8VLeYSbFGoeEDAevH
Summary by CodeRabbit