| groupFeatures-similar-rtime {xcms} | R Documentation |
Group features based on similar retention time. This method is supposed to be
used as an initial crude grouping of features based on the median retention
time of all their chromatographic peaks. All features with a difference in
their retention time which is <= parameter diffRt of the parameter object
are grouped together. If a column "feature_group" is found in
featureDefinitions() this is further sub-grouped by this method.
See MsFeatures::SimilarRtimeParam() in MsFeatures for more details.
## S4 method for signature 'XCMSnExp,SimilarRtimeParam' groupFeatures(object, param, msLevel = 1L, ...)
object |
|
param |
|
msLevel |
|
... |
passed to the |
input XCMSnExp with feature groups added (i.e. in column
"feature_group" of its featureDefinitions data frame.
Johannes Rainer
Other feature grouping methods:
groupFeatures-abundance-correlation,
groupFeatures-eic-similarity
library(MsFeatures)
## Load a test data set with detected peaks
data(faahko_sub)
## Update the path to the files for the local system
dirname(faahko_sub) <- system.file("cdf/KO", package = "faahKO")
## Disable parallel processing for this example
register(SerialParam())
## Group chromatographic peaks across samples
xodg <- groupChromPeaks(faahko_sub, param = PeakDensityParam(sampleGroups = rep(1, 3)))
## Group features based on similar retention time (i.e. difference <= 2 seconds)
xodg_grp <- groupFeatures(xodg, param = SimilarRtimeParam(diffRt = 2))
## Feature grouping get added to the featureDefinitions in column "feature_group"
head(featureDefinitions(xodg_grp)$feature_group)
table(featureDefinitions(xodg_grp)$feature_group)
length(unique(featureDefinitions(xodg_grp)$feature_group))
## Using an alternative groupiing method that creates larger groups
xodg_grp <- groupFeatures(xodg,
param = SimilarRtimeParam(diffRt = 2, groupFun = MsCoreUtils::group))
length(unique(featureDefinitions(xodg_grp)$feature_group))