Skip to contents

This function constructs mzML files using a streaming XML-writing approach, generating and writing XML content directly to a file connection. This method is memory-efficient and fast, making it well-suited for large mzML files. However, it may be less flexible than DOM-based methods for handling complex XML structures or large-scale modifications after writing has begun.

Usage

write_mzml(
  data,
  path_out,
  sample_name = NULL,
  what = NULL,
  instrument_info = NULL,
  compress = TRUE,
  indexed = TRUE,
  force = FALSE,
  show_progress = TRUE,
  verbose = getOption("verbose")
)

Arguments

data

List of data.frames or data.tables containing spectral data.

path_out

The path to write the file.

sample_name

The name of the file. If a name is not provided, the name will be derived from the sample_name attribute.

what

Which streams to write to mzML: "ms1", "ms2", "tic", "bpc", and/or "dad".

instrument_info

Instrument info to write to mzML file.

compress

Logical. Whether to use zlib compression. Defaults to TRUE.

indexed

Logical. Whether to write indexed mzML. Defaults to TRUE.

force

Logical. Whether to overwrite existing files at path_out. Defaults to FALSE.

show_progress

Logical. Whether to show progress bar. Defaults to TRUE.

verbose

Logical. Whether or not to print status messages.

Value

Invisibly returns the path to the written mzML file.

Details

This function constructs mzML files by writing XML strings directly to a file connection. While this approach is memory-efficient and fast, it may be less flexible for handling complex XML structures.

The function supports writing various types of spectral data including MS1, MS2, TIC (Total Ion Current), BPC (Base Peak Chromatogram), and DAD (Diode Array Detector) data.

If indexed = TRUE, the function will create an indexed mzML file, which allows faster random access to spectra.

Author

Ethan Bass