Description Usage Arguments Value Slots Note Author(s) References See Also Examples
This method performs retention time adjustment based on the
alignment of chromatographic peak groups present in all/most samples
(hence corresponding to house keeping compounds). First the retention
time deviation of these peak groups is described by fitting either a
smooth = "loess") or a linear (
smooth = "linear") model to the data points. These models are
subsequently used to adjust the retention time of each spectrum in
It is also possible to exclude certain samples within an experiment from
the estimation of the alignment models. The parameter
allows to define the indices of samples within
object that should
be aligned. Samples not part of this
subset are left out in the
estimation of the alignment models, but their retention times are
subsequently adjusted based on the alignment results of the closest sample
subset (close in terms of position within the
Alignment could thus be performed on only real samples leaving out
e.g. blanks, which are then in turn adjusted based on the closest real
sample. Here it is up to the user to ensure that the samples within
object are ordered correctly (e.g. by injection index).
How the non-subset samples are adjusted bases also on the parameter
subsetAdjust = "previous", each non-subset
sample is adjusted based on the closest previous subset sample which results
in most cases with adjusted retention times of the non-subset sample being
identical to the subset sample on which the adjustment bases. The second,
default, option is to use
subsetAdjust = "average" in which case
each non subset sample is adjusted based on the average retention time
adjustment from the previous and following subset sample. For the average
a weighted mean is used with weights being the inverse of the distance of
the non-subset sample to the subset samples used for alignment.
See also section Alignment of experiments including blanks in the xcms vignette for an example.
PeakGroupsParam class allows to specify all
settings for the retention time adjustment based on house keeping
peak groups present in most samples.
Instances should be created with the
adjustRtimePeakGroups returns the features (peak groups)
which would, depending on the provided
selected for alignment/retention time correction.
minFraction<-: getter and setter
minFraction slot of the object.
extraPeaks<-: getter and setter
extraPeaks slot of the object.
smooth<-: getter and setter
smooth slot of the object.
span<-: getter and setter
span slot of the object.
family<-: getter and setter
family slot of the object.
peakGroupsMatrix<-: getter and
setter for the
peakGroupsMatrix slot of the object.
subset<-: getter and
setter for the
subset slot of the object.
subsetAdjust<-: getter and
setter for the
subsetAdjust slot of the object.
performs retention time correction based on the alignment of peak groups
(features) found in all/most samples. The correction function identified
on these peak groups is applied to the retention time of all spectra in
the object, i.e. retention times of all spectra, also MS level > 1 are
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 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
PeakGroupsParam( minFraction = 0.9, extraPeaks = 1, smooth = "loess", span = 0.2, family = "gaussian", peakGroupsMatrix = matrix(nrow = 0, ncol = 0), subset = integer(), subsetAdjust = c("average", "previous") ) adjustRtimePeakGroups(object, param = PeakGroupsParam(), msLevel = 1L) ## S4 method for signature 'PeakGroupsParam' show(object) ## S4 method for signature 'PeakGroupsParam' minFraction(object) ## S4 replacement method for signature 'PeakGroupsParam' minFraction(object) <- value ## S4 method for signature 'PeakGroupsParam' extraPeaks(object) ## S4 replacement method for signature 'PeakGroupsParam' extraPeaks(object) <- value ## S4 method for signature 'PeakGroupsParam' smooth(x) ## S4 replacement method for signature 'PeakGroupsParam' smooth(object) <- value ## S4 method for signature 'PeakGroupsParam' span(object) ## S4 replacement method for signature 'PeakGroupsParam' span(object) <- value ## S4 method for signature 'PeakGroupsParam' family(object) ## S4 replacement method for signature 'PeakGroupsParam' family(object) <- value ## S4 method for signature 'PeakGroupsParam' peakGroupsMatrix(object) ## S4 replacement method for signature 'PeakGroupsParam' peakGroupsMatrix(object) <- value ## S4 method for signature 'PeakGroupsParam' subset(x) ## S4 replacement method for signature 'PeakGroupsParam' subset(object) <- value ## S4 method for signature 'PeakGroupsParam' subsetAdjust(object) ## S4 replacement method for signature 'PeakGroupsParam' subsetAdjust(object) <- value ## S4 method for signature 'XCMSnExp,PeakGroupsParam' adjustRtime(object, param, msLevel = 1L)
character defining the function to be used, to interpolate
corrected retention times for all peak groups. Either
character defining the method to be used for loess smoothing.
Allowed values are
For all other methods: a
The value for the slot.
PeakGroupsParam function returns a
PeakGroupsParam class instance with all of the settings
specified for retention time adjustment based on house keeping
matrix, rows being
features, columns samples, of retention times. The features are ordered
by the median retention time across columns.
XCMSnExp object with the
results of the retention time adjustment step. These can be accessed
adjustedRtime method. Retention time correction
does also adjust the retention time of the identified chromatographic
peaks (accessed via
chromPeaks. Note that retention
time correction drops all previous alignment results from the result
See corresponding parameter above.
the version from the class. Slots values should exclusively be accessed
via the corresponding getter and setter methods listed above.
These methods and classes are part of the updated and modernized
xcms user interface which will eventually replace the
group methods. All of the settings to the alignment
algorithm can be passed with a
The matrix with the (raw) retention times of the peak groups used
in the alignment is added to the
peakGroupsMatrix slot of the
PeakGroupsParam object that is stored into the corresponding
process history step (see
processHistory for how
to access the process history).
adjustRtimePeakGroups is supposed to be called before the
sample alignment, but after a correspondence (peak grouping).
This method requires that a correspondence analysis has been performed
on the data, i.e. that grouped chromatographic peaks/features are present
groupChromPeaks for details).
adjustRtime on an
XCMSnExp object will cause all
peak grouping (correspondence) results and any previous retention time
adjustments to be dropped.
In some instances, the
re-adjusts adjusted retention times to ensure them being in the same
order than the raw (original) retention times.
Colin Smith, Johannes Rainer
Colin A. Smith, Elizabeth J. Want, Grace O'Maille, Ruben Abagyan and Gary Siuzdak. "XCMS: Processing Mass Spectrometry Data for Metabolite Profiling Using Nonlinear Peak Alignment, Matching, and Identification" Anal. Chem. 2006, 78:779-787.
API function and
retcor.peakgroups for the old user
plotAdjustedRtime for visualization of alignment results.
XCMSnExp for the object containing the results of
Other retention time correction methods:
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 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
############################## ## Chromatographic peak detection and grouping. ## ## Below we perform first a peak detection (using the matchedFilter ## method) on some of the test files from the faahKO package followed by ## a peak grouping. 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 matchedFilter method. mfp <- MatchedFilterParam(snthresh = 20, binSize = 1) res <- findChromPeaks(raw_data, param = mfp) head(chromPeaks(res)) ## The number of peaks identified per sample: table(chromPeaks(res)[, "sample"]) ## Performing the peak grouping using the "peak density" method. p <- PeakDensityParam(sampleGroups = c(1, 1)) res <- groupChromPeaks(res, param = p) ## Perform the retention time adjustment using peak groups found in both ## files. fgp <- PeakGroupsParam(minFraction = 1) ## Before running the alignment we can evaluate which features (peak groups) ## would be used based on the specified parameters. pkGrps <- adjustRtimePeakGroups(res, param = fgp) ## We can also plot these to evaluate if the peak groups span a large portion ## of the retention time range. plot(x = pkGrps[, 1], y = rep(1, nrow(pkGrps)), xlim = range(rtime(res)), ylim = c(1, 2), xlab = "rt", ylab = "", yaxt = "n") points(x = pkGrps[, 2], y = rep(2, nrow(pkGrps))) segments(x0 = pkGrps[, 1], x1 = pkGrps[, 2], y0 = rep(1, nrow(pkGrps)), y1 = rep(2, nrow(pkGrps))) grid() axis(side = 2, at = c(1, 2), labels = colnames(pkGrps)) ## Next we perform the alignment. res <- adjustRtime(res, param = fgp) ## Any grouping information was dropped hasFeatures(res) ## Plot the raw against the adjusted retention times. plot(rtime(raw_data), rtime(res), pch = 16, cex = 0.25, col = fromFile(res)) ## Adjusterd retention times can be accessed using ## rtime(object, adjusted = TRUE) and adjustedRtime all.equal(rtime(res), adjustedRtime(res)) ## To get the raw, unadjusted retention times: all.equal(rtime(res, adjusted = FALSE), rtime(raw_data)) ## To extract the retention times grouped by sample/file: rts <- rtime(res, bySample = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.