Skip to main content

Crate timsrust_centroid

Crate timsrust_centroid 

Source
Expand description

§timsrust_centroid

timsrust_centroid provides fast centroiding and peak picking for Bruker timsTOF data.

§Features

  • Fast centroiding algorithms
  • Optional CLI and Parquet writer

§Examples

§Creating and using a PeakReader

use timsrust_centroid::{PeakReader, Peak};
// Construct a FrameReader from a format-specific crate (e.g. timsrust-tdf)
// and pass it together with minimum ion counts for MS1 and MS2.
let frame_reader = /* e.g. TdfFrameReader::new("example.d").unwrap() */;
let reader = PeakReader::new(frame_reader, 10.0, 5.0).unwrap();
let peaks = reader.get_peaks_from_frame(100).unwrap();
for peak in peaks.iter() {
    println!("peak: {:?}", peak);
}

§Creating and using a SpectrumReader

use timsrust_centroid::spectrum_reader::SpectrumReader;
// Construct a FrameReader and converters from format-specific crates (e.g. timsrust-tdf).
// Pass minimum ion counts for MS1, MS2, minimum spectrum size, precursor flag, and converters.
let frame_reader = /* e.g. TdfFrameReader::new("example.d").unwrap() */;
let im_converter = /* e.g. from TDF calibration */;
let mz_converter = /* e.g. from TDF calibration */;
let reader = SpectrumReader::new(frame_reader, 10.0, 2.0, 5, false, im_converter, mz_converter).unwrap();
let spectra = reader.get_spectra_from_frame(100);
for spectrum in spectra.iter() {
    println!("spectrum: {:?}", spectrum);
}

§Error handling

use timsrust_centroid::{TimsResult, TimsError};
fn do_something() -> TimsResult<()> {
    // ... your code ...
    Ok(())
}

Modules§

spectrum_reader

Structs§

Peak
Represents a centroided peak in a frame.
PeakReader
Reads and extracts centroided peaks from frames.
TimsError
Error type for the timsrust_centroid crate.

Functions§

get_average_ms1_peak
get_best_peak_for_frame

Type Aliases§

TimsResult
Result type for functions that can return a TimsError.