This function performs fast gene set enrichment analysis (fGSEA) on the results of a random-effects model meta-analysis. Three ranking strategies are supported: by summary fold-change, by signed significance, or by a weighted combination of both. Gene sets can be provided directly or downloaded automatically from MSigDB via msigdbr.

enrichment_mv(
  remres,
  pathways = NULL,
  species = "Homo sapiens",
  category = "C5",
  subcategory = NULL,
  ranking = "fc",
  minSize = 15,
  maxSize = 500,
  nPermSimple = 10000,
  plot_top_n = 30,
  plot_padj = 0.1,
  clean_pathway_names = TRUE,
  colors = c(down = "#083e46", up = "#811820"),
  plot_title = NULL,
  seed = 42
)

Arguments

remres

MetaVolcano object. Output of the rem_mv() function <MetaVolcano>

pathways

named list of gene sets (character vectors). If NULL, gene sets are automatically downloaded via msigdbr using species, category, and subcategory parameters

species

species name for msigdbr. Default "Homo sapiens"

category

MSigDB category: "H" (hallmarks), "C2" (curated), "C5" (GO), "C7" (immunologic), etc. Default "C5"

subcategory

optional MSigDB subcategory: "GO:BP", "GO:CC", "GO:MF", "CP:KEGG", "CP:REACTOME", etc. Default NULL (all)

ranking

method for ranking genes: "fc" uses the REM summary fold-change; "signed_p" uses -log10(p) * sign(FC); "weighted_fc" uses FC * -log10(p) <string>

minSize

minimum gene set size to test <integer>

maxSize

maximum gene set size to test <integer>

nPermSimple

number of permutations for p-value estimation <integer>

plot_top_n

number of top pathways to plot <integer>

plot_padj

adjusted p-value threshold for plotting. Default 0.1

clean_pathway_names

logical. If TRUE, removes database prefixes (e.g. GOBP_, KEGG_) and replaces underscores with spaces. Default TRUE

colors

vector of 2 colors for the plot c(down, up)

plot_title

custom plot title. If NULL, auto-generated

seed

random seed for reproducibility <integer>

Value

list with two elements: result (data.frame with fGSEA results) and plot (ggplot2 lollipop plot)

Examples

if (FALSE) { # \dontrun{
data(diffexplist)
mv <- rem_mv(diffexplist, metathr = 0.01)

# Using automatic MSigDB download (GO Biological Process)
enrich <- enrichment_mv(mv, subcategory = "GO:BP")
enrich$plot

# Using Hallmarks
enrich <- enrichment_mv(mv, category = "H")

# Using KEGG
enrich <- enrichment_mv(mv, category = "C2", subcategory = "CP:KEGG")

# Using custom pathways
library(msigdbr)
my_paths <- split(
    msigdbr(species = "Homo sapiens", category = "C5")$gene_symbol,
    msigdbr(species = "Homo sapiens", category = "C5")$gs_name
)
enrich <- enrichment_mv(mv, pathways = my_paths)
head(enrich$result)
} # }