peaksWithCentWave: Identify peaks in chromatographic data using centWave

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/do_findChromPeaks-functions.R

Description

peaksWithCentWave identifies (chromatographic) peaks in purely chromatographic data, i.e. based on intensity and retention time values without m/z values.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
peaksWithCentWave(
  int,
  rt,
  peakwidth = c(20, 50),
  snthresh = 10,
  prefilter = c(3, 100),
  integrate = 1,
  fitgauss = FALSE,
  noise = 0,
  verboseColumns = FALSE,
  firstBaselineCheck = TRUE,
  extendLengthMSW = FALSE,
  ...
)

Arguments

int

numeric with intensity values.

rt

numeric with the retention time for the intensities. Length has to be equal to length(int).

peakwidth

numeric(2) with the lower and upper bound of the expected peak width.

snthresh

numeric(1) defining the signal to noise ratio cutoff. Peaks with a signal to noise ratio < snthresh are omitted.

prefilter

numeric(2) (c(k, I)): only regions of interest with at least k centroids with signal >= I are returned in the first step.

integrate

numeric(1), integration method. For integrate = 1 peak limits are found through descending on the mexican hat filtered data, for integrate = 2 the descend is done on the real data. The latter method is more accurate but prone to noise, while the former is more robust, but less exact.

fitgauss

logical(1) whether or not a Gaussian should be fitted to each peak.

noise

numeric(1) defining the minimum required intensity for centroids to be considered in the first analysis step (definition of the regions of interest).

verboseColumns

logical(1): whether additional peak meta data columns should be returned.

firstBaselineCheck

logical(1). If TRUE continuous data within regions of interest is checked to be above the first baseline.

extendLengthMSW

logical(1). If TRUE the "open" method of EIC extension is used, rather than the default "reflect" method.

...

currently ignored.

Details

The method uses the same algorithm for the peak detection than centWave, employs however a different approach to identify the initial regions in which the peak detection is performed (i.e. the regions of interest ROI). The method first identifies all local maxima in the chromatographic data and defines the corresponding positions +/- peakwidth[2] as the ROIs. Noise estimation bases also on these ROIs and can thus be different from centWave resulting in different signal to noise ratios.

Value

A matrix, each row representing an identified chromatographic peak, with columns:

Additional columns for verboseColumns = TRUE:

Author(s)

Johannes Rainer

See Also

centWave for a detailed description of the peak detection method.

Other peak detection functions for chromatographic data: peaksWithMatchedFilter()

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
## Reading a file
library(xcms)
od <- readMSData(system.file("cdf/KO/ko15.CDF", package = "faahKO"),
    mode = "onDisk")

## Extract chromatographic data for a small m/z range
mzr <- c(272.1, 272.2)
chr <- chromatogram(od, mz = mzr, rt = c(3000, 3300))[1, 1]

int <- intensity(chr)
rt <- rtime(chr)

## Plot the region
plot(chr, type = "h")

## Identify peaks in the chromatographic data
pks <- peaksWithCentWave(intensity(chr), rtime(chr))
pks

## Highlight the peaks
rect(xleft = pks[, "rtmin"], xright = pks[, "rtmax"],
    ybottom = rep(0, nrow(pks)), ytop = pks[, "maxo"], col = "#ff000040",
    border = "#00000040")

xcms documentation built on Nov. 8, 2020, 5:13 p.m.