hyperg: Hypergeometric (gene set enrichment) tests on character...

hypergR Documentation

Hypergeometric (gene set enrichment) tests on character vectors.

Description

This function performs a hypergeometric test for over- or under-representation of significant ‘genes’ amongst those assayed in a universe of genes. It provides an interface based on character vectors of identifying member of gene sets and the gene universe.

Usage

hyperg(assayed, significant, universe,
    representation = c("over", "under"), ...)

Arguments

assayed

A vector of assayed genes (or other identifiers). assayed may be a character vector (defining a single gene set) or list of character vectors (defining a collection of gene sets).

significant

A vector of assayed genes that were differentially expressed. If assayed is a character vector, then significant must also be a character vector; likewise when assayed is a list.

universe

A character vector defining the universe of genes.

representation

Either “over” or “under”, to indicate testing for over- or under-representation, respectively, of differentially expressed genes.

...

Additional arguments, unused.

Value

When invoked with a character vector of assayed genes, a named numeric vector providing the input values, P-value, odds ratio, and expected number of significantly expressed genes.

When invoked with a list of character vectors of assayed genes, a data frame with columns of input values, P-value, odds ratio, and expected number of significantly expressed genes.

Author(s)

Martin Morgan mtmorgan@fhcrc.org with contributions from Paul Shannon.

See Also

hyperGTest for convenience functions using Bioconductor annotation resources such as GO.db.

Examples

set.seed(123)

## artifical sets -- affy probes grouped by protein family
library(hgu95av2.db)
map <- select(hgu95av2.db, keys(hgu95av2.db), "PFAM")
sets <- Filter(function(x) length(x) >= 10, split(map$PROBEID, map$PFAM))

universe <- unlist(sets, use.names=FALSE)
siggenes <- sample(universe, length(universe) / 20)  ## simulate
sigsets <- Map(function(x, y) x[x %in% y], sets, MoreArgs=list(y=siggenes))

result <- hyperg(sets, sigsets, universe)
head(result)

Bioconductor/Category documentation built on Oct. 29, 2023, 4:15 p.m.