FindAllPeaks {TargetSearch} | R Documentation

## Extract peaks from chromatogram files - low level function

### Description

This function extracts all peaks of a given metabolite in a given RI window. It is intented to fine-tune metabolite search parameters.

### Usage

    FindAllPeaks(samples, Lib, libID, dev=NULL, mz=NULL, RI=NULL,
             mz_type = c('selMass', 'quantMass', 'topMass'),
             columns = c("SPECTRUM", "RETENTION_TIME_INDEX", "RETENTION_TIME"))

### Arguments

`samples` | A `tsSample` object created by `ImportSamples` function.
`Lib` | A `tsLib` object created by `ImportLibrary` function.
`libID` | An index (integer or character) value representing the respective metabolite in the reference library `Lib`.
`dev` | The allowed retention index (RI) deviation or `NULL`.
`mz` | A list of m/z values to search or `NULL`.
`RI` | The expected retention index or `NULL`.
`mz_type` | whether to search for the selective, quant or top masses of the respective metabolite.
`columns` | A numeric vector with the positions of the columns `SPECTRUM`, `RETENTION_TIME_INDEX`, and `RETENTION_TIME` or a character vector with the header names of those columns.

### Details

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 `columns` parameter is only needed for custom text RI files. There is no need to change it.

### Value

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.

### Note

This is an internal function not intended to be invoked directly, but it is exposed for convenience and advanced used.

In the future it will replace `FindPeaks`.

### Author(s)

Alvaro Cuadros-Inostroza

### See Also

`FindPeaks`

### Examples

    # 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)

    # 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)

[Package TargetSearch version 1.43.3 Index]