enrichment: Enrichment analysis

enrichmentR Documentation

Enrichment analysis

Description

Are selected genes enriched in pathway?

Usage

enrichment(
  object,
  pathwaydt,
  fit = fits(object)[1],
  coef = coefs(object, fit = fit)[1],
  var = abstractvar(object, fit = fit, coef = coef),
  levels = fdt(object)[[var]] %>% base::levels() %>% extract(-1),
  genevar = "gene",
  genesep = "[ ,;]",
  n = 3,
  verbose = TRUE,
  genes = FALSE
)

Arguments

object

SummarizedExperiment

pathwaydt

pathway data.table

fit

string

coef

string

var

selection fvar

levels

selection levels

genevar

gene fvar

genesep

gene separator (string)

n

number

verbose

whether to msg

genes

whether to report genes

Details

Four enrichment analyses per geneset using the Fisher Exact Test (see four pvalues). Results are returned in a data.table

in : genes in pathway
in.det : detected genes in pathway
in.sel : up/downregulated genes in pathway
in.up(.genes) : upregulated genes in pathway
in.down(.genes) : downregulated genes in pathway
out : genes outside pathway
det : detected genes (in + out)
sel : up/downregulated genes (in + out)
up : upregulated genes (in + out)
down : downregulated genes (in + out)
p.coef.upDET : prob to randomly select this many (or more) upregulated genes (among detected genes)
p.coef.downDET : prob to randomly select this many (or more) downregulated genes (among detected genes)
p.coef.selDET : prob to randomly select this many (or more) up OR downregulated genes (among detected genes)
p.coef.selGEN : prob to randomly select this many (or more) up OR downregulated genes (among genome genes)
p.detGEN : prob to randomly select this many (or more) detected genes (among genome genes)

Examples

# Read
    pathwaydt <- read_msigdt(collections = 'C5:GO:BP')
    file <- system.file('extdata/atkin.somascan.adat', package = 'autonomics')
    object <- read_somascan(file, fit = 'limma', coefs = 't1-t0')
    fvars(object) %<>% gsub('EntrezGeneSymbol', 'gene', .)
    object %<>% abstract_fit()
    var <- abstractvar(object)
    varlevels <- c('flat', 'down', 'up')
    enrichdt1 <- enrichment(object, pathwaydt, var = var)                      # 2:n factor 
    enrichdt2 <- enrichment(object, pathwaydt, var = var, levels = varlevels)  # 1:n factor
    enrichdt3 <-  altenrich(object, pathwaydt)                 # alternative implementation
    cols <- intersect(names(enrichdt1), names(enrichdt3))
    all(enrichdt1[, cols, with = FALSE]  ==  enrichdt3[, cols, with = FALSE])   # identical

bhagwataditya/importomics documentation built on Oct. 29, 2024, 3:19 p.m.