functionalEnrichment: Functional enrichment

functionalEnrichmentR Documentation

Functional enrichment

Description

Perform functional enrichment analyses of explanatory features using the FELLA R package.

Usage

functionalEnrichment(
  x,
  organism,
  methods = availableMethods(),
  split = c("none", "trends"),
  organism_data = organismData(organism),
  adduct_rules_table = adduct_rules(),
  ...
)

## S4 method for signature 'RandomForest'
functionalEnrichment(
  x,
  organism,
  methods = availableMethods(),
  split = c("none", "trends"),
  organism_data = organismData(organism),
  adduct_rules_table = adduct_rules(),
  ...
)

Arguments

x

object of S4 class RandomForest

organism

the KEGG code for the organism of interest

methods

the enrichment techniques to build. Any returned by availableMethods.

split

split the explanatory features into further groups based on their trends. See details.

organism_data

an object of S4 class FELLA.DATA

adduct_rules_table

the adduct ionisation rules for matching m/z features to KEGG compounds. Format should be as returned from mzAnnotation::adduct_rules.

...

arguments to pass to metabolyseR::explanatoryFeatures

Details

For argument split = 'trends', the explanatory features can be split into further groups based on their trends. This is not supported for unsupervised random forest.

For random forest classification, this is for binary comparisons only. Functional enrichment is performed seperately on the up and down regulated explanatory features for each comparison. The ⁠up regulated⁠ and ⁠down regulated⁠ groups are based on the trends of log2 ratios between the comparison classes. ⁠up regulated⁠ explanatory features have a higher median intensity in the right-hand class compared to the left-hand class of the comparison. The opposite is true for the ⁠down regulated⁠ explanatory features.

For random forest regression, the explanatory features are split based on their Spearman's correlation coefficient with the response variable prior to functional enrichment analysis giving ⁠positively correlated⁠ and ⁠negatively correlated⁠ subgroups.

Value

An object of S4 class FunctionalEnrichment.

Examples

## Perform random forest on the example data 
random_forest <- assigned_data %>% 
metabolyseR::randomForest(
  cls = 'class'
)

## Perform functional enrichment analysis
functionalEnrichment(
  random_forest,
  'bdi',
  methods = 'hypergeom',
  organism_data = organismData(
    'bdi',
    database_directory = system.file(
      'bdi',
      package = 'riches'),
    internal_directory = FALSE
  )
)

## An example using split trends
## Perform binary random forest classification on the example data 
random_forest <- assigned_data %>% 
  metabolyseR::randomForest(
    cls = 'class',
    binary = TRUE
  )

## Perform functional enrichment analysis
functionalEnrichment(
  random_forest,
  'bdi',
  methods = 'hypergeom',
  split = 'trends',
  organism_data = organismData(
    'bdi',
    database_directory = system.file(
      'bdi',
      package = 'riches'),
    internal_directory = FALSE
  )
)

jasenfinch/riches documentation built on April 24, 2023, 9:45 a.m.