Skip to content

[FIX,IO] BrukerTimsFile: compute m/z from the MzCalibration table - #10469

Merged
jpfeuffer merged 1 commit into
developfrom
claude/rusttims-mzpeak-mzdata-research-82ft7k
Oct 9, 2026
Merged

jpfeuffer merged 1 commit into
developfrom
claude/rusttims-mzpeak-mzdata-research-82ft7k

Conversation

@timosachsenberg

@timosachsenberg timosachsenberg commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #10468

Without the Bruker SDK, m/z came from opentims' OpenSourceTof2MzConverter,
which is linear in sqrt(m/z) over MzAcqRangeLower/Upper and ignores the
calibration stored in analysis.tdf.

Add MzCalibrationTof2MzConverter, which applies the MzCalibration table
with the per-frame temperature correction (Frames.T1/T2), following the
formula used by rustims (rustdf/src/data/calibration.rs, MIT):
ModelType 1 is complete; for ModelType 2 the C3/C4 columns are ignored
and the additional C5..C14 correction is not modelled.

Summary by CodeRabbit

  • New Features

    • Bruker TIMS data can use calibration-table m/z values with per-frame temperature correction, improving agreement with the vendor SDK for supported calibration models.
    • DDA MS2 spectra now use the correct frame ID for TOF-to-m/z conversion, including during centroiding.
  • Compatibility

    • The LINEAR calibration strategy retains its previous conversion behavior. OLS recalibration applies only to this strategy; unsupported or unavailable calibration tables fall back to a linear approximation.

Without the Bruker SDK, m/z came from opentims' OpenSourceTof2MzConverter,
which is linear in sqrt(m/z) over MzAcqRangeLower/Upper and ignores the
calibration stored in analysis.tdf.

Add MzCalibrationTof2MzConverter, which applies the MzCalibration table
with the per-frame temperature correction (Frames.T1/T2), following the
formula used by rustims (rustdf/src/data/calibration.rs, MIT):
ModelType 1 is complete; for ModelType 2 the C3/C4 columns are ignored
and the additional C5..C14 correction is not modelled.

- openTimsDataHandle() uses it for every strategy except LINEAR and falls
  back to the linear converter with a warning if the table is unusable.
- OLS recalibration (calibrate=true) only runs on the linear converter.
- DDA MS2 converts merged TOF values with a real frame id instead of 0
  (same change as in #10460).
- Unit tests with Bruker SDK reference values and a synthetic
  analysis.tdf for the factory.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01ALQq7vda2rp8XfU8Lj53e3
@jpfeuffer
jpfeuffer merged commit fa11d55 into develop Oct 9, 2026
33 checks passed
@jpfeuffer
jpfeuffer deleted the claude/rusttims-mzpeak-mzdata-research-82ft7k branch October 9, 2026 06:30
jpfeuffer added a commit to jpfeuffer/OpenMS that referenced this pull request Oct 9, 2026
On top of the MzCalibration m/z (OpenMS#10469): a configured Bruker SDK
(OPENMS_BRUKER_SDK_PATH or Config::bruker_sdk_path) only replaced the
1/K0 converter, so m/z still came from the calibration table even though
the SDK is the vendor reference. Use BrukerTof2MzConverterFactory too and
log 'TIMS calibration: Bruker SDK (m/z + 1/K0)' with the Bruker
attribution (licence section 4.4).

The SDK stays optional: in AUTO, an SDK that cannot be loaded is a
visible warning (was a debug message) and reading continues with the
analysis.tdf calibration tables; only BRUKER_SDK requires it.

Co-authored-by: Copilot App <[email protected]>
jpfeuffer added a commit to jpfeuffer/OpenMS that referenced this pull request Oct 9, 2026
Build the OpenMS images with -DWITH_ONNX=ON against the official ONNX
Runtime 1.30.0 release (MIT, SHA256-pinned per architecture). make install
puts libonnxruntime (with its SONAME links, OpenMS#10465) and the PeptDeep ONNX
models (share/OpenMS/models, Apache-2.0) into /opt/OpenMS, so the library,
tools and tools-thirdparty stages can run ProSE -Search:peptdeep:enable.
The build checks that libOpenMS links ONNX Runtime and that the models are
installed. containerdeploy gets a run_tests input for manual dispatches.

The Bruker TDF-SDK is not shipped: its licence (section 5.2) forbids
combining it with GPL software, which the tools-thirdparty image contains.
Bruker .d files are read without it (MzCalibration table m/z, OpenMS#10469).

Co-authored-by: Copilot App <[email protected]>
@jpfeuffer

Copy link
Copy Markdown
Contributor

FYI, I checked this against the Bruker SDK on the public HeLa timsTOF Pro DDA .d (alphatims release, 20201207_tims03_…_22476.d). The MzCalibration m/z vs SDK tims_index_to_mz: 50 frames, 81,181 peaks, max |Δ| = 0.0000 ppm, i.e. exact (the old linear path was off by up to −37 ppm). The log shows TIMS m/z calibration: MzCalibration table (ModelType 1, 11886 frames, per-frame temperature correction). #10460 is now just an optional-SDK layer on top of this.

jpfeuffer added a commit that referenced this pull request Oct 9, 2026
[FIX,IO] BrukerTimsFile: use an optional Bruker SDK for m/z too (follow-up to #10469)
timosachsenberg pushed a commit that referenced this pull request Oct 10, 2026
Build the OpenMS images with -DWITH_ONNX=ON against the official ONNX
Runtime 1.30.0 release (MIT, SHA256-pinned per architecture). make install
puts libonnxruntime (with its SONAME links, #10465) and the PeptDeep ONNX
models (share/OpenMS/models, Apache-2.0) into /opt/OpenMS, so the library,
tools and tools-thirdparty stages can run ProSE -Search:peptdeep:enable.
The build checks that libOpenMS links ONNX Runtime and that the models are
installed. containerdeploy gets a run_tests input for manual dispatches.

The Bruker TDF-SDK is not shipped: its licence (section 5.2) forbids
combining it with GPL software, which the tools-thirdparty image contains.
Bruker .d files are read without it (MzCalibration table m/z, #10469).

Co-authored-by: Copilot App <[email protected]>
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.

BrukerTimsFile: exact m/z and 1/K0 calibration without the proprietary Bruker SDK (fix upstream opentims / port MzCalibration model)

3 participants