Skip to content

[TEST] Add OpenSwathMatrixExporter_test (precursor-level quant matrix build/write) - #9564

Merged
timosachsenberg merged 2 commits into
OpenMS:developfrom
timosachsenberg:test/openswath-matrix-exporter
Jul 8, 2026
Merged

timosachsenberg merged 2 commits into
OpenMS:developfrom
timosachsenberg:test/openswath-matrix-exporter

Conversation

@timosachsenberg

@timosachsenberg timosachsenberg commented Jun 15, 2026 •

Copy link
Copy Markdown
Contributor

Context

Part of the OpenMS 3.6.0 pre-release testing plan (#9460), §4 (OpenSwathWorkflow / quantification).

OpenSwathMatrixExporter — new with the 3.6 OpenSWATH parquet/matrix output — builds and writes PyProphet-style quantification matrices, but had no test file.

Change

Adds a class test covering both public methods:

  • buildMatrix at Precursor level: the best peak group per (run, precursor) is selected by lowest m_score (not highest intensity), intensities are pivoted across runs ordered by run_id, identifier rows are the precursor key ordered lexicographically, and a precursor absent from a run yields an empty cell.
  • buildMatrix preconditions: empty input throws Precondition, and a peptide/protein/gene level with top_n == 0 throws.
  • writeMatrix: the TSV output has the identifier columns followed by the sample columns in the header, and the precursor key plus per-run intensities in the data row; an empty matrix is rejected.

Notes

  • New test registered in executables.cmake (swath_executables_list, under NOT DISABLE_OPENSWATH).
  • Tests only — no production code changes.
  • The selection/pivot/TSV behavior was read from the implementation before pinning (best-peak-group is selectBestPeakGroups_ by m_score).
  • Builds and passes locally; every public method has a section (no untested-method warnings); all assertions execute against real values (verbose-confirmed).

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Tests
    • Added unit tests for OpenSwathMatrixExporter, including precursor-level matrix construction, peak group selection logic, output format validation, and error handling.

… build/write)

OpenSwathMatrixExporter (new in the 3.6 OpenSWATH parquet/matrix output) builds
and writes PyProphet-style quantification matrices, but had no test.

Adds a class test covering:
- buildMatrix at Precursor level: the best peak group per (run, precursor) is
  selected by lowest m_score (not highest intensity), intensities are pivoted
  across runs ordered by run_id, identifier rows are the precursor key ordered
  lexicographically, and a precursor absent from a run yields an empty cell;
- buildMatrix preconditions: empty input throws Precondition, and a
  peptide/protein/gene level with top_n == 0 throws;
- writeMatrix: the TSV output has the identifier columns followed by the sample
  columns in the header and the precursor key plus per-run intensities in the
  data row, and an empty matrix is rejected.

Registered in executables.cmake (swath_executables_list, under
NOT DISABLE_OPENSWATH). Part of the OpenMS 3.6.0 pre-release testing plan
(OpenMS#9460). Tests only; no production code changes.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@coderabbitai

coderabbitai Bot commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 9d5e68f6-5568-42ed-b5ae-f86911967148

📥 Commits

Reviewing files that changed from the base of the PR and between aacd941 and 94a3433.

📒 Files selected for processing (2)
  • src/tests/class_tests/openms/executables.cmake
  • src/tests/class_tests/openms/source/OpenSwathMatrixExporter_test.cpp

📝 Walkthrough

Walkthrough

A new C++ unit test file for OpenSwathMatrixExporter is added, covering buildMatrix (identifier/sample ordering, best-peak-group selection, empty-cell handling, and precondition exceptions) and writeMatrix (TSV output format and empty-matrix precondition). The test executable is registered in executables.cmake under the NOT DISABLE_OPENSWATH block.

Changes

OpenSwathMatrixExporter Test Suite

Layer / File(s) Summary
Test helper, buildMatrix, writeMatrix, and CMake registration
src/tests/class_tests/openms/source/OpenSwathMatrixExporter_test.cpp, src/tests/class_tests/openms/executables.cmake
mkRow helper constructs OpenSwathExportRow objects for tests. buildMatrix tests verify precursor-level identifier/sample column ordering, best-peak-group selection (lowest m_score wins), empty cells for absent transition groups, and Exception::Precondition for empty input or top_n = 0. writeMatrix tests check TSV header/data column counts, specific identifier and intensity values, and Exception::Precondition for writing an empty matrix. OpenSwathMatrixExporter_test is appended to swath_executables_list in CMake.

Possibly related PRs

  • OpenMS/OpenMS#9377: Introduces the OpenSwathMatrixExporter implementation with buildMatrix and writeMatrix methods that this PR's tests directly exercise.

🐇 A new test hops in with a matrix to check,
buildMatrix rows sorted, best scores at the deck,
Empty cells left where no run was found,
TSV columns echo a neat, tested sound,
The rabbit stamps "approved" — the exports are sound! ✅

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The pull request title clearly and specifically describes the main change: adding a test for OpenSwathMatrixExporter covering precursor-level quantification matrix building and writing functionality.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions

Copy link
Copy Markdown
Contributor

@timosachsenberg The following names might be missing from the AUTHORS file:

  • Timo Sachsenberg

Please consider applying the following patch:

--- AUTHORS	2026-06-16 00:55:24.846036680 +0000
+++ AUTHORS.new	2026-06-16 00:55:30.100337392 +0000
@@ -23,8 +23,8 @@
  - Chirag Dave
  - Chris Bauer
  - Chris Bielow
- - Christie Mathews
  - Christian Ehrlich
+ - Christie Mathews
  - Clemens Groepl
  - Cornelia Friedle
  - Daniel Jameson

Copy link
Copy Markdown
Contributor Author

Adversarial review result:

I did not find a blocking issue in this pass. This is a test-only addition for OpenSwathMatrixExporter; it checks best peak-group selection by score and output writing with temporary files. I did not find tracker references in source comments. I did not run the tests locally.

@timosachsenberg
timosachsenberg merged commit 02ce8dd into OpenMS:develop Jul 8, 2026
38 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant