seSorensen: Standard error of the sample Sorensen-Dice dissimilarity,...

View source: R/sesorensen.R

seSorensenR Documentation

Standard error of the sample Sorensen-Dice dissimilarity, asymptotic approach

Description

Standard error of the sample Sorensen-Dice dissimilarity, asymptotic approach

Usage

seSorensen(x, ...)

## S3 method for class 'table'
seSorensen(x, check.table = TRUE, ...)

## S3 method for class 'matrix'
seSorensen(x, check.table = TRUE, ...)

## S3 method for class 'numeric'
seSorensen(x, check.table = TRUE, ...)

## S3 method for class 'character'
seSorensen(x, y, check.table = TRUE, ...)

## S3 method for class 'list'
seSorensen(x, check.table = TRUE, ...)

## S3 method for class 'tableList'
seSorensen(x, check.table = TRUE, ...)

Arguments

x

either an object of class "table", "matrix" or "numeric" representing a 2x2 contingency table, or a "character" (a set of gene identifiers) or "list" or "tableList" object. See the details section for more information.

...

extra parameters for function buildEnrichTable.

check.table

Boolean. If TRUE (default), argument x is checked to adequately represent a 2x2 contingency table. This checking is performed by means of function nice2x2Table.

y

an object of class "character" representing a vector of gene identifiers.

Details

This function computes the standard error estimate of the sample Sorensen-Dice dissimilarity, given a 2x2 arrangement of frequencies (either implemented as a "table", a "matrix" or a "numeric" object):

n11 n10
n01 n00,

The subindex '11' corresponds to those GO items enriched in both lists, '01' to items enriched in the second list but not in the first one, '10' to items enriched in the first list but not enriched in the second one and '00' corresponds to those GO items non enriched in both gene lists, i.e., to the double negatives, a value which is ignored in the computations.

In the "numeric" interface, if length(x) >= 3, the values are interpreted as (n_{11}, n_{01}, n_{10}), always in this order.

If x is an object of class "character", then x (and y) must represent two "character" vectors of valid gene identifiers. Then the standard error for the dissimilarity between lists x and y is computed, after internally summarizing them as a 2x2 contingency table of joint enrichment. This last operation is performed by function buildEnrichTable and "valid gene identifiers" stands for the coherency of these gene identifiers with the arguments geneUniverse and orgPackg of buildEnrichTable, passed by the ellipsis argument ... in seSorensen.

In the "list" interface, the argument must be a list of "character" vectors, each one representing a gene list (character identifiers). Then, all pairwise standard errors of the dissimilarity between these gene lists are computed.

If x is an object of class "tableList", the standard error of the Sorensen-Dice dissimilarity estimate is computed over each one of these tables. Given k gene lists (i.e. "character" vectors of gene identifiers) l1, l2, ..., lk, an object of class "tableList" (typically constructed by a call to function buildEnrichTable) 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)

Value

In the "table", "matrix", "numeric" and "character" interfaces, the value of the standard error of the Sorensen-Dice dissimilarity estimate. In the "list" and "tableList" interfaces, the symmetric matrix of all standard error dissimilarity estimates.

Methods (by class)

  • seSorensen(table): S3 method for class "table"

  • seSorensen(matrix): S3 method for class "matrix"

  • seSorensen(numeric): S3 method for class "numeric"

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

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

  • seSorensen(tableList): S3 method for class "tableList"

See Also

buildEnrichTable for constructing contingency tables of mutual enrichment, nice2x2Table for checking the validity of enrichment contingency tables, dSorensen for computing the Sorensen-Dice dissimilarity, duppSorensen for the upper limit of a one-sided confidence interval of the dissimilarity, equivTestSorensen for an equivalence test.

Examples

# Gene lists 'atlas' and 'sanger' in 'Cangenes' dataset. Table of joint enrichment
# of GO items in ontology BP at level 3.
data(tab_atlas.sanger_BP3)
tab_atlas.sanger_BP3
dSorensen(tab_atlas.sanger_BP3)
seSorensen(tab_atlas.sanger_BP3)

# Contingency table as a numeric vector:
seSorensen(c(56, 1, 30, 47))
seSorensen(c(56, 1, 30))

# (These examples may be considerably time consuming due to many enrichment
# tests to build the contingency tables of mutual enrichment)
# ?pbtGeneLists
# Standard error of the sample Sorensen-Dice dissimilarity, directly from
# two gene lists, from scratch:
# seSorensen(pbtGeneLists[[2]], pbtGeneLists[[4]],
#            onto = "CC", GOLevel = 5,
#            geneUniverse = humanEntrezIDs, orgPackg = "org.Hs.eg.db")
# Essentially, the above code makes the same as:
# tab.IRITD3vsKT1 <- buildEnrichTable(pbtGeneLists[[2]], pbtGeneLists[[4]],
#                                     onto = "CC", GOLevel = 5,
#                                     geneUniverse = humanEntrezIDs, orgPackg = "org.Hs.eg.db")
# tab.IRITD3vsKT1
# seSorensen(tab.IRITD3vsKT1)

# All pairwise standard errors (quite time consuming):
# seSorensen(pbtGeneLists,
#            onto = "CC", GOLevel = 5,
#            geneUniverse = humanEntrezIDs, orgPackg = "org.Hs.eg.db")

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