Skip to content

[pyOpenMS][TEST] Pin Bruker TDF frame=/MS:1002818 native ID parsing (#9460) - #9524

Merged
timosachsenberg merged 1 commit into
OpenMS:developfrom
timosachsenberg:test/9460-pyopenms-bruker-tdf-nativeid
Jun 16, 2026
Merged

timosachsenberg merged 1 commit into
OpenMS:developfrom
timosachsenberg:test/9460-pyopenms-bruker-tdf-nativeid

Conversation

@timosachsenberg

@timosachsenberg timosachsenberg commented Jun 15, 2026 •

Copy link
Copy Markdown
Contributor

What

Adds Bruker timsTOF .d (TDF) native-ID cases to the Python testSpectrumNativeIDParser.py, covering the frame=<F> scan=<S> format and its CV accession MS:1002818.

Why

This closes the Python half of a [AUTO] task in the OpenMS 3.6.0 pre-release testing plan (#9460, §6 — vendor readers):

Add SDK-free MS:1002818/frame= cases to both parser tests. Pass: isNativeID("frame=2 scan=529") is true; extractScanNumber(..., "MS:1002818") returns the scan.

The C++ SpectrumNativeIDParser_test.cpp already has an [EXTRA] Bruker TDF frame= / MS:1002818 native ID section (in develop), but the Python test stopped at scan=/MS:1000776 and never exercised the frame= path. The Bruker DDA/DIA-PASEF native-ID round-trip was therefore asserted only in the SDK-gated reader test — never on the SDK-free Python parser surface that runs on public CI.

What it asserts (mirrors the C++ section)

  • isNativeID() recognizes the frame= prefix (incl. a trailing precursor= token).
  • getRegExFromNativeID() targets the scan=<int> token for frame= IDs.
  • extractScanNumber(..., "MS:1002818") returns the scan= integer, including the trailing-precursor= and merged multi-scan= (last-wins) cases.

Test plan

Tests only — no production code changed. Verified against the built nanobind bindings:

$ python3 src/pyOpenMS/tests/unittests/testSpectrumNativeIDParser.py
All SpectrumNativeIDParser tests passed!

Part of #9460.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Tests
    • Expanded test coverage for native spectrum ID parsing to ensure proper handling of various ID formats and scan number extraction.

…penMS#9460)

The C++ SpectrumNativeIDParser_test already has an "[EXTRA] Bruker TDF
frame= / MS:1002818" section, but the Python testSpectrumNativeIDParser.py
stopped at scan=/MS:1000776 and never exercised the frame= path. This closes
the Python half of the §6 [AUTO] task in the 3.6.0 pre-release testing plan
(issue OpenMS#9460): add SDK-free MS:1002818/frame= cases to *both* parser tests.

Asserts, mirroring the C++ section:
- isNativeID() recognizes the "frame=" prefix
- getRegExFromNativeID() targets the scan=<int> token for frame= IDs
- extractScanNumber(..., "MS:1002818") returns the scan= integer, including
  the trailing-precursor= and merged multi-scan= cases

Verified against the built nanobind bindings.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@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-15 14:40:56.247446243 +0000
+++ AUTHORS.new	2026-06-15 14:41:01.430857522 +0000
@@ -23,8 +23,8 @@
  - Chirag Dave
  - Chris Bauer
  - Chris Bielow
- - Christie Mathews
  - Christian Ehrlich
+ - Christie Mathews
  - Clemens Groepl
  - Cornelia Friedle
  - Daniel Jameson

@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: 5c25e7e8-f8e5-4372-88e2-aa0045568860

📥 Commits

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

📒 Files selected for processing (1)
  • src/pyOpenMS/tests/unittests/testSpectrumNativeIDParser.py

📝 Walkthrough

Walkthrough

Adds 22 lines of test assertions to testSpectrumNativeIDParser covering the Bruker timsTOF TDF frame=<F> scan=<S> native ID format under accession MS:1002818. The new assertions validate isNativeID recognition, getRegExFromNativeID output, extractScanNumber for single spectra, and last-scan-wins behavior for merged spectra.

Changes

Bruker TDF Native ID Test Coverage

Layer / File(s) Summary
MS:1002818 frame=/scan= test assertions
src/pyOpenMS/tests/unittests/testSpectrumNativeIDParser.py
Adds assertions that frame= strings are recognized by isNativeID, that getRegExFromNativeID returns the scan=<int> regex for MS:1002818, that extractScanNumber returns the scan value for a single spectrum, and that the last scan= token is returned when multiple are present in a merged-spectrum string.

Possibly related PRs

  • OpenMS/OpenMS#8637: Introduced the SpectrumNativeIDParser class whose isNativeID, getRegExFromNativeID, and extractScanNumber methods are directly exercised by the new test assertions.
  • OpenMS/OpenMS#9160: Contains implementation changes to SpectrumNativeIDParser for frame=/scan= parsing under MS:1002818, the exact behavior validated by the new tests.
  • OpenMS/OpenMS#9500: Also extends SpectrumNativeIDParser unit tests for Bruker TDF native IDs, targeting the same isNativeID, getRegExFromNativeID, and extractScanNumber paths including merged strings.

Poem

🐇 Hop, hop through frames and scans,
The TDF IDs fit our plans!
frame=1 scan=42 — what a find,
Last scan wins for merged in kind.
With each assertion, bugs are banned ~
✨ pyOpenMS tests expand! ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically references the main change: adding test coverage for Bruker TDF native ID parsing with frame=/MS:1002818, which matches the PR's core objective.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
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.

This was referenced Jun 15, 2026
@timosachsenberg
timosachsenberg merged commit fb533fb into OpenMS:develop Jun 16, 2026
41 checks passed
@timosachsenberg timosachsenberg mentioned this pull request Jun 16, 2026
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