msms_spectra_mona: Import MS/MS spectra from MoNa

View source: R/spectrum-import-functions.R

msms_spectra_monaR Documentation

Import MS/MS spectra from MoNa

Description

msms_spectra_mona() imports MS/MS spectra from a MoNa (Massbank of North America, http://mona.fiehnlab.ucdavis.edu/downloads) SDF file and returns the data as a data.frame.

Depending on the parameter collapsed, the returned data.frame is either collapsed, meaning that each row represents data from one spectrum, or expanded with one row for each m/z and intensity pair for each spectrum. Columns "mz" and "intensity" are of type list for collapsed = TRUE and numeric for collapsed = FALSE.

Usage

msms_spectra_mona(x, collapsed = TRUE)

Arguments

x

character(1): with the path to directory containing the xml files.

collapsed

logical(1) whether the returned data.frame should be collapsed or expanded. See description for more details.

Value

data.frame with as many rows as there are peaks and columns:

  • spectrum_id (integer): an arbitrary, unique ID for each spectrum.

  • original_spectrum_id (character): The ID from the spectrum as specified in the MoNa SDF.

  • compound_id (character): the compound ID the spectrum is associated with.

  • polarity (integer): 0 for negative, 1 for positive, NA for not set.

  • collision_energy (character): collision energy voltage.

  • predicted (logical): whether the spectrum is predicted or experimentally verified.

  • splash (character): NA since SPLASH (SPectraL hASH) keys are not provided.

  • instrument_type (character): the type of MS instrument on which the spectrum was measured.

  • instrument (character): the MS instrument.

  • precursor_mz (numeric): precursor m/z.

  • adduct (character): ion formed from the precursor ion.

  • ms_level (integer): stage of the sequential mass spectrometry (MSn).

  • mz (numeric or list of numeric): m/z values of the spectrum.

  • intensity (numeric or list of numeric): intensity of the spectrum.

Note

The identifiers provided by MoNa are used as original_spectrum_id. Note also that the MoNa data is not normalized in the sense that each spectrum is associated to one compound and the compound data is partially redundant. Also, MoNa does not provide a splash for a spectrum, hence the corresponding column will only contain NA.

Author(s)

Johannes Rainer

See Also

createCompDb() for the function to create a CompDb database with compound annotation and spectrum data.

Other spectrum data import functions.: msms_spectra_hmdb()

Examples


## Define the test file containing the data
fl <- system.file("sdf/MoNa_export-All_Spectra_sub.sdf.gz",
    package = "CompoundDb")
## Import spectrum data from the SDF file with a subset of the MoNa data
msms_spectra_mona(fl)

## Import the data as an *expanded* data frame, i.e. with a row for each
## single m/z (intensity) value.
msms_spectra_mona(fl, collapsed = FALSE)

EuracBiomedicalResearch/CompoundDb documentation built on Oct. 1, 2024, 2:16 p.m.