buildEnrichTable: Creates a 2x2 enrichment contingency table from two gene...

View source: R/buildEnrichTable.R

buildEnrichTableR Documentation

Creates a 2x2 enrichment contingency table from two gene lists, or all pairwise contingency tables for a "list" of gene lists.

Description

Creates a 2x2 enrichment contingency table from two gene lists, or all pairwise contingency tables for a "list" of gene lists.

Usage

buildEnrichTable(x, ...)

## Default S3 method:
buildEnrichTable(
  x,
  y,
  listNames = c("gene.list1", "gene.list2"),
  check.table = TRUE,
  geneUniverse,
  orgPackg,
  onto,
  GOLevel,
  restricted = FALSE,
  pAdjustMeth = "BH",
  pvalCutoff = 0.01,
  qvalCutoff = 0.05,
  ...
)

## S3 method for class 'character'
buildEnrichTable(
  x,
  y,
  listNames = c("gene.list1", "gene.list2"),
  check.table = TRUE,
  geneUniverse,
  orgPackg,
  onto,
  GOLevel,
  restricted = FALSE,
  pAdjustMeth = "BH",
  pvalCutoff = 0.01,
  qvalCutoff = 0.05,
  ...
)

## S3 method for class 'list'
buildEnrichTable(
  x,
  check.table = TRUE,
  geneUniverse,
  orgPackg,
  onto,
  GOLevel,
  restricted = FALSE,
  pAdjustMeth = "BH",
  pvalCutoff = 0.01,
  qvalCutoff = 0.05,
  parallel = FALSE,
  nOfCores = min(detectCores() - 1, length(x) - 1),
  ...
)

Arguments

x

either an object of class "character" (or coerzable to "character") representing a vector of gene identifiers or an object of class "list". In this second case, each element of the list must be a "character" vector of gene identifiers. Then, all pairwise contingency tables between these gene lists are built.

...

Additional parameters for internal use (not used for the moment)

y

an object of class "character" (or coerzable to "character") representing a vector of gene identifiers.

listNames

a character(2) with the gene lists names originating the cross-tabulated enrichment frequencies.

check.table

Logical The resulting table must be checked. Defaults to TRUE.

geneUniverse

character vector containing all genes from where geneLists have been extracted.

orgPackg

A string with the name of the annotation package.

onto

string describing the ontology. Either "BP", "MF" or "CC".

GOLevel

An integer, the GO ontology level.

restricted

Logical variable to decide how tabulation of GOIDs is performed. Defaults to FALSE. See the details section.

pAdjustMeth

string describing the adjust method, either "BH", "BY" or "Bonf", defaults to 'BH'.

pvalCutoff

A numeric value. Defaults to 0.01.

qvalCutoff

A numeric value. Defaults to 0.05.

parallel

Logical. Defaults to FALSE but put it at TRUE for parallel computation.

nOfCores

Number of cores for parallel computations. Only in "list" interface.

Details

Unrestricted tabulation crosses _all_ GO Terms located at the level indicated by 'GOLev' with the two GOIDs lists. Restricted tabulation crosses only terms from the selected GO level that are _common to ancestor terms of either list_. That is, if one term in the selected GO level is not an ancestor of at least one of the gene list most specific GO terms it is excluded from the GO Level's terms because it is impossible that it appears as being enriched.

Value

in the "character" interface, an object of class "table" is returned. It represents a 2x2 contingency table interpretable as the cross-tabulation of the enriched GO items in two gene lists: "Number of enriched items in list 1 (TRUE, FALSE)" x "Number of enriched items in list 2 (TRUE, FALSE)". In the "list" interface, the result is an object of class "tableList" with all pairwise tables. Class "tableList" corresponds to objects representing all mutual enrichment contingency tables generated in a pairwise fashion: Given gene lists (i.e. "character" vectors of gene identifiers) l1, l2, ..., lk, an object of class "tableList" is a list of lists of contingency tables t(i,j) generated from each pair of gene lists i and j, with the following structure:

$l2

$l2$l1$t(2,1)

$l3

$l3$l1$t(3,1), $l3$l2$t(3,2)

...

$lk

$lk$l1$t(k,1), $lk$l2$t(k,2), ..., $lk$l(k-1)t(K,k-1)

Methods (by class)

  • buildEnrichTable(default): S3 default method

  • buildEnrichTable(character): S3 method for class "character"

  • buildEnrichTable(list): S3 method for class "list"

Examples

# Gene universe:
data(humanEntrezIDs)
# Gene lists to be explored for enrichment:
data(allOncoGeneLists)
?allOncoGeneLists
# Table of mutual GO node enrichment between gene lists Vogelstein and sanger,
# for ontology MF at GO level 6 (only first 50 genes, to improve speed).
vog.VS.sang <- buildEnrichTable(allOncoGeneLists[["Vogelstein"]][seq_len(50)],
                                allOncoGeneLists[["sanger"]][seq_len(50)],
                                geneUniverse = humanEntrezIDs, orgPackg = "org.Hs.eg.db",
                                onto = "MF", GOLevel = 6, listNames = c("Vogelstein", "sanger"))
vog.VS.sang
# This is an inadequate table for Sorensen-Dice computations:
equivTestSorensen(vog.VS.sang)
# This sometimes happens, due too small gene lists or due to poor incidence
# of enrichment.
#
# In fact, the complete gene lists generate a much interesting contingency table:
# vog.VS.sang <- buildEnrichTable(allOncoGeneLists[["Vogelstein"]],
#                                 allOncoGeneLists[["sanger"]],
#                                 geneUniverse = humanEntrezIDs, orgPackg = "org.Hs.eg.db",
#                                 onto = "MF", GOLevel = 6, listNames = c("Vogelstein", "sanger"))
# vog.VS.sang
# equivTestSorensen(vog.VS.sang)

pablof1988/goSorensen documentation built on July 21, 2023, 8:38 a.m.