R/group_feature_methods.R
groupFeatures-similar-rtime.Rd
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
xcms::featureDefinitions()
this is further sub-grouped by this method.
See MsFeatures::SimilarRtimeParam()
in MsFeatures
for more details.
# S4 method for 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.
Other feature grouping methods:
groupFeatures-abundance-correlation
,
groupFeatures-eic-correlation
Johannes Rainer
## Performing a quick preprocessing of a test data set. library(faahKO) fls <- c(system.file('cdf/KO/ko15.CDF', package = "faahKO"), system.file('cdf/KO/ko16.CDF', package = "faahKO"), system.file('cdf/WT/wt19.CDF', package = "faahKO")) od <- readMSData(fls, mode = "onDisk")#>xod <- findChromPeaks( od, param = CentWaveParam(noise = 10000, snthresh = 40, prefilter = c(3, 10000)))#>#>#>#>#>#>#>#>#>#>#>#>#>#>## 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)#> [1] "FG.001" "FG.035" "FG.027" "FG.036" "FG.037" "FG.030"#> #> FG.001 FG.002 FG.003 FG.004 FG.005 FG.006 FG.007 FG.008 FG.009 FG.010 FG.011 #> 3 3 2 2 4 2 3 2 2 4 3 #> FG.012 FG.013 FG.014 FG.015 FG.016 FG.017 FG.018 FG.019 FG.020 FG.021 FG.022 #> 3 2 2 2 2 3 3 2 2 2 3 #> FG.023 FG.024 FG.025 FG.026 FG.027 FG.028 FG.029 FG.030 FG.031 FG.032 FG.033 #> 2 2 2 2 2 2 2 2 2 2 2 #> FG.034 FG.035 FG.036 FG.037 FG.038 FG.039 FG.040 FG.041 FG.042 FG.043 FG.044 #> 2 1 1 1 1 1 1 1 1 1 1 #> FG.045 FG.046 FG.047 FG.048 FG.049 FG.050 FG.051 FG.052 FG.053 FG.054 FG.055 #> 1 1 1 1 1 1 1 1 1 1 1 #> FG.056 FG.057 FG.058 FG.059 FG.060 FG.061 FG.062 FG.063 FG.064 FG.065 FG.066 #> 1 1 1 1 1 1 1 1 1 1 1 #> FG.067 FG.068 FG.069 FG.070 FG.071 FG.072 FG.073 FG.074 FG.075 FG.076 FG.077 #> 1 1 1 1 1 1 1 1 1 1 1 #> FG.078 FG.079 FG.080 FG.081 FG.082 FG.083 FG.084 FG.085 FG.086 FG.087 FG.088 #> 1 1 1 1 1 1 1 1 1 1 1 #> FG.089 FG.090 FG.091 FG.092 FG.093 FG.094 FG.095 FG.096 FG.097 FG.098 FG.099 #> 1 1 1 1 1 1 1 1 1 1 1 #> FG.100 FG.101 FG.102 FG.103 FG.104 FG.105 FG.106 FG.107 FG.108 FG.109 FG.110 #> 1 1 1 1 1 1 1 1 1 1 1#> [1] 110## 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))#> [1] 103