chromPeakChromatograms: Extract an ion chromatogram for each chromatographic peak

chromPeakChromatogramsR Documentation

Extract an ion chromatogram for each chromatographic peak

Description

Extract an ion chromatogram (EIC) for each chromatographic peak in an XcmsExperiment() object. The result is returned as an XChromatograms() of length equal to the number of chromatographic peaks (and one column).

Usage

chromPeakChromatograms(object, ...)

## S4 method for signature 'XcmsExperiment'
chromPeakChromatograms(
  object,
  expandRt = 0,
  expandMz = 0,
  aggregationFun = "max",
  peaks = character(),
  return.type = c("XChromatograms", "MChromatograms"),
  ...,
  progressbar = TRUE
)

Arguments

object

An XcmsExperiment() with identified chromatographic peaks.

...

currently ignored.

expandRt

numeric(1) to eventually expand the retention time range from which the signal should be integrated. The chromatogram will contain signal from chromPeaks[, "rtmin"] - expandRt to chromPeaks[, "rtmax"] + expandRt. The default is expandRt = 0.

expandMz

numeric(1) to eventually expand the m/z range from which the signal should be integrated. The chromatogram will contain signal from chromPeaks[, "mzmin"] - expandMz to chromPeaks[, "mzmax"] + expandMz. The default is expandMz = 0.

aggregationFun

character(1) defining the function how signals within the m/z range in each spectrum (i.e. for each discrete retention time) should be aggregated. The default (aggregationFun = "max") reports the largest signal for each spectrum.

peaks

optional character providing the IDs of the chromatographic peaks (i.e. the row names of the peaks in chromPeaks(object)) for which chromatograms should be returned.

return.type

character(1) specifying the type of the returned object. Can be either return.type = "XChromatograms" (the default) or return.type = "MChromatograms" to return either a chromatographic object with or without the identified chromatographic peaks, respectively.

progressbar

logical(1) whether the progress of the extraction process should be displayed.

Author(s)

Johannes Rainer

See Also

featureChromatograms() to extract an EIC for each feature.

Examples


## Load a test data set with detected peaks
library(MSnbase)
library(xcms)
library(MsExperiment)
faahko_sub <- loadXcmsData("faahko_sub2")

## Get EICs for every detected chromatographic peak
chrs <- chromPeakChromatograms(faahko_sub)
chrs

## Order of EICs matches the order in chromPeaks
chromPeaks(faahko_sub) |> head()

## variable "sample_index" provides the index of the sample the EIC was
## extracted from
fData(chrs)$sample_index

## Get the EIC for selected peaks only.
pks <- rownames(chromPeaks(faahko_sub))[c(6, 12)]
pks

## Expand the data on retention time dimension by 15 seconds (on each side)
res <- chromPeakChromatograms(faahko_sub, peaks = pks, expandRt = 5)
plot(res[1, ])

sneumann/xcms documentation built on Nov. 23, 2024, 6:53 p.m.