Find Pathway Enrichments

find_pathway_enrichments(
  mzroll_list,
  regression_significance,
  pathway_list,
  enrichment_method = "gsea",
  ranking_measure = "statistic",
  fdr_cutoff = 0.1,
  test_absolute_effects = TRUE,
  additional_grouping_vars = NULL
)

Arguments

mzroll_list

output of process_mzroll or process_mzroll_multi

  • features: one row per unique analyte (defined by a unique groupId),

  • samples: one row per unique sample (defined by a unique sampleId),

  • measurements: one row per peak (samples x peakgroups)

regression_significance

returned by diffex_mzroll; a tibble of tests performed.

pathway_list

a named list where names are pathways and entries are groupIds belonging to each pathway.

enrichment_method

method used to calculate pathway enrichments.

gsea

gene set enrichment analysis using fgsea

fisher

Fisher exact test to look for enrichment of differentially abundant metabolite among pathways.

ranking_measure

variable in regression_significance to use when calculating enrichment.

fdr_cutoff

minimum adjusted p-value to use for creating a the pathway summary plot.

test_absolute_effects

If TRUE then only consider the magnitude of test-statistics when calculating rankings for enrichment; if FALSE then consider sign as well.

additional_grouping_vars

sample-, or measurement-level variables to groupby when performing regression in addition to groupId.

Value

a list containing:

  • enrichment_table: a tibble containing each term's enrichment for every pathway and an enrichment_plot

  • enrichment_plots: pre-generated plots containing the most significant enrichments for each term

Examples

#> #> Attaching package: ‘dplyr’
#> The following objects are masked from ‘package:stats’: #> #> filter, lag
#> The following objects are masked from ‘package:base’: #> #> intersect, setdiff, setequal, union
regression_significance <- diffex_mzroll( nplug_mzroll_normalized, "normalized_log2_abundance", "limitation + limitation:DR + 0" )
#> Warning: q-value calculation initially failed due to too many small p-values #> but claman was able to recover results
pathway_nest <- nplug_mzroll_normalized$features %>% dplyr::select(groupId, pathway) %>% tidyr::nest(pathway_members = groupId) pathway_list <- purrr::map( pathway_nest$pathway_members, function(x) { as.character(x$groupId) } ) names(pathway_list) <- pathway_nest$pathway find_pathway_enrichments( mzroll_list = nplug_mzroll_normalized, regression_significance, pathway_list, test_absolute_effects = FALSE, enrichment_method = "fisher" )
#> # A tibble: 100 × 9 #> term pathway estimate p.value conf.low conf.high method alternative qvalue #> <chr> <chr> <dbl> <dbl> <dbl> <dbl> <chr> <chr> <dbl> #> 1 limit… Pentos… 3.85 0.174 0.585 Inf Fisher… greater 0.758 #> 2 limit… Pyrimi… 2.04 0.228 0.588 Inf Fisher… greater 0.758 #> 3 limit… Glycol… 2.49 0.207 0.582 Inf Fisher… greater 0.758 #> 4 limit… Lipid … 0.250 0.963 0.00837 Inf Fisher… greater 0.963 #> 5 limit… TCA cy… 0.380 0.961 0.0903 Inf Fisher… greater 0.963 #> 6 limit… Purine… 0.472 0.939 0.142 Inf Fisher… greater 0.963 #> 7 limit… Energe… 1.22 0.541 0.316 Inf Fisher… greater 0.963 #> 8 limit… Amino … 1.41 0.376 0.496 Inf Fisher… greater 0.940 #> 9 limit… Amino … 0.691 0.823 0.210 Inf Fisher… greater 0.963 #> 10 limit… Amino … 0.618 0.855 0.155 Inf Fisher… greater 0.963 #> # … with 90 more rows