Accessor methods for the FunctionalEnrichment
S4 class.
Usage
hits(x)
# S4 method for FunctionalEnrichment
hits(x)
# S4 method for FunctionalEnrichment
explanatoryFeatures(x)
enrichmentResults(x)
# S4 method for FunctionalEnrichment
enrichmentResults(x)
generateResultsTable(x, method = availableMethods(), nlimit = 250, ...)
# S4 method for FunctionalEnrichment
generateResultsTable(x, method = availableMethods(), nlimit = 250)
Arguments
- x
object of S4 class
FunctionalEnrichment
- method
the method results to access. One of
availableMethods
.- nlimit
argument to pass to argument
nlimit
ofFELLA::generateResultsTable
. Limits the order of the sub-graph solutions for methodsdiffusion
andpagerank
.- ...
ignored
Examples
## Perform random forest on the example data
random_forest <- assigned_data %>%
metabolyseR::randomForest(
cls = 'class'
)
## Perform functional enrichment analysis
enrichment_results <- functionalEnrichment(
random_forest,
'bdi',
methods = 'hypergeom',
organism_data = organismData(
'bdi',
database_directory = system.file(
'bdi',
package = 'riches'),
internal_directory = FALSE
)
)
#> Loading KEGG graph data...
#> Done.
#> Loading hypergeom data...
#> Loading matrix...
#> Done.
#> Loading diffusion data...
#> Loading matrix...
#> 'diffusion.matrix.RData' not present in:/home/runner/work/_temp/Library/riches/bdi/diffusion.matrix.RData. Simulated permutations may execute slower for diffusion.
#> Done.
#> Loading rowSums...
#> 'diffusion.rowSums.RData' not present in:/home/runner/work/_temp/Library/riches/bdi/diffusion.rowSums.RData. Z-scores won't be available for diffusion.
#> Done.
#> Loading pagerank data...
#> Loading matrix...
#> 'pagerank.matrix.RData' not present in:/home/runner/work/_temp/Library/riches/bdi/pagerank.matrix.RData. Simulated permutations may execute slower for pagerank.
#> Done.
#> Loading rowSums...
#> 'pagerank.rowSums.RData' not present in:/home/runner/work/_temp/Library/riches/bdi/pagerank.rowSums.RData. Z-scores won't be available for pagerank.
#> Done.
#> Data successfully loaded.
#>
#> class
#> ABR1~ABR5~ABR6~BD21
#> Running hypergeom...
#> Starting hypergeometric p-values calculation...
#> Done.
## Access the m/z feature KEGG compound matches
hits(enrichment_results)
#> # A tibble: 332 × 8
#> ID MF INCHI SMILES name feature adduct compound
#> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr>
#> 1 C01546 C5H4O3 InChI=1S/C5H4O3/c6-5(7)4-… "c1cc… n111… n111.0… [M-H]… 2-Furoa…
#> 2 C01546 C5H4O3 InChI=1S/C5H4O3/c6-5(7)4-… "c1cc… n112… n112.0… [M-H]… 2-Furoa…
#> 3 C00122 C4H4O4 InChI=1S/C4H4O4/c5-3(6)1-… "C(=C… n115… n115.0… [M-H]… Fumarate
#> 4 C01384 C4H4O4 InChI=1S/C4H4O4/c5-3(6)1-… "C(=C… n115… n115.0… [M-H]… Maleic …
#> 5 C00122 C4H4O4 InChI=1S/C4H4O4/c5-3(6)1-… "C(=C… n116… n116.0… [M-H]… Fumarate
#> 6 C01384 C4H4O4 InChI=1S/C4H4O4/c5-3(6)1-… "C(=C… n116… n116.0… [M-H]… Maleic …
#> 7 C00122 C4H4O4 InChI=1S/C4H4O4/c5-3(6)1-… "C(=C… n117… n117.0… [M-H]… Fumarate
#> 8 C01384 C4H4O4 InChI=1S/C4H4O4/c5-3(6)1-… "C(=C… n117… n117.0… [M-H]… Maleic …
#> 9 C00042 C4H6O4 InChI=1S/C4H6O4/c5-3(6)1-… "C(CC… n117… n117.0… [M-H]… Succina…
#> 10 C02170 C4H6O4 InChI=1S/C4H6O4/c1-2(3(5)… "CC(C… n117… n117.0… [M-H]… Methylm…
#> # ℹ 322 more rows
## Access the explanatory features used for functional enrichment
explanatoryFeatures(enrichment_results)
#> # A tibble: 153 × 5
#> # Groups: response, comparison [1]
#> response comparison feature metric value
#> <chr> <chr> <chr> <chr> <dbl>
#> 1 class ABR1~ABR5~ABR6~BD21 n267.05255 C12H12O7 [M-H]1- false_p… 5.13e-17
#> 2 class ABR1~ABR5~ABR6~BD21 p130.04956 false_p… 1.92e-13
#> 3 class ABR1~ABR5~ABR6~BD21 n176.93581 CH3O6P [M+Cl]1- false_p… 2.65e-12
#> 4 class ABR1~ABR5~ABR6~BD21 n295.10519 false_p… 2.65e-12
#> 5 class ABR1~ABR5~ABR6~BD21 n371.10074 false_p… 2.65e-12
#> 6 class ABR1~ABR5~ABR6~BD21 n447.09634 C18H24O11S [M-H]1- false_p… 3.43e-11
#> 7 class ABR1~ABR5~ABR6~BD21 n385.11682 false_p… 4.15e-10
#> 8 class ABR1~ABR5~ABR6~BD21 n439.08383 C26H16O7 [M-H]1- false_p… 4.15e-10
#> 9 class ABR1~ABR5~ABR6~BD21 n88.98757 C2H2O4 [M-H]1- false_p… 4.15e-10
#> 10 class ABR1~ABR5~ABR6~BD21 n101.02399 false_p… 4.66e- 9
#> # ℹ 143 more rows
## Access the FELLA.USER functional enrichment object
enrichmentResults(enrichment_results)
#> $`class_ABR1~ABR5~ABR6~BD21`
#> Compounds in the input: 41
#> [1] "C00042" "C02170" "C00009" "C01620" "C01454" "C03765" "C06224" "C07085"
#> [9] "C07086" "C07211" "C07215" "C10700" "C00168" "C00383" "C01146" "C09315"
#> [17] "C00493" "C04236" "C16588" "C17696" "C01179" "C01197" "C05350" "C12623"
#> [25] "C00257" "C00514" "C00800" "C00817" "C00880" "C15930" "C05533" "C01750"
#> [33] "C03951" "C12249" "C12626" "C16409" "C00209" "C03758" "C16666" "C06181"
#> [41] "C21525"
#> Background compounds: 117
#> -----------------------------
#> Hypergeometric test: ready.
#> Top 15 p-values:
#> bdi00010 bdi00020 bdi00030 bdi00040 bdi00051 bdi00052 bdi00053 bdi00061
#> 1 1 1 1 1 1 1 1
#> bdi00062 bdi00071 bdi00073 bdi00100 bdi00130 bdi00190 bdi00195
#> 1 1 1 1 1 1 1
#>
#> -----------------------------
#> Heat diffusion: not performed
#> -----------------------------
#> PageRank: not performed
## Extract a table of enrichment results
generateResultsTable(enrichment_results)
#> Writing hypergeom results...
#> No pathway is below the p-value threshold.
#> # A tibble: 0 × 1
#> # ℹ 1 variable: comparison <chr>