adjustRtime-obiwarp | R Documentation |
This method performs retention time adjustment using the
Obiwarp method [Prince 2006]. It is based on the code at
http://obi-warp.sourceforge.net but supports 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.
It is also possible to exclude certain samples within an experiment from
the estimation of the alignment models. The parameter subset
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
in subset
(close in terms of position within the object
).
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
: 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 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.
The ObiwarpParam
class allows to specify all
settings for the retention time adjustment based on the obiwarp
method. Class Instances should be created using the
ObiwarpParam
constructor.
binSize
,binSize<-
: getter and setter
for the binSize
slot of the object.
centerSample
,centerSample<-
: getter and setter
for the centerSample
slot of the object.
response
,response<-
: getter and setter
for the response
slot of the object.
distFun
,distFun<-
: getter and setter
for the distFun
slot of the object.
gapInit
,gapInit<-
: getter and setter
for the gapInit
slot of the object.
gapExtend
,gapExtend<-
: getter and setter
for the gapExtend
slot of the object.
factorDiag
,factorDiag<-
: getter and setter
for the factorDiag
slot of the object.
factorGap
,factorGap<-
: getter and setter
for the factorGap
slot of the object.
localAlignment
,localAlignment<-
: getter and setter
for the localAlignment
slot of the object.
initPenalty
,initPenalty<-
: getter and setter
for the initPenalty
slot of the object.
subset
,subset<-
: getter and
setter for the subset
slot of the object.
subsetAdjust
,subsetAdjust<-
: getter and
setter for the subsetAdjust
slot of the object.
adjustRtime,XCMSnExp,ObiwarpParam
:
performs retention time correction/alignment based on the total mz-rt
data using the obiwarp method.
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"))
## S4 method for signature 'OnDiskMSnExp,ObiwarpParam'
adjustRtime(object, param,
msLevel = 1L)
## S4 method for signature 'ObiwarpParam'
show(object)
## 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,ObiwarpParam'
adjustRtime(object, param,
msLevel = 1L)
binSize |
|
centerSample |
|
response |
|
distFun |
character defining the distance function to be used. Allowed
values are |
gapInit |
|
gapExtend |
|
factorDiag |
|
factorGap |
|
localAlignment |
|
initPenalty |
|
subset |
|
subsetAdjust |
|
object |
For For all other methods: a |
param |
A |
msLevel |
|
value |
The value for the slot. |
x |
a |
The ObiwarpParam
function returns a
ObiwarpParam
class instance with all of the settings
specified for obiwarp retention time adjustment and alignment.
For adjustRtime,XCMSnExp,ObiwarpParam
: a
XCMSnExp
object with the results of the retention time
adjustment step. These can be accessed with the
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 peak grouping results from the result
object.
For adjustRtime,OnDiskMSnExp,ObiwarpParam
: a numeric
with
the adjusted retention times per spectra (in the same order than
rtime
).
.__classVersion__,binSize,centerSample,response,distFun,gapInit,gapExtend,factorDiag,factorGap,localAlignment,initPenalty,subset,subsetAdjust
See corresponding parameter above. .__classVersion__
stores
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
retcor
methods. All of the settings to the alignment
algorithm can be passed with a ObiwarpParam
object.
Alignment using obiwarp is performed on the retention time of spectra
of on MS level. Retention times for spectra of other MS levels are
subsequently adjusted based on the adjustment function defined on the
retention times of the spectra of MS level msLevel
.
Calling adjustRtime
on an XCMSnExp
object will cause
all peak grouping (correspondence) results and any previous retention
time adjustment results to be dropped.
Colin Smith, Johannes Rainer
John T. Prince and Edward M. Marcotte. "Chromatographic Alignment of ESI-LC-MS Proteomics Data Sets by Ordered Bijective Interpolated Warping" Anal. Chem. 2006, 78(17):6140-6152.
John T. Prince and Edward M. Marcotte. "Chromatographic Alignment of ESI-LC-MS Proteomic Data Sets by Ordered Bijective Interpolated Warping" Anal. Chem. 2006, 78 (17), 6140-6152.
retcor.obiwarp
for the old user interface.
plotAdjustedRtime
for visualization of alignment results.
XCMSnExp
for the object containing the results of
the alignment.
Other retention time correction methods: adjustRtime-peakGroups
,
adjustRtime
library(faahKO)
library(MSnbase)
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 retention time correction on the OnDiskMSnExp:
res <- adjustRtime(raw_data, param = ObiwarpParam())
## As a result we get a numeric vector with the adjusted retention times for
## all spectra.
head(res)
## We can split this by file to get the adjusted retention times for each
## file
resL <- split(res, fromFile(raw_data))
##############################
## Perform retention time correction on an XCMSnExp:
##
## Perform first the chromatographic peak detection using the matchedFilter
## method.
mfp <- MatchedFilterParam(snthresh = 20, binSize = 1)
res <- findChromPeaks(raw_data, param = mfp)
## Performing the retention time adjustment using obiwarp.
res_2 <- adjustRtime(res, param = ObiwarpParam())
head(rtime(res_2))
head(rtime(raw_data))
## Also the retention times of the detected peaks were adjusted.
tail(chromPeaks(res))
tail(chromPeaks(res_2))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.