Skip to content

fix: mark Bruker TDF spectra as CENTROID so downstream tools accept them - #9154

Merged
timosachsenberg merged 1 commit into
OpenMS:developfrom
jonasscheid:fix/bruker-ms2-centroid-cvparam
Apr 15, 2026
Merged

timosachsenberg merged 1 commit into
OpenMS:developfrom
jonasscheid:fix/bruker-ms2-centroid-cvparam

Conversation

@jonasscheid

@jonasscheid jonasscheid commented Apr 15, 2026 •

Copy link
Copy Markdown
Collaborator

@timosachsenberg does https://github.com/OpenMS/OpenMS/pull/9152/changes fixes this issue already?

Summary

  • BrukerTimsFile currently writes TDF spectra into MSExperiment without setting SpectrumSettings::SpectrumType, so spectra default to UNKNOWN. When the experiment is written to mzML, only the parent CV term MS:1000525 ("spectrum representation") is emitted and not the child MS:1000127 ("centroid spectrum") / MS:1000128 ("profile spectrum").
  • Downstream tools that strictly validate the CV term — notably CometAdapter — reject the mzML with Profile data provided but centroided MS2 spectra required and force users to add -force (which taints results).
  • TDF peak data is already detector-centroided in m/z (it is stored as a peak list, not a profile trace), so the correct label is CENTROID. This PR sets the type in the five spectrum-emission paths so the CV term lands correctly in the mzML.

Changes

  • src/openms/source/FORMAT/BrukerTimsFile.cpp: add spec.setType(SpectrumSettings::SpectrumType::CENTROID) in:
    • frameToSpectrum (raw MS1 / MS2 via loadFrames_)
    • streaming DIA MS2
    • DDA MS2
    • DIA MS2 aggregated/denoised
    • DIA MS2 raw per-WindowGroup
  • src/tests/class_tests/openms/source/BrukerTimsFile_test.cpp: add TEST_EQUAL(spec.getType(), CENTROID) in the DDA loading, DDA frame-level, and DIA loading integration tests, mirroring the existing MS1 CENTROID assertion in the DDA MS1 centroiding test.

Test plan

  • BrukerTimsFile_test — all 22 sections pass locally with ENABLE_OPENTIMS_TESTS=ON (exit 0).
  • End-to-end: the patched FileConverter run on a real timsTOF .d file produces mzML whose MS2 spectra now carry <cvParam accession=\"MS:1000127\" name=\"centroid spectrum\"/>. CometAdapter accepts it without -force.

Summary by CodeRabbit

Bug Fixes & Tests

  • Bug Fixes

    • Spectra from TDF/TIMS data now explicitly include correct spectrum type classification, improving data quality metadata for multiple spectrum construction pathways including frame conversion and DIA/DDA analysis modes.
  • Tests

    • Added comprehensive assertions to verify spectrum type metadata is correctly set across TDF MS2 spectra and frame-level data loading scenarios.

@github-actions

Copy link
Copy Markdown
Contributor

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

  • jonasscheid

Please consider applying the following patch:

--- AUTHORS	2026-04-15 13:56:54.232246981 +0000
+++ AUTHORS.new	2026-04-15 13:56:59.248090854 +0000
@@ -58,6 +58,7 @@
  - Johannes Veit
  - Johannes von Kleist
  - Johan Teleman
+ - jonasscheid
  - Joshua Charkow
  - Juliane Schmachtenberg
  - Julianus Pfeuffer

@coderabbitai

coderabbitai Bot commented Apr 15, 2026 •

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

Added explicit CENTROID type labeling to MSSpectrum objects generated from TDF/TIMS data across multiple construction paths in BrukerTimsFile, including frame conversion and DIA MS2 spectrum creation. Corresponding test assertions validate the spectrum type metadata.

Changes

Cohort / File(s) Summary
Spectrum Type Labeling
src/openms/source/FORMAT/BrukerTimsFile.cpp, src/tests/class_tests/openms/source/BrukerTimsFile_test.cpp
Added setType(CENTROID) calls to frameToSpectrum and DIA MS2 spectrum construction paths. Test assertions verify spectrum type is set to CENTROID in DDA/DIA loading and frame-level conversion tests.

Possibly related PRs

Suggested reviewers

  • jcharkow
  • singjc

Poem

🐰 Centroid, centroid, take the stage,
Type labels mark each spectrum's page,
From TIMS frames to DIA's call,
Metadata precision conquers all!
Hopping through peaks, so crisp and clear,
Your spectral truth is now sincere! ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 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 (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: marking Bruker TDF spectra as CENTROID type for downstream tool compatibility. It is concise, specific, and directly summarizes the primary objective of the changeset.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ 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.

@timosachsenberg

Copy link
Copy Markdown
Contributor

good catch! thanks

@timosachsenberg timosachsenberg 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.

I will need to check if all other paths (e.g. DIA) correctly annotate this

@jonasscheid

jonasscheid commented Apr 15, 2026 •

Copy link
Copy Markdown
Collaborator Author

Yes please, I only tested with DDA file

@timosachsenberg

Copy link
Copy Markdown
Contributor

looks good

@timosachsenberg
timosachsenberg merged commit 340d45f into OpenMS:develop Apr 15, 2026
14 checks passed
github-actions Bot pushed a commit that referenced this pull request Apr 16, 2026
Add three missing entries for changes merged after the 2026-04-15 sync:
- #9154: BrukerTimsFile spectra marked as CENTROID
- #9148/#9147: system opentims install fallback before FetchContent
- #9151: Bruker DIA MS2 centroiding without denoising (min_support=0)

Co-authored-by: Copilot <[email protected]>
timosachsenberg pushed a commit that referenced this pull request Apr 16, 2026
Add three missing entries for changes merged after the 2026-04-15 sync:
- #9154: BrukerTimsFile spectra marked as CENTROID
- #9148/#9147: system opentims install fallback before FetchContent
- #9151: Bruker DIA MS2 centroiding without denoising (min_support=0)

Co-authored-by: GitHub Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
@timosachsenberg timosachsenberg mentioned this pull request Apr 16, 2026
4 of 5 tasks
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