gsFisherTestCore: The core algorithm to perform Fisher's exact test on a gene...

View source: R/fisher.R

gsFisherTestCoreR Documentation

The core algorithm to perform Fisher's exact test on a gene set

Description

The core algorithm to perform Fisher's exact test on a gene set

Usage

gsFisherTestCore(
  genes,
  geneSetGenes,
  universe,
  makeUniqueNonNA = TRUE,
  checkUniverse = TRUE,
  useEASE = FALSE
)

Arguments

genes

Character vector, a collection of genes of which over-representation of the gene set is tested

geneSetGenes

Character vector, genes belonging to a gene set

universe

Character vector, universe of genes

makeUniqueNonNA

Logical, whether genes, geneSetGenes, and universe should be filtered to remove NA and made unique. The default is set to TRUE. When the uniqueness and absence of NA is ensured, this flag can be set to FALSE to accelerate the operation.

checkUniverse

Logical, if TRUE, then genes that are in genes but are not in universe are appended to universe

useEASE

Logical, whether to use the EASE method to report the p-value.

This function performs one-sided Fisher's exact test to test the over-representation of the genes given as geneSetGenes in the input genes list.

If useEASE is TRUE, one gene is penalized (removed) within geneSetGenes that are in genes and calculating the resulting Fisher exact probability for that namespace. The theoretical basis of the EASE score lies in the concept of jackknifing a probability. See Hosack et al. for details.

Value

A list of three elements

  1. p The p-value of one-sided (over-representation of the Fisher's test)

  2. gsEffectiveSize Gene-set's effective size, namely number of genes that are in the universe

  3. hits Character vector, genes that are found in the gene sets

References

Hosack et al.

Hosack, Douglas A., Glynn Dennis, Brad T. Sherman, H. Clifford Lane, and Richard A. Lempicki. Identifying Biological Themes within Lists of Genes with EASE. Genome Biology 4 (2003): R70. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1186/gb-2003-4-10-r70")}

Examples

myGenes <- LETTERS[1:3]
myGeneSet1 <- LETTERS[1:6]
myGeneSet2 <- LETTERS[4:7]
myUniverse <- LETTERS
gsFisherTestCore(myGenes, myGeneSet1, myUniverse)
gsFisherTestCore(myGenes, myGeneSet2, myUniverse)

## use EASE for conservative estimating
gsFisherTestCore(myGenes, myGeneSet1, myUniverse, useEASE=FALSE)
gsFisherTestCore(myGenes, myGeneSet1, myUniverse, useEASE=TRUE)

## checkUniverse will make sure that \code{univese} contains all element in \code{genes}
gsFisherTestCore(c("OutOfUniverse", myGenes), myGeneSet1, myUniverse, checkUniverse=FALSE)
gsFisherTestCore(c("OutOfUniverse", myGenes), myGeneSet1, myUniverse, checkUniverse=TRUE)

bedapub/ribiosGSEA documentation built on March 30, 2023, 3:26 p.m.