| FindAllPeaks {TargetSearch} | R Documentation |
This function extracts all peaks of a given metabolite in a given RI window. This function is intended for fine-tuning metabolite search parameters.
FindAllPeaks(samples, Lib, libID, dev=NULL, mz=NULL, RI=NULL,
mz_type = c('selMass', 'quantMass', 'topMass'),
columns = NULL)
samples |
A |
Lib |
A |
libID |
An index (integer or character) value representing the respective metabolite in
the reference library |
dev |
The allowed retention index (RI) deviation or |
mz |
A list of m/z values to search or |
RI |
The expected retention index or |
mz_type |
whether to search for the selective, quant or top masses of the respective metabolite. |
columns |
Either |
The function searches for all peaks of a metabolite in all samples within a RI
window. The parameters dev, mz, and RI have preference over
the settings of the metabolite indexed by libID. In fact, if all of
these parameters are not NULL, then refLib and libID are not
used.
The dev parameter can either be NULL (as stated above), or a numeric vector.
If the length is equal to 1, then the RI search window is the given RI
plus or minus dev. If the length is 2, then the search window is from RI + dev[1]
to RI + dev[2]. Note than in this case dev[1] is usually a negative value.
An error is raised if the length is greater than 2
The columns parameter is only needed for custom text RI files. There is
no need to change it.
It returns a matrix in which each row represent a hit. Note that there can be zero rows if no hits are found. The columns are named and these are:
Int |
Peak intensity |
RI |
Retention Index |
RI |
Retention Time |
mz |
the searched m/z value |
fid |
the respective file or sample index. An integer value. |
This is an internal function not intended to be invoked directly, but it is exposed for convenience and advanced users.
In the future it may replace FindPeaks.
See also the function ri_data_extract which offers a similar functionality
but with different input parameters.
Alvaro Cuadros-Inostroza
# load pre-calculated example data files and objects
require(TargetSearchData)
data(TSExample)
# get and set the RI file path
RIpath(sampleDescription) <- file.path(find.package("TargetSearchData"), "gc-ms-data")
# search all peaks of Valine (GC.3) and selective masses
peaks <- FindAllPeaks(sampleDescription, refLibrary, 'GC.3')
head(peaks)
# a numeric index is also allowed
peaks <- FindAllPeaks(sampleDescription, refLibrary, 3)
head(peaks)
# an asymmetric deviation search
peaks <- FindAllPeaks(sampleDescription, refLibrary, 'GC.3', dev=c(-1000, 2000))
head(peaks)
# search arbitrary masses at arbitrary RI. the reference library and ID
# must be set set to NULL.
peaks <- FindAllPeaks(sampleDescription, NULL, NULL, dev=3000, RI=270000, mz=c(144, 100))
head(peaks)