Reads chromatograms, mass spectra and peak lists from 'Allotrope Simple Model' chromatography files into R.
Arguments
- path
Path to ASM
.jsonfile.- what
What to read: 2D chromatograms (
chroms), mass spectra (MS1), peak lists (peak_table) and/or instrument traces (instrument), such as pump pressure, flow rate or temperature. Defaults tochromsandMS1, dropping whichever the file does not contain.- data_format
Whether to return data in
wide(default) orlongformat.- format_out
Class of output. Either
matrix,data.frame, ordata.table.- peaktable_format
Whether to return peak tables in the standard
chromatographrlayout (rt,start,end,area,heightandFWHM) ororiginalformat, with every field the file records under its ASM name.- read_metadata
Logical. Whether to attach metadata. Defaults to
TRUE.- metadata_format
Format to output metadata. Either
chromconverter(standardized field names) orraw(vendor field names, unmapped).- collapse
Logical. Whether to collapse lists that only contain a single element. Defaults to
TRUE.
Value
A 2D chromatogram in the format specified by format_out and
data_format, or a list of them named by detection type if the file holds
more than one (or collapse = FALSE). Mass spectra are returned as a
data.frame (or data.table) with columns rt, mz and intensity, and
peak tables as a data.frame (or data.table) per measurement. Instrument
traces are returned as 2D chromatograms named by trace. Where more
than one of these is returned, they are combined in a list named by what.
A file with several injections returns a chrom_list with one such
element per injection. Metadata are attached as attributes if
read_metadata is TRUE.
Details
Retention times in seconds are converted to minutes. Other units, such as
retention volumes (mL), are returned as the file declares them. The unit is
recorded in the time_unit attribute.
A file can hold several injections, such as a sequence exported from a chromatography data system. Each injection is then returned as a separate sample, named by its sample name, and read_chroms adds each one to the list of samples it returns.
Mass spectra have so far only been tested against the example files published by the Allotrope Foundation.
