View source: R/spectrum-import-functions.R
msms_spectra_hmdb imports MS/MS spectra from corresponding xml files from
HMDB (http://www.hmdb.ca) and returns the data as a
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
"intensity" are of type
collapsed = TRUE and
collapsed = FALSE.
msms_spectra_hmdb(x, collapsed = TRUE)
data.frame with as many rows as there are peaks and columns:
integer): an arbitrary, unique ID identifying values
from one xml file.
character): the HMDB-internal ID of the spectrum.
character): the HMDB compound ID the spectrum is associated
integer): 0 for negative, 1 for positive,
NA for not set.
numeric): collision energy voltage.
logical): whether the spectrum is predicted or experimentally
character): the SPLASH (SPectraL hASH) key of the spectrum
character): the type of MS instrument on which the
spectrum was measured.
character): the MS instrument (not available for all spectra
numeric): not provided by HMDB and thus
numeric): m/z values of the spectrum.
numeric): intensity of the spectrum.
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
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
createCompDb() for the function to create a CompDb database with
compound annotation and spectrum data.
Other spectrum data import functions.:
## 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.