adjustRtime | R Documentation |
The adjustRtime
method(s) perform retention time correction (alignment)
between chromatograms of different samples/dataset. Alignment is performed
by default on MS level 1 data. Retention times of spectra from other MS
levels, if present, are subsequently adjusted based on the adjusted
retention times of the MS1 spectra. Note that calling adjustRtime
on a
xcms result object will remove any eventually present previous alignment
results as well as any correspondence analysis results. To run a second
round of alignment, raw retention times need to be replaced with adjusted
ones using the applyAdjustedRtime()
function.
The alignment method can be specified (and configured) using a dedicated
param
argument.
Supported param
objects are:
ObiwarpParam
: performs retention time adjustment based on the full m/z -
rt data using the obiwarp method (Prince (2006)). It is based on the
original code but supports in addition
alignment of multiple samples by aligning each against a center sample.
The alignment is performed directly on the profile-matrix and can hence
be performed independently of the peak detection or peak grouping.
PeakGroupsParam
: performs retention time correction based on the
alignment of features defined in all/most samples (corresponding to
house keeping compounds or marker compounds) (Smith 2006). First the
retention time deviation of these features is described by fitting either a
polynomial (smooth = "loess"
) or a linear (smooth = "linear"
) function
to the data points. These are then subsequently used to adjust the
retention time of each spectrum in each sample (even from spectra of
MS levels different than MS 1). Since the function is
based on features (i.e. chromatographic peaks grouped across samples) a
initial correspondence analysis has to be performed before using the
groupChromPeaks()
function. Alternatively, it is also possible to
manually define a numeric
matrix with retention times of markers in each
samples that should be used for alignment. Such a matrix
can be passed
to the alignment function using the peakGroupsMatrix
parameter of the
PeakGroupsParam
parameter object. By default the adjustRtimePeakGroups
function is used to define this matrix
. This function identifies peak
groups (features) for alignment in object
based on the parameters defined
in param
. See also do_adjustRtime_peakGroups()
for the core API
function.
LamaParama
: This function performs retention time correction by aligning
chromatographic data to an external reference dataset (concept and initial
implementation by Carl Brunius). The process involves identifying and
aligning peaks within the experimental chromatographic data, represented
as an XcmsExperiment
object, to a predefined set of landmark features
called "lamas". These landmark features are characterized by their
mass-to-charge ratio (m/z) and retention time. see LamaParama()
for more
information on the method.
adjustRtime(object, param, ...)
## S4 method for signature 'MsExperiment,ObiwarpParam'
adjustRtime(object, param, chunkSize = 2L, BPPARAM = bpparam())
## S4 method for signature 'MsExperiment,PeakGroupsParam'
adjustRtime(object, param, msLevel = 1L, ...)
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")
)
ObiwarpParam(
binSize = 1,
centerSample = integer(),
response = 1L,
distFun = "cor_opt",
gapInit = numeric(),
gapExtend = numeric(),
factorDiag = 2,
factorGap = 1,
localAlignment = FALSE,
initPenalty = 0,
subset = integer(),
subsetAdjust = c("average", "previous"),
rtimeDifferenceThreshold = 5
)
adjustRtimePeakGroups(object, param = PeakGroupsParam(), msLevel = 1L)
## S4 method for signature 'OnDiskMSnExp,ObiwarpParam'
adjustRtime(object, param, msLevel = 1L)
## 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 'ObiwarpParam'
binSize(object)
## S4 replacement method for signature 'ObiwarpParam'
binSize(object) <- value
## S4 method for signature 'ObiwarpParam'
centerSample(object)
## S4 replacement method for signature 'ObiwarpParam'
centerSample(object) <- value
## S4 method for signature 'ObiwarpParam'
response(object)
## S4 replacement method for signature 'ObiwarpParam'
response(object) <- value
## S4 method for signature 'ObiwarpParam'
distFun(object)
## S4 replacement method for signature 'ObiwarpParam'
distFun(object) <- value
## S4 method for signature 'ObiwarpParam'
gapInit(object)
## S4 replacement method for signature 'ObiwarpParam'
gapInit(object) <- value
## S4 method for signature 'ObiwarpParam'
gapExtend(object)
## S4 replacement method for signature 'ObiwarpParam'
gapExtend(object) <- value
## S4 method for signature 'ObiwarpParam'
factorDiag(object)
## S4 replacement method for signature 'ObiwarpParam'
factorDiag(object) <- value
## S4 method for signature 'ObiwarpParam'
factorGap(object)
## S4 replacement method for signature 'ObiwarpParam'
factorGap(object) <- value
## S4 method for signature 'ObiwarpParam'
localAlignment(object)
## S4 replacement method for signature 'ObiwarpParam'
localAlignment(object) <- value
## S4 method for signature 'ObiwarpParam'
initPenalty(object)
## S4 replacement method for signature 'ObiwarpParam'
initPenalty(object) <- value
## S4 method for signature 'ObiwarpParam'
subset(x)
## S4 replacement method for signature 'ObiwarpParam'
subset(object) <- value
## S4 method for signature 'ObiwarpParam'
subsetAdjust(object)
## S4 replacement method for signature 'ObiwarpParam'
subsetAdjust(object) <- value
## S4 method for signature 'XCMSnExp,PeakGroupsParam'
adjustRtime(object, param, msLevel = 1L)
## S4 method for signature 'XCMSnExp,ObiwarpParam'
adjustRtime(object, param, msLevel = 1L)
object |
For |
param |
The parameter object defining the alignment method (and its setting). |
... |
ignored. |
chunkSize |
For |
BPPARAM |
parallel processing setup. Defaults to |
msLevel |
For |
minFraction |
For |
extraPeaks |
For |
smooth |
For |
span |
For |
family |
For |
peakGroupsMatrix |
For |
subset |
For |
subsetAdjust |
For |
binSize |
|
centerSample |
|
response |
For |
distFun |
For |
gapInit |
For |
gapExtend |
For |
factorDiag |
For |
factorGap |
For |
localAlignment |
For |
initPenalty |
For |
rtimeDifferenceThreshold |
For |
value |
The value for the slot. |
x |
An |
adjustRtime
on an OnDiskMSnExp
or XCMSnExp
object will return an
XCMSnExp
object with the alignment results.
adjustRtime
on an MsExperiment
or XcmsExperiment
will return an
XcmsExperiment
with the adjusted retention times stored in an new
spectra variable rtime_adjusted
in the object's spectra
.
ObiwarpParam
, PeakGroupsParam
and LamaParama
return the respective
parameter object.
adjustRtimeGroups
returns a matrix
with the retention times of marker
features in each sample (each row one feature, each row one sample).
All alignment methods allow to perform the retention time correction on a
user-selected subset of samples (e.g. QC samples) after which all samples
not part of that subset will be adjusted based on the adjusted retention
times of the closest subset sample (close in terms of index within object
and hence possibly injection index). It is thus suggested to load MS data
files in the order in which their samples were injected in the measurement
run(s).
How the non-subset samples are adjusted depends also on the parameter
subsetAdjust
: with 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 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 more details.
Colin Smith, Johannes Rainer, Philippine Louail, Carl Brunius
Prince, J. T., and Marcotte, E. M. (2006) "Chromatographic Alignment of ESI-LC-MS Proteomic Data Sets by Ordered Bijective Interpolated Warping" Anal. Chem., 78 (17), 6140-6152.
Smith, C.A., Want, E.J., O'Maille, G., Abagyan, R. and Siuzdak, G. (2006). "XCMS: Processing Mass Spectrometry Data for Metabolite Profiling Using Nonlinear Peak Alignment, Matching, and Identification" Anal. Chem. 78:779-787.
plotAdjustedRtime()
for visualization of alignment results.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.