knitr::opts_chunk$set(echo = TRUE)
Retention times are useful orthogonal information to m/z values for metabolite identification. masstrixR
can combine m/z and RT search, when a suitable database is supplied. In this case the SQLite database that is used has to contain retention time information. The example below shows how a suitable compound list for combined m/z and RT search looks like and how it is used with masstrixR
. The example data is taken from Stoffel et al. [1] and contains a small database of substances and their retention time indicies (RTIs) obtained on a reversed phase separation. The databsae is based on authentic chemical standards and unknown samples are derived from measurements of C. elegans metabolite extracts.
#load required library library(readr) library(masstrixR) # get example file from package exampleFile <- system.file("extdata", "exampleData\\Celegans_mz_rt\\rtidb.txt", package = 'masstrixR') # read file into tibble (the funciton from readr is used) compoundList <- read_tsv(exampleFile, col_types = cols(exactmass = col_double(), rt = col_double())) head(compoundList)
In order to work with retention times the argument rt
, which is by default set to FALSE
, has to be set to TRUE
. This will check if all entries in the compound list contain a RT value. This is necessary, because the database search also searches for a matching RT.
# adducts used for DB generation adducts <- c("[M+H]+", "[M+Na]+") # create compound list for DB creation newCompoundList <- prepareCompoundList(compoundList, adductList = adducts, rt = TRUE) # check if compound list is valid and create SQLite DB if(validateCompoundList(newCompoundList)) { dbFileName <- createDb(newCompoundList, "example_pos_MH_MNa_withRT") } print(dbFileName)
Next, the example data is loaded. It contains one column called RT
, which contains the caluclated RTIs for the samples and one column RT.min
with the original retention time in minutes. The database search is performed as simultaneous search for fitting m/z-RT pairs. The allowed retention time deviation is defined in the rtTol
field, while the type is either defined as "abs"
or "rel"
for absolute or relative error respectively. In the used example an absolute RTI error of 5 units is used. Please not that no testing if the RTs in database and in the data are in the same unit is performed.
peakTableFile <- system.file("extdata", "exampleData\\Celegans_mz_rt\\peakTable.txt", package = 'masstrixR') peakTable <- read_tsv(peakTableFile) #annotate annotationResults <- mzSearch(peakTable, dbFileName, mzTol = 0.005, mzTolType = "abs", rt = TRUE, rtTol = 5, rtTolType = "abs") head(annotationResults)
[1] Stoffel et al. 2019
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.