Skip to content

Add round-trip test for QPX/Parquet peptidoform modification preservation - #9500

Merged
timosachsenberg merged 6 commits into
developfrom
claude/festive-ride-w7oh46
Jun 14, 2026
Merged

timosachsenberg merged 6 commits into
developfrom
claude/festive-ride-w7oh46

Conversation

@timosachsenberg

@timosachsenberg timosachsenberg commented Jun 12, 2026 •

Copy link
Copy Markdown
Contributor

Description

This PR adds a unit test to verify that the ProForma serialization chain used by QPXFile and FeatureMapArrowIO correctly preserves peptide modifications during write-read cycles.

The test pins the exact serialization chain:

  • Write: ProForma::toString(ProForma::fromAASequence(seq), WriteMode::CANONICAL)
  • Read: ProForma::toAASequence(ProForma::parse(str), ConversionPolicy::BEST_EFFORT)

This ensures that silent modification drops or mangles in the Parquet/QPX lane (which feeds new quantification outputs) are caught at the unit test level rather than only in end-to-end data validation.

The test covers:

  • Unmodified peptide backbones
  • Variable modifications (Oxidation)
  • Phosphorylation
  • Fixed modifications (Carbamidomethyl)

It validates that:

  1. The unmodified sequence backbone is preserved
  2. Sequence length is unchanged
  3. Every modified residue remains modified at the same position

Checklist

  • Make sure that you are listed in the AUTHORS file
  • Add relevant changes and new features to the CHANGELOG file (N/A - test-only change)
  • I have commented my code, particularly in hard-to-understand areas
  • New and existing unit tests pass locally with my changes
  • Updated or added python bindings for changed or new classes (N/A - test-only change)

https://claude.ai/code/session_018EZ5DVWpC74wbXSo9utFBC

Summary by CodeRabbit

  • Tests
    • Added a unit test verifying QPX/Parquet-style peptidoform round-trip preserves backbone string, sequence length, monoisotopic mass, and modification positions when applicable.
    • Added a unit test for Bruker TDF native ID parsing, including detection of frame/scan formats, correct scan extraction (including precursor-extended forms), and handling merged native ID strings by using the last scan.
    • Added a unit test ensuring export fails on duplicate protein run identifiers with an appropriate error.

Add a ProFormaParser_test [EXTRA] section asserting that the exact
write/read chain QPXFile and FeatureMapArrowIO use for the peptidoform
column --
  write: ProForma::toString(fromAASequence(seq), WriteMode::CANONICAL)
  read:  ProForma::toAASequence(parse(str), ConversionPolicy::BEST_EFFORT)
-- preserves modifications across a round-trip for common UNIMOD mods
(Oxidation, Phospho, Carbamidomethyl) plus an unmodified backbone.

Mirrors the existing round-trip sections: it asserts backbone, length,
and per-position isModified() rather than exact toString (notation may
normalize), so a silently dropped modification in the Parquet/QPX lane
-- which feeds the new quant outputs -- fails at the unit level.

