plotChromPeakDensity,XCMSnExp-method | R Documentation |
Plot the density of chromatographic peaks along the retention
time axis and indicate which peaks would be (or were) grouped into the
same feature based using the peak density correspondence method.
Settings for the peak density method can be passed with an
PeakDensityParam object to parameter param
. If the object
contains
correspondence results and the correspondence was performed with the
peak groups method, the results from that correspondence can be
visualized setting simulate = FALSE
.
## S4 method for signature 'XCMSnExp'
plotChromPeakDensity(object, mz, rt, param,
simulate = TRUE, col = "#00000080", xlab = "retention time",
ylab = "sample", xlim = range(rt), main = NULL, type = c("any",
"within", "apex_within"), ...)
object |
A XCMSnExp object with identified chromatographic peaks. |
mz |
|
rt |
|
param |
PeakDensityParam from which parameters for the
peak density correspondence algorithm can be extracted. If not provided
and if |
simulate |
|
col |
Color to be used for the individual samples. Length has to be 1
or equal to the number of samples in |
xlab |
|
ylab |
|
xlim |
|
main |
|
type |
|
... |
Additional parameters to be passed to the |
The plotChromPeakDensity
function allows to evaluate
different settings for the peak density on an mz slice of
interest (e.g. containing chromatographic peaks corresponding to a known
metabolite).
The plot shows the individual peaks that were detected within the
specified mz
slice at their retention time (x-axis) and sample in
which they were detected (y-axis). The density function is plotted as a
black line. Parameters for the density
function are taken from the
param
object. Grey rectangles indicate which chromatographic peaks
would be grouped into a feature by the peak density
correspondence
method. Parameters for the algorithm are also taken from param
.
See groupChromPeaks-density()
for more information about the
algorithm and its supported settings.
The function is called for its side effect, i.e. to create a plot.
Johannes Rainer
groupChromPeaks-density()
for details on the
peak density correspondence method and supported settings.
## Below we perform first a peak detection (using the centWave
## method) on some of the test files from the faahKO package.
library(faahKO)
library(xcms)
fls <- dir(system.file("cdf/KO", package = "faahKO"), recursive = TRUE,
full.names = TRUE)
## Reading 2 of the KO samples
raw_data <- readMSData(fls[1:2], mode = "onDisk")
## Perform the peak detection using the centWave method (settings are tuned
## to speed up example execution)
res <- findChromPeaks(raw_data, param = CentWaveParam(noise = 3000, snthresh = 40))
## Align the samples using obiwarp
res <- adjustRtime(res, param = ObiwarpParam())
## Plot the chromatographic peak density for a specific mz range to evaluate
## different peak density correspondence settings.
mzr <- c(305.05, 305.15)
plotChromPeakDensity(res, mz = mzr, pch = 16,
param = PeakDensityParam(sampleGroups = rep(1, length(fileNames(res)))))
## Use a larger bandwidth
plotChromPeakDensity(res, mz = mzr, param = PeakDensityParam(bw = 60,
sampleGroups = rep(1, length(fileNames(res)))), pch = 16)
## Neighboring peaks are now fused into one.
## Require the chromatographic peak to be present in all samples of a group
plotChromPeakDensity(res, mz = mzr, pch = 16,
param = PeakDensityParam(minFraction = 1,
sampleGroups = rep(1, length(fileNames(res)))))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.