groupFeatures-similar-rtime: Compounding/feature grouping based on similar retention times

groupFeatures-similar-rtimeR Documentation

Compounding/feature grouping based on similar retention times

Description

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.

Usage

## S4 method for signature 'XcmsResult,SimilarRtimeParam'
groupFeatures(object, param, msLevel = 1L, ...)

Arguments

object

XcmsExperiment() or XCMSnExp() object containing also correspondence results.

param

SimilarRtimeParam object with the settings for the method. See MsFeatures::SimilarRtimeParam() for details and options.

msLevel

integer(1) defining the MS level on which the features should be grouped.

...

passed to the groupFeatures function on numeric values.

Value

the input object with feature groups added (i.e. in column "feature_group" of its featureDefinitions data frame.

Author(s)

Johannes Rainer

See Also

Other feature grouping methods: groupFeatures-abundance-correlation, groupFeatures-eic-similarity

Examples


library(MsFeatures)
library(MsExperiment)
## Load a test data set with detected peaks
faahko_sub <- loadXcmsData("faahko_sub2")

## 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))

sneumann/xcms documentation built on Nov. 23, 2024, 6:53 p.m.