Skip to main content

Crate openreadout_mzml_writer

Crate openreadout_mzml_writer 

Source
Expand description

Indexed mzML 1.1.0 writer.

Spectra come from any Dataset that implements read_spectrum_view. Arrays are written base64 + zlib (m/z as 64-bit, intensity as 32-bit float). The file is written under a temporary name, read back (well-formed XML, index offsets, SHA-1 checksum, every array decoded and hash-compared to what was written), and only then renamed into place.

Controlled-vocabulary accessions are those of the public PSI-MS and Unit ontologies.

mzML is the open mass-spectrometry exchange format of the HUPO Proteomics Standards Initiative, read by OpenMS, ProteoWizard, pyteomics, MZmine and most analysis software.

§Example

use std::path::Path;

use openreadout_core::{Dataset, Result};
use openreadout_mzml_writer::{MzmlExportOptions, default_output, export_mzml};

/// Write the centroided spectra of run 0 of an opened file as `<stem>.mzML`.
fn to_mzml(dataset: &mut dyn Dataset, input: &Path) -> Result<()> {
    let mut options = MzmlExportOptions::default();
    options.centroid = true;
    let report = export_mzml(dataset, input, &default_output(input), &options)?;
    println!("{} spectra, SHA-1 {}", report.spectra_written, report.sha1);
    Ok(())
}

Structs§

MzmlExportOptions
What to write.
MzmlExportReport
Result of an mzML export.

Functions§

default_output
Default output path: the input with .mzML.
export_mzml
Export run opts.run of ds (read from input) to output as indexed mzML.