Skip to main content

Crate openreadout_bruker_tims

Crate openreadout_bruker_tims 

Source
Expand description

Clean-room readers for Bruker .d directories: timsTOF acquisitions (TDF/TSF, format id bruker-tdf) and BAF acquisitions of the other TOF and FT-ICR instruments (module baf, BrukerBafReader, format id bruker-baf; docs/formats/bruker-baf.md).

A TDF dataset (analysis.tdf + analysis.tdf_bin) stores frames of trapped-ion-mobility scans; a TSF dataset (analysis.tsf + analysis.tsf_bin) one line spectrum per frame. The .tdf/.tsf files are SQLite databases, read here by a small pure-Rust reader (write-ahead logs included); frame blobs are zstd-compressed. Spectra are exposed per MS1 frame (summed over scans), per DDA-PASEF precursor and per DIA-PASEF window. Layout and vocabulary: docs/formats/bruker-tdf.md. Provenance: docs/provenance/bruker-tdf.md.

§Example

Every reader implements openreadout_core::FormatReader: descriptor says what it reads, sniff recognises a file from its first bytes, and open returns a openreadout_core::Dataset with a header-only info() summary and lazy data access.

use openreadout_core::FormatReader;
use openreadout_bruker_tims::BrukerTimsReader;

let format = BrukerTimsReader.descriptor();
assert_eq!(format.id, openreadout_bruker_tims::FORMAT_ID);
println!("{} ({}): .{}", format.name, format.family, format.extensions.join(", ."));

Reading a file:

use std::path::Path;

use openreadout_core::FormatReader;
use openreadout_bruker_tims::BrukerTimsReader;

let mut dataset = BrukerTimsReader.open(Path::new("run.d"))?;
let info = dataset.info()?; // headers only
let run = &info.spectra[0];
println!("{} spectra, MS levels {:?}", run.scan_count, run.ms_levels);
// Spectrum 0 of run 0: parallel m/z and intensity arrays.
let spectrum = dataset.read_spectrum(0, 0)?;
println!("MS{} at {:?} s: {} points", spectrum.ms_level, spectrum.rt_s, spectrum.mz.len());

Applications that accept any instrument file usually register every reader in an openreadout_core::Registry and let it detect the format; that is what the openreadout command-line tool does.

§API stability

The supported API is what this page documents. The parser modules are public only so that tests and fuzz targets can reach them: they are hidden from this documentation and may change in any release.

Structs§

BrukerBafReader
The Bruker BAF reader.
BrukerTimsReader
The timsTOF reader.

Constants§

FORMAT_ID
Format id on the command line and in JSON.