groupFeatures-similar-rtime {xcms} | R 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 'XCMSnExp,SimilarRtimeParam'
    groupFeatures(object, param, msLevel = 1L, ...)

### Arguments

`object` | `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

input `XCMSnExp` 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)
    ## 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))

[Package xcms version 3.16.1 Index]