Description Usage Arguments Details Value Note Author(s) See Also Examples
chromatogram
: the method allows to extract
chromatograms from OnDiskMSnExp
and
XCMSnExp
objects. See also the
chromatogram
implementation for
OnDiskMSnExp
in the MSnbase
package.
1 2 3 4 | ## S4 method for signature 'XCMSnExp'
chromatogram(object, rt, mz, aggregationFun = "sum",
missing = NA_real_, msLevel = 1L, BPPARAM = bpparam(),
adjustedRtime = hasAdjustedRtime(object), filled = FALSE)
|
object |
Either a |
rt |
|
mz |
|
aggregationFun |
|
missing |
|
msLevel |
|
BPPARAM |
Parallelisation backend to be used, which will
depend on the architecture. Default is
|
adjustedRtime |
For |
filled |
|
Arguments rt
and mz
allow to specify the MS
data slice from which the chromatogram should be extracted.
The parameter aggregationSum
allows to specify the function to be
used to aggregate the intensities across the mz range for the same
retention time. Setting aggregationFun = "sum"
would e.g. allow
to calculate the total ion chromatogram (TIC),
aggregationFun = "max"
the base peak chromatogram (BPC).
The length of the extracted Chromatogram
object,
i.e. the number of available data points, corresponds to the number of
scans/spectra measured in the specified retention time range. If in a
specific scan (for a give retention time) no signal was measured in the
specified mz range, a NA_real_
is reported as intensity for the
retention time (see Notes for more information). This can be changed
using the missing
parameter.
chromatogram
returns a XChromatograms
object with
the number of columns corresponding to the number of files in
object
and number of rows the number of specified ranges (i.e.
number of rows of matrices provided with arguments mz
and/or
rt
). All chromatographic peaks with their apex position within the
m/z and retention time range are also retained as well as all feature
definitions for these peaks.
Chromatogram
objects extracted with
chromatogram
contain NA_real_
values if, for a given retention time, no
signal was measured in the specified mz range. If no spectrum/scan is
present in the defined retention time window a Chromatogram
object
of length 0 is returned.
For XCMSnExp
objects, if adjusted retention times are
available, the chromatogram
method will by default report
and use these (for the subsetting based on the provided parameter
rt
). This can be overwritten with the parameter
adjustedRtime
.
Johannes Rainer
XCMSnExp
for the data object.
Chromatogram
for the object representing
chromatographic data.
XChromatograms
for the object allowing to arrange
multiple XChromatogram
objects.
plot
to plot a XChromatogram
or
Chromatograms
objects.
as
(as(x, "data.frame")
) in MSnbase
for a method to extract the MS data as data.frame
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | ## Read some files from the faahKO package.
library(xcms)
library(faahKO)
faahko_3_files <- c(system.file('cdf/KO/ko15.CDF', package = "faahKO"),
system.file('cdf/KO/ko16.CDF', package = "faahKO"),
system.file('cdf/KO/ko18.CDF', package = "faahKO"))
od <- readMSData(faahko_3_files, mode = "onDisk")
## Perform peak detection using default CentWave parameters
xod <- findChromPeaks(od, param = CentWaveParam())
## Extract the ion chromatogram for one chromatographic peak in the data.
chrs <- chromatogram(xod, rt = c(2700, 2900), mz = 335)
chrs
## Plot the chromatogram
plot(chrs)
## Extract chromatograms for multiple ranges.
mzr <- matrix(c(335, 335, 344, 344), ncol = 2, byrow = TRUE)
rtr <- matrix(c(2700, 2900, 2600, 2750), ncol = 2, byrow = TRUE)
chrs <- chromatogram(xod, mz = mzr, rt = rtr)
chrs <- chromatogram(xod, mz = mzr)
rtr[1, 1] <- 2785
chrs <- chromatogram(xod, mz = mzr, rt = rtr)
chrs
## Plot the extracted chromatograms
plot(chrs)
## Get access to all chromatograms for the second mz/rt range
chrs[1, ]
## Plot just that one
plot(chrs[1, , drop = FALSE])
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.