fisher_enrichment: Fisher Exact Test of gene set enrichment with output to Excel

View source: R/fisher_enrichment.R

fisher_enrichmentR Documentation

Fisher Exact Test of gene set enrichment with output to Excel

Description

Test enrichment of one or more vectors of significant genes against the universe of genes in feat.tab per gene set using fisher.test. It returns a data frame with statistics per gene set, and can write this to Excel. The Excel file links to CSV files, which contain statistics per genes in a set.

Usage

fisher_enrichment(
  sig.set,
  G,
  feat.tab,
  name = NA,
  adjust.method = "BH",
  min.nfeats = 3,
  max.nfeats = 1000,
  pwy.nchar = 199
)

Arguments

sig.set

Named list of length one whose sole element is a vector of significant gene IDs matching rownames(feat.tab).

G

Gene set list as returned from read_gmt.

feat.tab

Table of feature (e.g. gene) statistics that the Excel table can link to.

name

Name for the folder and Excel file that get written. Set to NA to avoid writing output.

adjust.method

Method used to adjust the p-values for multiple testing. Only for mroast.

min.nfeats

Minimum number of features (e.g. genes) needed in a gene set for testing.

max.nfeats

Maximum number of features (e.g. genes) needed in a gene set for testing.

pwy.nchar

Numeric maximum number of characters allowed in pathway name.

Details

Pathway (i.e. gene set) names are altered to be valid filenames in Windows and Linux. Numeric columns are rounded to 8 significant figures.

Value

Table of pathway statistics with the number of genes from feat.tab in the pathway, the number of these genes that are in sig.set, the p-value, and the adjusted p-value from the one-sided Fisher exact test.

Examples

 G = list(s1=list(name = "s1", description=NULL, genes=letters[3:10]), 
   s2=list(name = "s2", description=NULL, genes=letters[2:99]))
 feat.tab <- matrix(rnorm(18), ncol=3, dimnames=list(letters[1:6], paste0("col", 1:3)))
 fisher_enrichment(sig.set = list(A=letters[1:3]), G = G, feat.tab = feat.tab)

jdreyf/ezlimma documentation built on Sept. 16, 2024, 2:08 a.m.