Description Usage Arguments Details Value Author(s) See Also Examples
The chromatogram
method extracts chromatogram(s) from an
MSnExp
or OnDiskMSnExp
object.
Depending on the provided parameters this can be a total ion chromatogram
(TIC), a base peak chromatogram (BPC) or an extracted ion chromatogram
(XIC) extracted from each sample/file.
1 2 3 4 5 6 7 8 9 10 | ## S4 method for signature 'MSnExp'
chromatogram(
object,
rt,
mz,
aggregationFun = "sum",
missing = NA_real_,
msLevel = 1L,
BPPARAM = bpparam()
)
|
object |
For |
rt |
A |
mz |
A |
aggregationFun |
|
missing |
|
msLevel |
|
BPPARAM |
Parallelisation backend to be used, which will
depend on the architecture. Default is
|
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.
By default or if mz
and/or rt
are numeric vectors, the
function extracts one Chromatogram
object for each file
in the MSnExp
or OnDiskMSnExp
object. Providing a numeric matrix with argument mz
or rt
enables to extract multiple chromatograms per file, one for each row in
the matrix. If the number of columns of mz
or rt
are not
equal to 2, range
is called on each row of the matrix.
chromatogram
returns a MChromatograms
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
). The 'featureData' of the returned object contains columns
"mzmin"
and "mzmax"
with the values from input argument
mz
(if used) and "rtmin"
and "rtmax"
if the input
argument rt
was used.
Johannes Rainer
Chromatogram
and MChromatograms
for the
classes that represent single and multiple chromatograms.
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 41 42 43 44 45 | ## Read a test data file.
library(msdata)
f <- c(system.file("microtofq/MM14.mzML", package = "msdata"),
system.file("microtofq/MM8.mzML", package = "msdata"))
## Read the data as an MSnExp
msd <- readMSData(f, msLevel = 1)
## Extract the total ion chromatogram for each file:
tic <- chromatogram(msd)
tic
## Extract the TIC for the second file:
tic[1, 2]
## Plot the TIC for the first file
plot(rtime(tic[1, 1]), intensity(tic[1, 1]), type = "l",
xlab = "rtime", ylab = "intensity", main = "TIC")
## Extract chromatograms for a MS data slices defined by retention time
## and mz ranges.
rtr <- rbind(c(10, 60), c(280, 300))
mzr <- rbind(c(140, 160), c(300, 320))
chrs <- chromatogram(msd, rt = rtr, mz = mzr)
## Each row of the returned MChromatograms object corresponds to one mz-rt
## range. The Chromatogram for the first range in the first file is empty,
## because the retention time range is outside of the file's rt range:
chrs[1, 1]
## The mz and/or rt ranges used are provided as featureData of the object
fData(chrs)
## The mz method can be used to extract the m/z ranges directly
mz(chrs)
## Also the Chromatogram for the second range in the second file is empty
chrs[2, 2]
## Get the extracted chromatogram for the first range in the second file
chr <- chrs[1, 2]
chr
plot(rtime(chr), intensity(chr), xlab = "rtime", ylab = "intensity")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.