Expand description
openmassspec-io is the umbrella crate that ties together the open
Rust mass-spec parsers (opentfraw, opentimstdf, openwraw,
openaraw, opensxraw, openszraw) behind a uniform
vendor-detection + mzML-conversion API.
Each vendor parser is gated behind a Cargo feature
(thermo, bruker, waters, agilent, sciex, shimadzu); the
all meta-feature pulls in every supported vendor. The reader crates
are private dependencies: no reader type appears in this crate’s API,
so a reader’s major release does not change it. Reader errors arrive
as Error::Reader; Error::reader_error gives the reader’s own
error for downcasting. The arrow feature re-exports
openmassspec-arrow as
[arrow]; no Arrow type appears anywhere else in this crate’s API.
Even with no features enabled, detect_format is available so
callers can probe a path without paying the compile-time cost of a
parser they will not use.
§Errors in the record stream
Every vendor source yields Result records: a spectrum or chromatogram
the parser cannot decode is reported as an error, never dropped.
collect, stream, and collect_chromatograms stop at the first
such error and return it. convert_to_mzml does the same by default;
ConvertOptions::with_record_error_policy with
RecordErrorPolicy::Skip
leaves unreadable records out instead and reports how many in the
returned WriteSummary.
§Centroiding
ConvertOptions::with_centroid, collect_centroided, and
stream_centroided centroid every profile-mode spectrum first via
openmassspec_core::Centroided. Centroiding is always opt-in.
§Example
use std::path::Path;
use openmassspec_io::core::RecordErrorPolicy;
use openmassspec_io::{convert_to_mzml, detect_format, ConvertOptions};
let detected = detect_format(Path::new("run.raw")).expect("supported format");
let opts = ConvertOptions::new()
.with_indexed(true)
.with_record_error_policy(RecordErrorPolicy::Skip);
let summary = convert_to_mzml(&detected, Path::new("run.mzML"), &opts)?;
if summary.skipped() > 0 {
eprintln!("warning: {} unreadable records skipped", summary.skipped());
}Re-exports§
pub use openmassspec_core as core;
Structs§
- Convert
Options - Options for
convert_to_mzmlandconvert_to_mzml_writer. - Detected
- Result of probing a filesystem path for a supported vendor format.
- VecSource
- A trivial in-memory
SpectrumSourcebacked by aVec<SpectrumRecord>and aRunMetadata. Hand it toopenmassspec_core::write_mzmlwhen you already have the records in hand and just want to emit mzML.
Enums§
- Error
- Errors produced by the umbrella
openmassspec-ioAPI. - Vendor
Format - Detected on-disk vendor / format family.
Functions§
- collect
- Decode every spectrum of
detectedinto aVec, together with the run-level metadata. Used by tools that need a second pass over the data (conformance validation,infosummaries). - collect_
centroided - Like
collect, but every profile-mode spectrum is centroided first viaopenmassspec_core::Centroided. Already-centroided spectra pass through unchanged.min_intensity, whenSome, discards picked peaks below that noise floor. - collect_
chromatograms - Decode chromatogram traces from a vendor acquisition without decoding its spectra. The returned records retain their native channel IDs and time/intensity arrays; vendors without decoded traces return an empty vec.
- convert_
to_ mzml - Convert a detected vendor acquisition to an mzML file at
output. - convert_
to_ mzml_ writer - Like
convert_to_mzmlbut writes to an arbitrary writer (gzip, stdout, an in-memory buffer). The writer is not flushed. - detect_
format - Inspect
path(file or directory) and return the matching vendor format, orNonewhen none of the supported signatures match. - metadata_
only - Return only the run-level metadata for
detected, without decoding any spectra. - stream
- Like
collect, but visits each spectrum throughon_spectrumas soon as it is decoded instead of buffering the whole run into aVecfirst. Memory use is bounded by whateveron_spectrumitself retains, not by the acquisition size. - stream_
centroided - Like
stream, but every profile-mode spectrum is centroided first viaopenmassspec_core::Centroided. Already-centroided spectra pass through unchanged.min_intensity, whenSome, discards picked peaks below that noise floor. - with_
source - Open the vendor source for
detectedand runfon it.