RIcorrect {TargetSearch} | R Documentation

## Peak picking from CDF files and RI correction

### Description

This function reads from CDF files, finds the apex intensities, converts the retention time to retention time index (RI), and writes RI corrected text files (a.k.a. RI files).

### Usage

    RIcorrect(samples, rimLimits = NULL, massRange = NULL, Window, IntThreshold,
    	pp.method = "ppc", showProgressBar = FALSE, baseline = FALSE,
    	baseline.opts = NULL )

### Arguments

`samples` | A `tsSample` object created by `ImportSamples` function.
`rimLimits` | A `tsRim` object. If set to `NULL`, no retention time will be performed. See `ImportFameSettings`.
`massRange` | Deprecated. It is completely ignored but it is kept for compatibility with old scripts.
`Window` | The window used for smoothing. The number of points actually used is `2*Window + 1`. It must be an integer. See details.
`IntThreshold` | Apex intensities lower than this value will be removed from the RI files.
`pp.method` | Peak picking method. Options are "smoothing", "gaussian" and "ppc". See details.
`showProgressBar` | Logical. Should the progress bar be displayed?
`baseline` | Logical. Should baseline correction be performed?
`baseline.opts` | A list of options passed to `baselineCorrection`

.

### Details

There are three pick picking methods available: "ppc", "smoothing", "gaussian".

The "ppc" method (default) implements the peak detection method described in the `ppc` package. It looks for the local maxima within a `2*Window + 1` scans for every mass trace.

The "smoothing" method calculates a moving average of `2*Window + 1` points for every mass trace. Then it looks for a change of sign (from positive to negative) of the difference between two consecutive points. Those points will be returned as detected peaks.

The "gaussian" method behaves similar to the "smoothing" method, but instead a gaussian smoother is used instead of the moving average.

To work out a suitable `Window` value, the following might be useful: `Window = (SR * PW - 1) / 2`, where SR is the scan rate of the MS instrument and PW is the peak width. Because `Window` is an integer, the resulting value must be rounded. For example, for SR = 20 scans per second, a PW = 1.5 seconds, then `Window` = 14.5, which can be rounded to 15.

The RI file type is determined by the output of `fileFormat` method applied to the `tsSample` input object. To choose between the available formats ("binary" and "text"), select it with `fileFormat` method before calling `RIcorrect`.

### Value

A retention time matrix of the found retention time markers. Every column represents a sample and rows RT markers.

### Author(s)

Alvaro Cuadros-Inostroza, Matthew Hannah, Henning Redestig

### See Also

`ImportSamples`, `ImportFameSettings`, `NetCDFPeakFinding`, `FAMEoutliers`, `tsSample`, `tsRim`.

### Examples

    require(TargetSearchData)
    # import refLibrary, rimLimits and sampleDescription.
    data(TSExample)
    # get the CDF files
    cdfpath <- file.path(find.package("TargetSearchData"), "gc-ms-data")
    cdfpath
    list.files(cdfpath)
    # update the CDF path
    CDFpath(sampleDescription) <- cdfpath
    # run RIcorrect (massScanRange = 85-320; Intensity Threshold = 50;
    # peak detection method = "ppc", window = 15)
    RImatrix <- RIcorrect(sampleDescription, rimLimits,
                Window = 15, pp.method = "ppc", IntThreshold = 50)

    # you can try other parameters and other peak picking algorithm.
    RImatrix <- RIcorrect(sampleDescription, rimLimits,
                Window = 15, pp.method = "smoothing", IntThreshold = 10)

    RImatrix <- RIcorrect(sampleDescription, rimLimits,
                Window = 15, pp.method = "ppc", IntThreshold = 100)

[Package TargetSearch version 1.40.3 Index]