Skip to contents

Accessor methods for the StructuralEnrichment S4 class.

Usage

structuralClassifications(x)

# S4 method for StructuralEnrichment
structuralClassifications(x)

# S4 method for StructuralEnrichment
explanatoryFeatures(x)

# S4 method for StructuralEnrichment
enrichmentResults(x)

Arguments

x

object of S4 class StructuralEnrichment

Value

A tibble containing the accessed information.

Examples

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

## Perform functional enrichment analysis
enrichment_results <- structuralEnrichment(
  random_forest,
  structural_classifications
)

## The m/z feature structural classifcations
structuralClassifications(enrichment_results)
#> # A tibble: 1,706 × 10
#>    feature    kingdom superclass class subclass `level 5` `level 6` `level 7`
#>    <chr>      <chr>   <chr>      <chr> <chr>    <chr>     <chr>     <chr>    
#>  1 n101.00585 Unknown NA         NA    NA       NA        NA        NA       
#>  2 n101.02399 Unknown NA         NA    NA       NA        NA        NA       
#>  3 n101.06042 Unknown NA         NA    NA       NA        NA        NA       
#>  4 n101.50757 Unknown NA         NA    NA       NA        NA        NA       
#>  5 n102.05566 Unknown NA         NA    NA       NA        NA        NA       
#>  6 n103.00333 Unknown NA         NA    NA       NA        NA        NA       
#>  7 n103.03965 Unknown NA         NA    NA       NA        NA        NA       
#>  8 n103.95837 Unknown NA         NA    NA       NA        NA        NA       
#>  9 n104.03495 Unknown NA         NA    NA       NA        NA        NA       
#> 10 n105.01896 Unknown NA         NA    NA       NA        NA        NA       
#> # ℹ 1,696 more rows
#> # ℹ 2 more variables: `level 8` <chr>, `level 9` <chr>

## Access the explanatory features used for structural enrichment analysis
explanatoryFeatures(enrichment_results)
#> # A tibble: 153 × 5
#>    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 structral enrichment analysis results
enrichmentResults(enrichment_results)
#> # A tibble: 46 × 15
#>    response comparison          level      classification Explanatory & in cla…¹
#>    <chr>    <chr>               <chr>      <chr>                           <int>
#>  1 class    ABR1~ABR5~ABR6~BD21 kingdom    Organic compo…                     41
#>  2 class    ABR1~ABR5~ABR6~BD21 superclass Benzenoids                          9
#>  3 class    ABR1~ABR5~ABR6~BD21 class      Benzene and s…                      5
#>  4 class    ABR1~ABR5~ABR6~BD21 class      Organic phosp…                      5
#>  5 class    ABR1~ABR5~ABR6~BD21 superclass Phenylpropano…                      4
#>  6 class    ABR1~ABR5~ABR6~BD21 subclass   Organic phosp…                      4
#>  7 class    ABR1~ABR5~ABR6~BD21 subclass   Non-metal pho…                      3
#>  8 class    ABR1~ABR5~ABR6~BD21 subclass   Dicarboxylic …                      4
#>  9 class    ABR1~ABR5~ABR6~BD21 class      Coumarins and…                      2
#> 10 class    ABR1~ABR5~ABR6~BD21 class      Flavonoids                          2
#> # ℹ 36 more rows
#> # ℹ abbreviated name: ¹​`Explanatory & in class`
#> # ℹ 10 more variables: `Not explanatory & in class` <int>,
#> #   `Explanatory & not in class` <int>, `Not explanatory & not in class` <int>,
#> #   estimate <dbl>, p.value <dbl>, adjusted.p.value <dbl>, conf.low <dbl>,
#> #   conf.high <dbl>, method <chr>, alternative <chr>