Implements the "ProForma fidelity through the Parquet/QPX lane" item
from the OpenMS 3.6 release-testing plan (#9460).

https://claude.ai/code/session_018EZ5DVWpC74wbXSo9utFBC
@github-actions

Copy link
Copy Markdown
Contributor

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

  • Claude

Please consider applying the following patch:

--- AUTHORS	2026-06-12 14:20:25.153486946 +0000
+++ AUTHORS.new	2026-06-12 14:20:30.457643292 +0000
@@ -22,8 +22,9 @@
  - Chirag Dave
  - Chris Bauer
  - Chris Bielow
- - Christie Mathews
  - Christian Ehrlich
+ - Christie Mathews
+ - Claude
  - Clemens Groepl
  - Cornelia Friedle
  - Daniel Jameson

@coderabbitai

coderabbitai Bot commented Jun 12, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

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: 18975d23-2623-4052-a111-b989d39e8f67

📥 Commits

Reviewing files that changed from the base of the PR and between e2f1e8d and 00a3b0f.

📒 Files selected for processing (1)
  • src/tests/class_tests/openms/source/ProFormaParser_test.cpp
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/tests/class_tests/openms/source/ProFormaParser_test.cpp

📝 Walkthrough

Walkthrough

Adds three unit-test sections: a ProForma canonical round-trip test checking backbone, length, and per-residue modification preservation; a Bruker TDF native ID test validating regex extraction and scan-number parsing; and a PSMArrowIO test asserting exportToParquet rejects duplicate ProteinIdentification run identifiers.

Changes

Parser unit tests

Layer / File(s) Summary
ProForma QPX/Parquet round-trip test
src/tests/class_tests/openms/source/ProFormaParser_test.cpp
New [EXTRA] test serializes AASequence inputs to canonical ProForma, parses them back with ConversionPolicy::BEST_EFFORT, and asserts backbone identity, sequence length stability, and per-residue isModified() preservation when lengths match.
Bruker TDF native ID parsing tests
src/tests/class_tests/openms/source/SpectrumNativeIDParser_test.cpp
New [EXTRA] test for accession MS:1002818 checks isNativeID for frame= tokens, getRegExFromNativeID extraction of scan, extractScanNumber behavior for simple and precursor-extended IDs, and last-token selection in merged PASEF strings.
PSMArrowIO duplicate ProteinIdentification id rejection
src/tests/class_tests/openms/source/PSMArrowIO_test.cpp
New test asserts PSMArrowIO::exportToParquet throws Exception::InvalidValue when two ProteinIdentification objects share the same run identifier.

Possibly related PRs

  • OpenMS/OpenMS#8637: Introduced Bruker TDF native-ID tests and SpectrumNativeIDParser native-ID parsing API.

Poem

🐰 I hopped through tests both neat and spry,
Round-trippin' sequences by and by,
Frames that hide a scan or two,
I sniff the regex, fetch the true,
Duplicate runs—rejected true.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.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 title accurately summarizes the main change: adding a round-trip test for QPX/Parquet peptidoform modification preservation, which is the primary focus of the PR.
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 docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/festive-ride-w7oh46

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.

claude added 2 commits June 12, 2026 14:28
The method-level sections only exercised scan=/MS:1000776; the parser
supports the Bruker timsTOF .d (TDF) native-ID format "frame=<F> scan=<S>"
(with optional trailing precursor=/windowGroup=/merged= tokens emitted by
the DDA/DIA-PASEF reader) but no test pinned it. Add an [EXTRA] section
asserting isNativeID() recognizes the frame= prefix, getRegExFromNativeID()
targets the scan= token, and extractScanNumber(..., "MS:1002818") returns
the scan= integer (last scan= for merged PASEF spectra).

Implements the §6 "SpectrumNativeIDParser MS:1002818/frame=" item from the
OpenMS 3.6 release-testing plan (#9460).

https://claude.ai/code/session_018EZ5DVWpC74wbXSo9utFBC
FeatureMapArrowIO_test and ConsensusMapArrowIO_test assert that
exportToParquet throws Exception::InvalidValue on duplicate
ProteinIdentification run identifiers (#9400 Fix #2b), but the PSM lane
guard (PSMArrowIO.cpp) was not directly unit-tested. Add an [EXTRA]
section mirroring the sibling tests: a second ProteinIdentification
colliding on the same run identifier must be rejected before any
parquet is written.

Implements the §3 PSM-lane duplicate-id item from the OpenMS 3.6
release-testing plan (#9460).

https://claude.ai/code/session_018EZ5DVWpC74wbXSo9utFBC

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
src/tests/class_tests/openms/source/PSMArrowIO_test.cpp (1)

283-304: ⚡ Quick win

Add cleanup code for test hygiene.

The test correctly validates that duplicate ProteinIdentification identifiers trigger Exception::InvalidValue. However, all other test sections in this file include cleanup code (see lines 114, 136, 154, 177, 222, 279). If the test fails unexpectedly (no exception thrown), exportToParquet would create the directory, leaving test artifacts.

🧹 Add conditional cleanup after TEST_EXCEPTION
 TEST_EXCEPTION(Exception::InvalidValue,
                PSMArrowIO::exportToParquet(prot_ids, pep_ids, dir))
+
+if (File::exists(dir))
+{
+  File::removeDirRecursively(dir);
+}
🤖 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/PSMArrowIO_test.cpp` around lines 283 -
304, Add conditional cleanup to remove the created .idparquet artifact if the
test does not throw: after the
TEST_EXCEPTION(TEST_EXCEPTION(Exception::InvalidValue,
PSMArrowIO::exportToParquet(prot_ids, pep_ids, dir))) block, check whether the
path in dir exists and delete it (use the project file utility used elsewhere in
this file, e.g. File::removeDir or File::removeDirRecursively / File::remove
depending on available API) so the temporary directory is removed when the test
fails to throw; reference variables/functions: dir, PSMArrowIO::exportToParquet,
TEST_EXCEPTION.
🤖 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.

Nitpick comments:
In `@src/tests/class_tests/openms/source/PSMArrowIO_test.cpp`:
- Around line 283-304: Add conditional cleanup to remove the created .idparquet
artifact if the test does not throw: after the
TEST_EXCEPTION(TEST_EXCEPTION(Exception::InvalidValue,
PSMArrowIO::exportToParquet(prot_ids, pep_ids, dir))) block, check whether the
path in dir exists and delete it (use the project file utility used elsewhere in
this file, e.g. File::removeDir or File::removeDirRecursively / File::remove
depending on available API) so the temporary directory is removed when the test
fails to throw; reference variables/functions: dir, PSMArrowIO::exportToParquet,
TEST_EXCEPTION.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: f5554364-96fa-4ea5-9911-a8f410633dac

📥 Commits

Reviewing files that changed from the base of the PR and between c7d52af and ee8666d.

📒 Files selected for processing (1)
  • src/tests/class_tests/openms/source/PSMArrowIO_test.cpp

claude added 2 commits June 12, 2026 15:07
Addresses a CodeRabbit review nitpick: the new duplicate-identifier
section was the only one not removing its NEW_TMP_FILE directory. Add the
same conditional File::removeDirRecursively cleanup the other sections
use, so a regression that let the export run (instead of throwing) does
not leave an .idparquet artifact behind.

https://claude.ai/code/session_018EZ5DVWpC74wbXSo9utFBC
Per review of #9500: the per-position isModified() check confirms a
modification is still present but not its identity/mass. Add a
TEST_REAL_SIMILAR on AASequence::getMonoWeight() so a modification
silently changed to a different mass (not just dropped) also fails the
round-trip test, without depending on canonical-notation equality.

https://claude.ai/code/session_018EZ5DVWpC74wbXSo9utFBC
@timosachsenberg
timosachsenberg merged commit 00d70cc into develop Jun 14, 2026
40 of 41 checks passed
@timosachsenberg
timosachsenberg deleted the claude/festive-ride-w7oh46 branch June 14, 2026 19:43
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.

2 participants