msms_spectra_hmdb: Import MS/MS spectra from HMDB xml files

Description Usage Arguments Value Note Author(s) References See Also Examples

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

Description

msms_spectra_hmdb imports MS/MS spectra from corresponding xml files from HMDB (http://www.hmdb.ca) and returns the data as a data.frame. HMDB stores MS/MS spectrum data in xml files, one file per spectrum.

Depending on the parameter collapsed, the returned data.frame is either collapsed, meaning that each row represents data from one spectrum xml file, 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

1
msms_spectra_hmdb(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:

Note

The HMDB xml files are supposed to be extracted from the downloaded zip file into a folder and should not be renamed. The function identifies xml files containing MS/MS spectra by their file name.

The same spectrum ID can be associated with multiple compounds. Thus, the function assignes an arbitrary ID (column "spectrum_id") to values from each file. The original ID of the spectrum in HMDB is provided in column "original_spectrum_id".

Author(s)

Johannes Rainer

References

Wohlgemuth G, Mehta SS, Mejia RF, Neumann S, Pedrosa D, Pluskal T, Schymanski EL, Willighagen EL, Wilson M, Wishart DS, Arita M, Dorrestein PC, Bandeira N, Wang M, Schulze T, Selak RM, Steinbeck C, Nainala VC, Mistrik R, Nishioka T, Fiehn O. SPLASH, A hashed identifier for mass spectra. Nature Biotechnology 2016 34(11):1099-1101

See Also

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

Other spectrum data import functions.: msms_spectra_mona()

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
## Locate the folder within the package containing test xml files.
pth <- system.file("xml", package = "CompoundDb")

## List all files in that directory
dir(pth)

## Import spectrum data from HMDB MS/MS spectrum xml files in that directory
msms_spectra_hmdb(pth)

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

michaelwitting/CompoundDb documentation built on April 29, 2020, 8:42 p.m.