plotChromatogramsOverlay | R Documentation |
plotOverlay
draws chromatographic peak data from multiple (different)
extracted ion chromatograms (EICs) into the same plot. This allows to
directly compare the peak shape of these EICs in the same sample. In
contrast to the plot
function for MChromatograms()
object, which draws
the data from the same EIC across multiple samples in the same plot, this
function draws the different EICs from the same sample into the same plot.
If plotChromatogramsOverlay
is called on a XChromatograms
object any
present chromatographic peaks will also be highlighted/drawn depending on the
parameters peakType
, peakCol
, peakBg
and peakPch
(see also help on
the plot
function for XChromatogram()
object for details).
## S4 method for signature 'MChromatograms'
plotChromatogramsOverlay(
object,
col = "#00000060",
type = "l",
main = NULL,
xlab = "rtime",
ylab = "intensity",
xlim = numeric(),
ylim = numeric(),
stacked = 0,
transform = identity,
...
)
## S4 method for signature 'XChromatograms'
plotChromatogramsOverlay(
object,
col = "#00000060",
type = "l",
main = NULL,
xlab = "rtime",
ylab = "intensity",
xlim = numeric(),
ylim = numeric(),
peakType = c("polygon", "point", "rectangle", "none"),
peakBg = NULL,
peakCol = NULL,
peakPch = 1,
stacked = 0,
transform = identity,
...
)
object |
|
col |
definition of the color in which the chromatograms should be
drawn. Can be of length 1 or equal to |
type |
|
main |
optional title of the plot. If not defined, the range of m/z values is used. |
xlab |
|
ylab |
|
xlim |
optional |
ylim |
optional |
stacked |
|
transform |
|
... |
optional arguments to be passed to the plotting functions (see
help on the base R |
peakType |
if |
peakBg |
if |
peakCol |
if |
peakPch |
if |
silently returns a list
(length equal to ncol(object)
of
numeric
(length equal to nrow(object)
) with the y position of
each EIC.
Johannes Rainer
## Load preprocessed data and extract EICs for some features.
library(xcms)
library(MSnbase)
xdata <- loadXcmsData()
data(xdata)
## Update the path to the files for the local system
dirname(xdata) <- c(rep(system.file("cdf", "KO", package = "faahKO"), 4),
rep(system.file("cdf", "WT", package = "faahKO"), 4))
## Subset to the first 3 files.
xdata <- filterFile(xdata, 1:3, keepFeatures = TRUE)
## Define features for which to extract EICs
fts <- c("FT097", "FT163", "FT165")
chrs <- featureChromatograms(xdata, features = fts)
plotChromatogramsOverlay(chrs)
## plot the overlay of EICs in the first sample
plotChromatogramsOverlay(chrs[, 1])
## Define a different color for each feature (row in chrs). By default, also
## all chromatographic peaks of a feature is labeled in the same color.
plotChromatogramsOverlay(chrs[, 1],
col = c("#ff000040", "#00ff0040", "#0000ff40"))
## Alternatively, we can define a color for each individual chromatographic
## peak and provide this with the `peakBg` and `peakCol` parameters.
chromPeaks(chrs[, 1])
## Use a color for each of the two identified peaks in that sample
plotChromatogramsOverlay(chrs[, 1],
col = c("#ff000040", "#00ff0040", "#0000ff40"),
peakBg = c("#ffff0020", "#00ffff20"))
## Plotting the data in all samples.
plotChromatogramsOverlay(chrs,
col = c("#ff000040", "#00ff0040", "#0000ff40"))
## Creating a "stacked" EIC plot: the EICs are placed along the y-axis
## relative to their m/z value. With `stacked = 1` the y-axis is split in
## half, the lower half being used for the stacking of the EICs, the upper
## half being used for the *original* intensity axis.
res <- plotChromatogramsOverlay(chrs[, 1], stacked = 1,
col = c("#ff000040", "#00ff0040", "#0000ff40"))
## add horizontal lines for the m/z values of each EIC
abline(h = res[[1]], col = "grey", lty = 2)
## Note that this type of visualization is different than the conventional
## plot function for chromatographic data, which will draw the EICs for
## multiple samples into the same plot
plot(chrs)
## Converting the object to a MChromatograms without detected peaks
chrs <- as(chrs, "MChromatograms")
plotChromatogramsOverlay(chrs,
col = c("#ff000040", "#00ff0040", "#0000ff40"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.