| Title: | Low-Level mzML Access via Rust |
|---|---|
| Description: | Experimental low-level access to mzML files from R using the Rust mzdata crate. |
| Authors: | Tom Wilson [aut, cre] |
| Maintainer: | Tom Wilson <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.1.0 |
| Built: | 2026-06-07 23:03:20 UTC |
| Source: | https://github.com/wilsontom/mzrust |
These functions provide a small handle-based API for low-level mzML access from R.
open_mzml() validates the file and returns an external-pointer handle.
header() returns a data frame of per-spectrum metadata,
spectrum_count() returns the number of indexed spectra,
spectrum() returns a named list describing a single scan together with its
peaks data frame,
peaks() returns a data frame with mz and intensity columns
for a single scan, or a list of such data frames when scan = NULL, and
close_mzml() marks the handle as closed. write_mzml() writes a new
indexed mzML file containing only spectra whose retention times fall within the
inclusive rt_min to rt_max window, together with recomputed TIC and
base-peak summary chromatograms for that subset.
open_mzml(path) header(handle) spectrum_count(handle) spectrum(handle, scan) peaks(handle, scan = NULL) close_mzml(handle) write_mzml(handle, output_path, rt_min = -Inf, rt_max = Inf)open_mzml(path) header(handle) spectrum_count(handle) spectrum(handle, scan) peaks(handle, scan = NULL) close_mzml(handle) write_mzml(handle, output_path, rt_min = -Inf, rt_max = Inf)
path |
Path to a |
handle |
An |
scan |
A 1-based scan index. If |
output_path |
Path where the filtered mzML file will be written. Output is written as indexed |
rt_min |
Inclusive lower retention-time bound, using the same units reported by |
rt_max |
Inclusive upper retention-time bound, using the same units reported by |
## Not run: con <- open_mzml("example.mzML") hdr <- header(con) n <- spectrum_count(con) sp <- spectrum(con, scan = 1L) pk <- peaks(con, scan = 1L) all_peaks <- peaks(con) write_mzml(con, "subset.mzML", rt_min = 5, rt_max = 10) close_mzml(con) ## End(Not run)## Not run: con <- open_mzml("example.mzML") hdr <- header(con) n <- spectrum_count(con) sp <- spectrum(con, scan = 1L) pk <- peaks(con, scan = 1L) all_peaks <- peaks(con) write_mzml(con, "subset.mzML", rt_min = 5, rt_max = 10) close_mzml(con) ## End(Not run)