Back to Mac ARM64 build report for BioC 3.17
ABCDEF[G]HIJKLMNOPQRSTUVWXYZ

This page was generated on 2023-10-20 09:38:03 -0400 (Fri, 20 Oct 2023).

HostnameOSArch (*)R versionInstalled pkgs
kjohnson2macOS 12.6.1 Montereyarm644.3.1 (2023-06-16) -- "Beagle Scouts" 4347
Click on any hostname to see more info about the system (e.g. compilers)      (*) as reported by 'uname -p', except on Windows and Mac OS X

Package 864/2230HostnameOS / ArchINSTALLBUILDCHECKBUILD BIN
goSorensen 1.2.0  (landing page)
Pablo Flores
Snapshot Date: 2023-10-15 14:00:07 -0400 (Sun, 15 Oct 2023)
git_url: https://git.bioconductor.org/packages/goSorensen
git_branch: RELEASE_3_17
git_last_commit: 93b7162
git_last_commit_date: 2023-04-25 11:39:26 -0400 (Tue, 25 Apr 2023)
kjohnson2macOS 12.6.1 Monterey / arm64  OK    OK    OK    OK  UNNEEDED, same version is already published

CHECK results for goSorensen on kjohnson2


To the developers/maintainers of the goSorensen package:
- Use the following Renviron settings to reproduce errors and warnings.
- If 'R CMD check' started to fail recently on the Linux builder(s) over a missing dependency, add the missing dependency to 'Suggests:' in your DESCRIPTION file. See Renviron.bioc for more information.

raw results


Summary

Package: goSorensen
Version: 1.2.0
Command: /Library/Frameworks/R.framework/Resources/bin/R CMD check --install=check:goSorensen.install-out.txt --library=/Library/Frameworks/R.framework/Resources/library --no-vignettes --timings goSorensen_1.2.0.tar.gz
StartedAt: 2023-10-17 23:02:40 -0400 (Tue, 17 Oct 2023)
EndedAt: 2023-10-17 23:20:50 -0400 (Tue, 17 Oct 2023)
EllapsedTime: 1089.7 seconds
RetCode: 0
Status:   OK  
CheckDir: goSorensen.Rcheck
Warnings: 0

Command output

##############################################################################
##############################################################################
###
### Running command:
###
###   /Library/Frameworks/R.framework/Resources/bin/R CMD check --install=check:goSorensen.install-out.txt --library=/Library/Frameworks/R.framework/Resources/library --no-vignettes --timings goSorensen_1.2.0.tar.gz
###
##############################################################################
##############################################################################


* using log directory ‘/Users/biocbuild/bbs-3.17-bioc-mac-arm64/meat/goSorensen.Rcheck’
* using R version 4.3.1 (2023-06-16)
* using platform: aarch64-apple-darwin20 (64-bit)
* R was compiled by
    Apple clang version 14.0.0 (clang-1400.0.29.202)
    GNU Fortran (GCC) 12.2.0
* running under: macOS Monterey 12.6.7
* using session charset: UTF-8
* using option ‘--no-vignettes’
* checking for file ‘goSorensen/DESCRIPTION’ ... OK
* checking extension type ... Package
* this is package ‘goSorensen’ version ‘1.2.0’
* package encoding: UTF-8
* checking package namespace information ... OK
* checking package dependencies ... OK
* checking if this is a source package ... OK
* checking if there is a namespace ... OK
* checking for hidden files and directories ... OK
* checking for portable file names ... OK
* checking for sufficient/correct file permissions ... OK
* checking whether package ‘goSorensen’ can be installed ... OK
* checking installed package size ... OK
* checking package directory ... OK
* checking ‘build’ directory ... OK
* checking DESCRIPTION meta-information ... OK
* checking top-level files ... OK
* checking for left-over files ... OK
* checking index information ... OK
* checking package subdirectories ... OK
* checking R files for non-ASCII characters ... OK
* checking R files for syntax errors ... OK
* checking whether the package can be loaded ... OK
* checking whether the package can be loaded with stated dependencies ... OK
* checking whether the package can be unloaded cleanly ... OK
* checking whether the namespace can be loaded with stated dependencies ... OK
* checking whether the namespace can be unloaded cleanly ... OK
* checking dependencies in R code ... OK
* checking S3 generic/method consistency ... OK
* checking replacement functions ... OK
* checking foreign function calls ... OK
* checking R code for possible problems ... OK
* checking Rd files ... OK
* checking Rd metadata ... OK
* checking Rd cross-references ... OK
* checking for missing documentation entries ... OK
* checking for code/documentation mismatches ... OK
* checking Rd \usage sections ... OK
* checking Rd contents ... OK
* checking for unstated dependencies in examples ... OK
* checking contents of ‘data’ directory ... OK
* checking data for non-ASCII characters ... OK
* checking data for ASCII and uncompressed saves ... OK
* checking files in ‘vignettes’ ... OK
* checking examples ... OK
Examples with CPU (user + system) or elapsed time > 5s
                  user system elapsed
buildEnrichTable 20.63  1.793  34.399
* checking for unstated dependencies in ‘tests’ ... OK
* checking tests ...
  Running ‘test_gosorensen_funcs.R’
  Running ‘test_nonsense_genes.R’
 OK
* checking for unstated dependencies in vignettes ... OK
* checking package vignettes in ‘inst/doc’ ... OK
* checking running R code from vignettes ... SKIPPED
* checking re-building of vignette outputs ... SKIPPED
* checking PDF version of manual ... OK
* DONE

Status: OK


Installation output

goSorensen.Rcheck/00install.out

##############################################################################
##############################################################################
###
### Running command:
###
###   /Library/Frameworks/R.framework/Resources/bin/R CMD INSTALL goSorensen
###
##############################################################################
##############################################################################


* installing to library ‘/Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/library’
* installing *source* package ‘goSorensen’ ...
** using staged installation
** R
** data
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded from temporary location
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (goSorensen)

Tests output

goSorensen.Rcheck/tests/test_gosorensen_funcs.Rout


R version 4.3.1 (2023-06-16) -- "Beagle Scouts"
Copyright (C) 2023 The R Foundation for Statistical Computing
Platform: aarch64-apple-darwin20 (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(goSorensen)



Attaching package: 'goSorensen'

The following object is masked from 'package:utils':

    upgrade

> 
> # A contingency table of GO terms mutual enrichment
> # between gene lists "atlas" and "sanger":
> data(tab_atlas.sanger_BP3)
> tab_atlas.sanger_BP3
                 Enriched in sanger
Enriched in atlas TRUE FALSE
            TRUE    56    30
            FALSE    1   471
> ?tab_atlas.sanger_BP3
tab_atlas.sanger_BP3        package:goSorensen         R Documentation

_C_r_o_s_s-_t_a_b_u_l_a_t_i_o_n _o_f _e_n_r_i_c_h_e_d _G_O _i_t_e_m_s _a_t _l_e_v_e_l _3 _o_f _o_n_t_o_l_o_g_y _B_P _i_n _t_w_o
_g_e_n_e _l_i_s_t_s

_D_e_s_c_r_i_p_t_i_o_n:

     From the "Cancer gene list" of Bushman Lab, a collection of gene
     lists related with cancer, for gene lists "Atlas" and "Sanger",
     this dataset is the cross-tabulation of all GO items of ontology
     BP at level 3 which are: Enriched in both lists, enriched in
     sanger but not in atlas, non-enriched in sanger but enriched in
     atlas and non-enriched in both lists. Take it just as an
     illustrative example, non up-to-date for changes in the gene lists
     or changes in the GO.

_U_s_a_g_e:

     data(tab_atlas.sanger_BP3)
     
_F_o_r_m_a_t:

     An object of class "table" representing a 2x2 contingency table.

_S_o_u_r_c_e:

     <http://www.bushmanlab.org/links/genelists>


> class(tab_atlas.sanger_BP3)
[1] "table"
> 
> # Sorensen-Dice dissimilarity on this contingency table:
> ?dSorensen
dSorensen              package:goSorensen              R Documentation

_C_o_m_p_u_t_a_t_i_o_n _o_f _t_h_e _S_o_r_e_n_s_e_n-_D_i_c_e _d_i_s_s_i_m_i_l_a_r_i_t_y

_D_e_s_c_r_i_p_t_i_o_n:

     Computation of the Sorensen-Dice dissimilarity

_U_s_a_g_e:

     dSorensen(x, ...)
     
     ## S3 method for class 'table'
     dSorensen(x, check.table = TRUE, ...)
     
     ## S3 method for class 'matrix'
     dSorensen(x, check.table = TRUE, ...)
     
     ## S3 method for class 'numeric'
     dSorensen(x, check.table = TRUE, ...)
     
     ## S3 method for class 'character'
     dSorensen(x, y, check.table = TRUE, ...)
     
     ## S3 method for class 'list'
     dSorensen(x, check.table = TRUE, ...)
     
     ## S3 method for class 'tableList'
     dSorensen(x, check.table = TRUE, ...)
     
_A_r_g_u_m_e_n_t_s:

       x: either an object of class "table", "matrix" or "numeric"
          representing a 2x2 contingency table, or a "character" vector
          (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, by means of
          function 'nice2x2Table'.

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

_D_e_t_a_i_l_s:

     Given a 2x2 arrangement of frequencies (either implemented as a
     "table", a "matrix" or a "numeric" object):

       n11   n01 
       n10  n00, 
      
     this function computes the Sorensen-Dice dissimilarity

                    {n_10 + n_01}/{2 n_11 + n_10 + n_01}.               
     
     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, n_00), always in this order and discarding
     extra values if necessary. The result is correct, regardless the
     frequencies being absolute or relative.

     If 'x' is an object of class "character", then 'x' (and 'y') must
     represent two "character" vectors of valid gene identifiers. Then
     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 'dSorensen'.

     If 'x' is an object of class "list", the argument must be a list
     of "character" vectors, each one representing a gene list
     (character identifiers). Then, all pairwise dissimilarities
     between these gene lists are computed.

     If 'x' is an object of class "tableList", the Sorensen-Dice
     dissimilarity 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)

_V_a_l_u_e:

     In the "table", "matrix", "numeric" and "character" interfaces,
     the value of the Sorensen-Dice dissimilarity. In the "list" and
     "tableList" interfaces, the symmetric matrix of all pairwise
     Sorensen-Dice dissimilarities.

_M_e_t_h_o_d_s (_b_y _c_l_a_s_s):

        • 'table': S3 method for class "table"

        • 'matrix': S3 method for class "matrix"

        • 'numeric': S3 method for class "numeric"

        • 'character': S3 method for class "character"

        • 'list': S3 method for class "list"

        • 'tableList': S3 method for class "tableList"

_S_e_e _A_l_s_o:

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

_E_x_a_m_p_l_e_s:

     # Gene lists 'atlas' and 'sanger' in 'allOncoGeneLists' dataset. Table of joint enrichment
     # of GO items in ontology BP at level 3.
     data(tab_atlas.sanger_BP3)
     tab_atlas.sanger_BP3
     ?tab_atlas.sanger_BP3
     dSorensen(tab_atlas.sanger_BP3)
     
     # Table represented as a vector:
     conti4 <- c(56, 1, 30, 471)
     dSorensen(conti4)
     # or as a plain matrix:
     dSorensen(matrix(conti4, nrow = 2))
     
     # This function is also appropriate for proportions:
     dSorensen(conti4 / sum(conti4))
     
     conti3 <- c(56, 1, 30)
     dSorensen(conti3)
     
     # Sorensen-Dice dissimilarity from scratch, directly from two gene lists:
     # (These examples may be considerably time consuming due to many enrichment
     # tests to build the contingency tables of mutual enrichment)
     # data(pbtGeneLists)
     # ?pbtGeneLists
     # data(humanEntrezIDs)
     # (Time consuming, building the table requires many enrichment tests:)
     # dSorensen(pbtGeneLists[[2]], pbtGeneLists[[4]],
     #           onto = "CC", GOLevel = 3,
     #           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 = 3,
     #                                     geneUniverse = humanEntrezIDs, orgPackg = "org.Hs.eg.db")
     # dSorensen(tab.IRITD3vsKT1)
     # (Quite time consuming, all pairwise dissimilarities:)
     # dSorensen(pbtGeneLists,
     #           onto = "CC", GOLevel = 3,
     #           geneUniverse = humanEntrezIDs, orgPackg = "org.Hs.eg.db")
     

> dSorensen(tab_atlas.sanger_BP3)
[1] 0.2167832
> 
> # Standard error of this Sorensen-Dice dissimilarity estimate:
> ?seSorensen
seSorensen             package:goSorensen              R Documentation

_S_t_a_n_d_a_r_d _e_r_r_o_r _o_f _t_h_e _s_a_m_p_l_e _S_o_r_e_n_s_e_n-_D_i_c_e _d_i_s_s_i_m_i_l_a_r_i_t_y, _a_s_y_m_p_t_o_t_i_c
_a_p_p_r_o_a_c_h

_D_e_s_c_r_i_p_t_i_o_n:

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

_U_s_a_g_e:

     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, ...)
     
_A_r_g_u_m_e_n_t_s:

       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.

_D_e_t_a_i_l_s:

     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)

_V_a_l_u_e:

     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.

_M_e_t_h_o_d_s (_b_y _c_l_a_s_s):

        • 'table': S3 method for class "table"

        • 'matrix': S3 method for class "matrix"

        • 'numeric': S3 method for class "numeric"

        • 'character': S3 method for class "character"

        • 'list': S3 method for class "list"

        • 'tableList': S3 method for class "tableList"

_S_e_e _A_l_s_o:

     '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.

_E_x_a_m_p_l_e_s:

     # 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")
     

> seSorensen(tab_atlas.sanger_BP3)
[1] 0.03822987
> 
> # Upper 95% confidence limit for the Sorensen-Dice dissimilarity:
> ?duppSorensen
duppSorensen            package:goSorensen             R Documentation

_U_p_p_e_r _l_i_m_i_t _o_f _a _o_n_e-_s_i_d_e_d _c_o_n_f_i_d_e_n_c_e _i_n_t_e_r_v_a_l (_0, _d_U_p_p] _f_o_r _t_h_e
_S_o_r_e_n_s_e_n-_D_i_c_e _d_i_s_s_i_m_i_l_a_r_i_t_y

_D_e_s_c_r_i_p_t_i_o_n:

     Upper limit of a one-sided confidence interval (0, dUpp] for the
     Sorensen-Dice dissimilarity

_U_s_a_g_e:

     duppSorensen(x, ...)
     
     ## S3 method for class 'table'
     duppSorensen(
       x,
       dis = dSorensen.table(x, check.table = FALSE),
       se = seSorensen.table(x, check.table = FALSE),
       conf.level = 0.95,
       z.conf.level = qnorm(1 - conf.level),
       boot = FALSE,
       nboot = 10000,
       check.table = TRUE,
       ...
     )
     
     ## S3 method for class 'matrix'
     duppSorensen(
       x,
       dis = dSorensen.matrix(x, check.table = FALSE),
       se = seSorensen.matrix(x, check.table = FALSE),
       conf.level = 0.95,
       z.conf.level = qnorm(1 - conf.level),
       boot = FALSE,
       nboot = 10000,
       check.table = TRUE,
       ...
     )
     
     ## S3 method for class 'numeric'
     duppSorensen(
       x,
       dis = dSorensen.numeric(x, check.table = FALSE),
       se = seSorensen.numeric(x, check.table = FALSE),
       conf.level = 0.95,
       z.conf.level = qnorm(1 - conf.level),
       boot = FALSE,
       nboot = 10000,
       check.table = TRUE,
       ...
     )
     
     ## S3 method for class 'character'
     duppSorensen(
       x,
       y,
       conf.level = 0.95,
       boot = FALSE,
       nboot = 10000,
       check.table = TRUE,
       ...
     )
     
     ## S3 method for class 'list'
     duppSorensen(
       x,
       conf.level = 0.95,
       boot = FALSE,
       nboot = 10000,
       check.table = TRUE,
       ...
     )
     
     ## S3 method for class 'tableList'
     duppSorensen(
       x,
       conf.level = 0.95,
       boot = FALSE,
       nboot = 10000,
       check.table = TRUE,
       ...
     )
     
_A_r_g_u_m_e_n_t_s:

       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.

     ...: additional arguments for function 'buildEnrichTable'.

     dis: Sorensen-Dice dissimilarity value. Only required to speed
          computations if this value is known in advance.

      se: standard error estimate of the sample dissimilarity. Only
          required to speed computations if this value is known in
          advance.

conf.level: confidence level of the one-sided confidence interval, a
          numeric value between 0 and 1.

z.conf.level: standard normal (or bootstrap, see arguments below)
          distribution quantile at the '1 - conf.level' value. Only
          required to speed computations if this value is known in
          advance. Then, the argument 'conf.level' is ignored.

    boot: boolean. If TRUE, 'z.conf.level' is computed by means of a
          bootstrap approach instead of the asymptotic normal approach.
          Defaults to FALSE.

   nboot: numeric, number of initially planned bootstrap replicates.
          Ignored if 'boot == FALSE'. Defaults to 10000.

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.

_D_e_t_a_i_l_s:

     This function computes the upper limit of a one-sided confidence
     interval for the Sorensen-Dice dissimilarity, given a 2x2
     arrangement of frequencies (either implemented as a "table", a
     "matrix" or a "numeric" object):

       n11   n01 
       n10  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, except if 'boot ==
     TRUE'.

     In the "numeric" interface, if 'length(x) >= 4', the values are
     interpreted as

     (n_11, n_01, n_10, n_00), always in this order and discarding
     extra values if necessary.

     Arguments 'dis', 'se' and 'z.conf.level' are not required. If
     known in advance (e.g., as a consequence of previous computations
     with the same data), providing its value may speed the
     computations.

     By default, 'z.conf.level' corresponds to the 1 - conf.level
     quantile of a standard normal N(0,1) distribution, as the
     studentized statistic (^d - d) / ^se) is asymptotically N(0,1). In
     the studentized statistic, d stands for the "true" Sorensen-Dice
     dissimilarity, ^d to its sample estimate and ^se for the estimate
     of its standard error. In fact, the normal is its limiting
     distribution but, for finite samples, the true sampling
     distribution may present departures from normality (mainly with
     some inflation in the left tail). The bootstrap method provides a
     better approximation to the true sampling distribution. In the
     bootstrap approach, 'nboot' new bootstrap contingency tables are
     generated from a multinomial distribution with parameters 'size ='
     n11 + n01 + n10 + n00 and probabilities %. Sometimes, some of
     these generated tables may present so low frequencies of
     enrichment that make them unable for Sorensen-Dice computations.
     As a consequence, the number of effective bootstrap samples may be
     lower than the number of initially planned bootstrap samples
     'nboot'. Computing in advance the value of argument 'z.conf.level'
     may be a way to cope with these departures from normality, by
     means of a more adequate quantile function. Alternatively, if
     'boot == TRUE', a bootstrap quantile is internally computed.

     If 'x' is an object of class "character", then 'x' (and 'y') must
     represent two "character" vectors of valid gene identifiers. Then
     the confidence interval 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
     'dUppSorensen'.

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

     In the "tableList" interface, the upper limits are computed over
     each one of these tables. Given 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)

_V_a_l_u_e:

     In the "table", "matrix", "numeric" and "character" interfaces,
     the value of the Upper limit of the confidence interval for the
     Sorensen-Dice dissimilarity. When 'boot == TRUE', this result also
     haves a an extra attribute: "eff.nboot" which corresponds to the
     number of effective bootstrap replicats, see the details section.
     In the "list" and "tableList" interfaces, the result is the
     symmetric matrix of all pairwise upper limits.

_M_e_t_h_o_d_s (_b_y _c_l_a_s_s):

        • 'table': S3 method for class "table"

        • 'matrix': S3 method for class "matrix"

        • 'numeric': S3 method for class "numeric"

        • 'character': S3 method for class "character"

        • 'list': S3 method for class "list"

        • 'tableList': S3 method for class "tableList"

_S_e_e _A_l_s_o:

     'buildEnrichTable' for constructing contingency tables of mutual
     enrichment, 'nice2x2Table' for checking contingency tables
     validity, 'dSorensen' for computing the Sorensen-Dice
     dissimilarity, 'seSorensen' for computing the standard error of
     the dissimilarity, 'equivTestSorensen' for an equivalence test.

_E_x_a_m_p_l_e_s:

     # 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
     duppSorensen(tab_atlas.sanger_BP3)
     dSorensen(tab_atlas.sanger_BP3) + qnorm(0.95) * seSorensen(tab_atlas.sanger_BP3)
     # Using the bootstrap approximation instead of the normal approximation to
     # the sampling distribution of (^d - d) / se(^d):
     duppSorensen(tab_atlas.sanger_BP3, boot = TRUE)
     
     # Contingency table as a numeric vector:
     duppSorensen(c(56, 1, 30, 47))
     duppSorensen(c(56, 1, 30))
     
     # Upper confidence limit for the Sorensen-Dice dissimilarity, from scratch,
     # directly from two gene lists:
     # (These examples may be considerably time consuming due to many enrichment
     # tests to build the contingency tables of mutual enrichment)
     # data(pbtGeneLists)
     # ?pbtGeneLists
     # data(humanEntrezIDs)
     # duppSorensen(pbtGeneLists[[2]], pbtGeneLists[[4]],
     #              onto = "CC", GOLevel = 5,
     #              geneUniverse = humanEntrezIDs, orgPackg = "org.Hs.eg.db")
     # Even more time consuming (all pairwise values):
     # duppSorensen(pbtGeneLists,
     #              onto = "CC", GOLevel = 5,
     #              geneUniverse = humanEntrezIDs, orgPackg = "org.Hs.eg.db")
     

> duppSorensen(tab_atlas.sanger_BP3)
[1] 0.2796658
> # This confidence limit is based on an assimptotic normal N(0,1)
> # approximation to the distribution of (dSampl - d) / se, where
> # dSampl stands for the sample dissimilarity, d for the true dissimilarity
> # and se for the sample dissimilarity standard error estimate.
> 
> # Upper confidence limit but using a Student's t instead of a N(0,1)
> # (just as an example, not recommended -no theoretical justification)
> df <- sum(tab_atlas.sanger_BP3[1:3]) - 2
> duppSorensen(tab_atlas.sanger_BP3, z.conf.level = qt(1 - 0.95, df))
[1] 0.2803587
> 
> # Upper confidence limit but using a bootstrap approximation
> # to the sampling distribution, instead of a N(0,1)
> set.seed(123)
> duppSorensen(tab_atlas.sanger_BP3, boot = TRUE)
[1] 0.2871182
attr(,"eff.nboot")
[1] 10000
> 
> # Some computations on diverse data structures:
> badConti <- as.table(matrix(c(501, 27, 36, 12, 43, 15, 0, 0, 0),
+                             nrow = 3, ncol = 3,
+                             dimnames = list(c("a1","a2","a3"),
+                                             c("b1", "b2","b3"))))
> tryCatch(nice2x2Table(badConti), error = function(e) {return(e)})
<simpleError in nice2x2Table.table(badConti): Not a 2x2 table>
> 
> incompleteConti <- badConti[1,1:min(2,ncol(badConti)), drop = FALSE]
> incompleteConti
    b1  b2
a1 501  12
> tryCatch(nice2x2Table(incompleteConti), error = function(e) {return(e)})
<simpleError in nice2x2Table.table(incompleteConti): Not a 2x2 table>
> 
> contiAsVector <- c(32, 21, 81, 1439)
> nice2x2Table(contiAsVector)
[1] TRUE
> contiAsVector.mat <- matrix(contiAsVector, nrow = 2)
> contiAsVector.mat
     [,1] [,2]
[1,]   32   81
[2,]   21 1439
> contiAsVectorLen3 <- c(32, 21, 81)
> nice2x2Table(contiAsVectorLen3)
[1] TRUE
> 
> tryCatch(dSorensen(badConti), error = function(e) {return(e)})
<simpleError in nice2x2Table.table(x): Not a 2x2 table>
> 
> # Apparently, the next order works fine, but returns a wrong value!
> dSorensen(badConti, check.table = FALSE)
[1] 0.05915493
> 
> tryCatch(dSorensen(incompleteConti), error = function(e) {return(e)})
<simpleError in nice2x2Table.table(x): Not a 2x2 table>
> dSorensen(contiAsVector)
[1] 0.6144578
> dSorensen(contiAsVector.mat)
[1] 0.6144578
> dSorensen(contiAsVectorLen3)
[1] 0.6144578
> dSorensen(contiAsVectorLen3, check.table = FALSE)
[1] 0.6144578
> dSorensen(c(0,0,0,45))
[1] NaN
> 
> tryCatch(seSorensen(badConti), error = function(e) {return(e)})
<simpleError in nice2x2Table.table(x): Not a 2x2 table>
> tryCatch(seSorensen(incompleteConti), error = function(e) {return(e)})
<simpleError in nice2x2Table.table(x): Not a 2x2 table>
> seSorensen(contiAsVector)
[1] 0.04818012
> seSorensen(contiAsVector.mat)
[1] 0.04818012
> seSorensen(contiAsVectorLen3)
[1] 0.04818012
> seSorensen(contiAsVectorLen3, check.table = FALSE)
[1] 0.04818012
> tryCatch(seSorensen(contiAsVectorLen3, check.table = "not"), error = function(e) {return(e)})
<simpleError in seSorensen.numeric(contiAsVectorLen3, check.table = "not"): Argument 'check.table' must be logical>
> seSorensen(c(0,0,0,45))
[1] NaN
> 
> tryCatch(duppSorensen(badConti), error = function(e) {return(e)})
<simpleError in nice2x2Table.table(x): Not a 2x2 table>
> tryCatch(duppSorensen(incompleteConti), error = function(e) {return(e)})
<simpleError in nice2x2Table.table(x): Not a 2x2 table>
> duppSorensen(contiAsVector)
[1] 0.6937071
> duppSorensen(contiAsVector.mat)
[1] 0.6937071
> set.seed(123)
> duppSorensen(contiAsVector, boot = TRUE)
[1] 0.6922658
attr(,"eff.nboot")
[1] 10000
> set.seed(123)
> duppSorensen(contiAsVector.mat, boot = TRUE)
[1] 0.6922658
attr(,"eff.nboot")
[1] 10000
> duppSorensen(contiAsVectorLen3)
[1] 0.6937071
> # Bootstrapping requires full contingency tables (4 values)
> set.seed(123)
> tryCatch(duppSorensen(contiAsVectorLen3, boot = TRUE), error = function(e) {return(e)})
<simpleError in duppSorensen.numeric(contiAsVectorLen3, boot = TRUE): Bootstraping requires a numeric vector of 4 frequencies>
> duppSorensen(c(0,0,0,45))
[1] NaN
> 
> # Equivalence test, H0: d >= d0 vs  H1: d < d0 (d0 = 0.4444)
> ?equivTestSorensen
equivTestSorensen          package:goSorensen          R Documentation

_E_q_u_i_v_a_l_e_n_c_e _t_e_s_t _b_a_s_e_d _o_n _t_h_e _S_o_r_e_n_s_e_n-_D_i_c_e _d_i_s_s_i_m_i_l_a_r_i_t_y

_D_e_s_c_r_i_p_t_i_o_n:

     Equivalence test based on the Sorensen-Dice dissimilarity,
     computed either by an asymptotic normal approach or by a bootstrap
     approach.

_U_s_a_g_e:

     equivTestSorensen(x, ...)
     
     ## S3 method for class 'table'
     equivTestSorensen(
       x,
       d0 = 1/(1 + 1.25),
       conf.level = 0.95,
       boot = FALSE,
       nboot = 10000,
       check.table = TRUE,
       ...
     )
     
     ## S3 method for class 'matrix'
     equivTestSorensen(
       x,
       d0 = 1/(1 + 1.25),
       conf.level = 0.95,
       boot = FALSE,
       nboot = 10000,
       check.table = TRUE,
       ...
     )
     
     ## S3 method for class 'numeric'
     equivTestSorensen(
       x,
       d0 = 1/(1 + 1.25),
       conf.level = 0.95,
       boot = FALSE,
       nboot = 10000,
       check.table = TRUE,
       ...
     )
     
     ## S3 method for class 'character'
     equivTestSorensen(
       x,
       y,
       d0 = 1/(1 + 1.25),
       conf.level = 0.95,
       boot = FALSE,
       nboot = 10000,
       check.table = TRUE,
       ...
     )
     
     ## S3 method for class 'list'
     equivTestSorensen(
       x,
       d0 = 1/(1 + 1.25),
       conf.level = 0.95,
       boot = FALSE,
       nboot = 10000,
       check.table = TRUE,
       ...
     )
     
     ## S3 method for class 'tableList'
     equivTestSorensen(
       x,
       d0 = 1/(1 + 1.25),
       conf.level = 0.95,
       boot = FALSE,
       nboot = 10000,
       check.table = TRUE,
       ...
     )
     
_A_r_g_u_m_e_n_t_s:

       x: either an object of class "table", "matrix", "numeric",
          "character", "list" or "tableList". See the details section
          for more information.

     ...: extra parameters for function 'buildEnrichTable'.

      d0: equivalence threshold for the Sorensen-Dice dissimilarity, d.
          The null hypothesis states that d >= d0, i.e., inequivalence
          between the compared gene lists and the alternative that d <
          d0, i.e., equivalence or dissimilarity irrelevance (up to a
          level d0).

conf.level: confidence level of the one-sided confidence interval, a
          value between 0 and 1.

    boot: boolean. If TRUE, the confidence interval and the test
          p-value are computed by means of a bootstrap approach instead
          of the asymptotic normal approach. Defaults to FALSE.

   nboot: numeric, number of initially planned bootstrap replicates.
          Ignored if 'boot == FALSE'. Defaults to 10000.

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 list of gene
          identifiers.

_D_e_t_a_i_l_s:

     This function computes either the normal asymptotic or the
     bootstrap equivalence test based on the 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) >= 4', the values are
     interpreted as

     (n_11, n_01, n_10, n_00), always in this order and discarding
     extra values if necessary.

     If 'x' is an object of class "character", then 'x' (and 'y') must
     represent two "character" vectors of valid gene identifiers. Then
     the equivalence test is performed between 'x' and 'y', 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 'equivTestSorensen'.

     If 'x' is an object of class "list", each of its elements must be
     a "character" vector of gene identifiers. Then all pairwise
     equivalence tests are performed between these gene lists.

     Class "tableList" corresponds to objects representing all mutual
     enrichment contingency tables generated in a pairwise fashion:
     Given gene lists l1, l2, ..., lk, an object of class "tableList"
     (typically constructed by a call to function 'buildEnrichTable')
     is a list of lists of contingency tables tij generated from each
     pair of gene lists i and j, with the following structure:

     $l2

     $l2$l1$t21

     $l3

     $l3$l1$t31, $l3$l2$t32

     ...

     $lk$l1$tk1, $lk$l2$tk2, ..., $lk$l(k-1)tk(k-1)

     If 'x' is an object of class "tableList", the test is performed
     over each one of these tables.

     The test is based on the fact that the studentized statistic (^d -
     d) / ^se is approximately distributed as a standard normal. ^d
     stands for the sample Sorensen-Dice dissimilarity, d for its true
     (unknown) value and ^se for the estimate of its standard error.
     This result is asymptotically correct, but the true distribution
     of the studentized statistic is not exactly normal for finite
     samples, with a heavier left tail than expected under the Gaussian
     model, which may produce some type I error inflation. The
     bootstrap method provides a better approximation to this
     distribution. In the bootstrap approach, 'nboot' new bootstrap
     contingency tables are generated from a multinomial distribution
     with parameters 'size =' (n11 + n01 + n10 + n00) and probabilities
     %. Sometimes, some of these generated tables may present so low
     frequencies of enrichment that make them unable for Sorensen-Dice
     computations. As a consequence, the number of effective bootstrap
     samples may be lower than the number of initially planned ones,
     'nboot', but our simulation studies concluded that this makes the
     test more conservative, less prone to reject a truly false null
     hypothesis of inequivalence, but in any case protects from
     inflating the type I error.

     In a bootstrap test result, use 'getNboot' to access the number of
     initially planned bootstrap replicates and 'getEffNboot' to access
     the number of finally effective bootstrap replicates.

_V_a_l_u_e:

     For all interfaces (except for the "list" and "tableList"
     interfaces) the result is a list of class "equivSDhtest" which
     inherits from "htest", with the following components:

     statistic the value of the studentized statistic (dSorensen(x) -
          d0) / seSorensen(x)

     p.value the p-value of the test

     conf.int the one-sided confidence interval (0, dUpp]

     estimate the Sorensen dissimilarity estimate, dSorensen(x)

     null.value the value of d0

     stderr the standard error of the Sorensen dissimilarity estimate,
          seSorensen(x), used as denominator in the studentized
          statistic

     alternative a character string describing the alternative
          hypothesis

     method a character string describing the test

     data.name a character string giving the names of the data

     enrichTab the 2x2 contingency table of joint enrichment whereby
          the test was based

     For the "list" and "tableList" interfaces, the result is an
     "equivSDhtestList", a list of objects with all pairwise
     comparisons, each one being an object of "equivSDhtest" class.

_M_e_t_h_o_d_s (_b_y _c_l_a_s_s):

        • 'table': S3 method for class "table"

        • 'matrix': S3 method for class "matrix"

        • 'numeric': S3 method for class "numeric"

        • 'character': S3 method for class "character"

        • 'list': S3 method for class "list"

        • 'tableList': S3 method for class "tableList"

_S_e_e _A_l_s_o:

     'nice2x2Table' for checking and reformatting data, 'dSorensen' for
     computing the Sorensen-Dice dissimilarity, 'seSorensen' for
     computing the standard error of the dissimilarity, 'duppSorensen'
     for the upper limit of a one-sided confidence interval of the
     dissimilarity. 'getTable', 'getPvalue', 'getUpper', 'getSE',
     'getNboot' and 'getEffNboot' for accessing specific fields in the
     result of these testing functions. 'update' for updating the
     result of these testing functions with alternative equivalence
     limits, confidence levels or to convert a normal result in a
     bootstrap result or the reverse.

_E_x_a_m_p_l_e_s:

     # Gene lists 'atlas' and 'sanger' in 'allOncoGeneLists' dataset. Table of joint enrichment
     # of GO items in ontology BP at level 3.
     data(tab_atlas.sanger_BP3)
     tab_atlas.sanger_BP3
     equivTestSorensen(tab_atlas.sanger_BP3)
     # Bootstrap test:
     equivTestSorensen(tab_atlas.sanger_BP3, boot = TRUE)
     
     # Equivalence tests from scratch, directly from gene lists:
     # (These examples may be considerably time consuming due to many enrichment
     # tests to build the contingency tables of mutual enrichment)
     # ?pbtGeneLists
     # Gene universe:
     # data(humanEntrezIDs)
     # equivTestSorensen(pbtGeneLists[["IRITD3"]], pbtGeneLists[["IRITD5"]],
     #                   geneUniverse = humanEntrezIDs, orgPackg = "org.Hs.eg.db",
     #                   onto = "CC", GOLevel = 5)
     # Bootstrap instead of normal approximation test:
     # equivTestSorensen(pbtGeneLists[["IRITD3"]], pbtGeneLists[["IRITD5"]],
     #                   geneUniverse = humanEntrezIDs, orgPackg = "org.Hs.eg.db",
     #                   onto = "CC", GOLevel = 5,
     #                   boot = TRUE)
     
     # Essentially, the above code makes:
     # IRITD3vs5.CC5 <- buildEnrichTable(pbtGeneLists[["IRITD3"]], pbtGeneLists[["IRITD5"]],
     #                                   geneUniverse = humanEntrezIDs, orgPackg = "org.Hs.eg.db",
     #                                   onto = "CC", GOLevel = 5)
     # IRITD3vs5.CC5
     # equivTestSorensen(IRITD3vs5.CC5)
     # equivTestSorensen(IRITD3vs5.CC5, boot = TRUE)
     # (Note that building first the contingency table may be advantageous to save time!)
     
     # All pairwise equivalence tests:
     # equivTestSorensen(pbtGeneLists,
     #                   geneUniverse = humanEntrezIDs, orgPackg = "org.Hs.eg.db",
     #                   onto = "CC", GOLevel = 5)
     
     
     # Equivalence test on a contingency table represented as a numeric vector:
     equivTestSorensen(c(56, 1, 30, 47))
     equivTestSorensen(c(56, 1, 30, 47), boot = TRUE)
     equivTestSorensen(c(56, 1, 30))
     # Error: all frequencies are needed for bootstrap:
     try(equivTestSorensen(c(56, 1, 30), boot = TRUE), TRUE)
     

> equiv.atlas.sanger <- equivTestSorensen(tab_atlas.sanger_BP3)
> equiv.atlas.sanger

	Normal asymptotic test for 2x2 contingency tables based on the
	Sorensen-Dice dissimilarity

data:  tab_atlas.sanger_BP3
(d - d0) / se = -5.9551, p-value = 1.3e-09
alternative hypothesis: true equivalence limit d0 is less than 0.4444444
95 percent confidence interval:
 0.0000000 0.2796658
sample estimates:
Sorensen dissimilarity 
             0.2167832 
attr(,"se")
standard error 
    0.03822987 

> getTable(equiv.atlas.sanger)
                 Enriched in sanger
Enriched in atlas TRUE FALSE
            TRUE    56    30
            FALSE    1   471
> getPvalue(equiv.atlas.sanger)
     p-value 
1.299869e-09 
> 
> tryCatch(equivTestSorensen(badConti), error = function(e) {return(e)})
<simpleError in nice2x2Table.table(x): Not a 2x2 table>
> tryCatch(equivTestSorensen(incompleteConti), error = function(e) {return(e)})
<simpleError in nice2x2Table.table(x): Not a 2x2 table>
> equivTestSorensen(contiAsVector)

	Normal asymptotic test for 2x2 contingency tables based on the
	Sorensen-Dice dissimilarity

data:  contiAsVector
(d - d0) / se = 3.5287, p-value = 0.9998
alternative hypothesis: true equivalence limit d0 is less than 0.4444444
95 percent confidence interval:
 0.0000000 0.6937071
sample estimates:
Sorensen dissimilarity 
             0.6144578 
attr(,"se")
standard error 
    0.04818012 

> equivTestSorensen(contiAsVector.mat)

	Normal asymptotic test for 2x2 contingency tables based on the
	Sorensen-Dice dissimilarity

data:  contiAsVector.mat
(d - d0) / se = 3.5287, p-value = 0.9998
alternative hypothesis: true equivalence limit d0 is less than 0.4444444
95 percent confidence interval:
 0.0000000 0.6937071
sample estimates:
Sorensen dissimilarity 
             0.6144578 
attr(,"se")
standard error 
    0.04818012 

> set.seed(123)
> equivTestSorensen(contiAsVector.mat, boot = TRUE)

	Bootstrap test for 2x2 contingency tables based on the Sorensen-Dice
	dissimilarity (10000 bootstrap replicates)

data:  contiAsVector.mat
(d - d0) / se = 3.5287, p-value = 0.9996
alternative hypothesis: true equivalence limit d0 is less than 0.4444444
95 percent confidence interval:
 0.0000000 0.6922658
sample estimates:
Sorensen dissimilarity 
             0.6144578 
attr(,"se")
standard error 
    0.04818012 

> equivTestSorensen(contiAsVectorLen3)

	Normal asymptotic test for 2x2 contingency tables based on the
	Sorensen-Dice dissimilarity

data:  contiAsVectorLen3
(d - d0) / se = 3.5287, p-value = 0.9998
alternative hypothesis: true equivalence limit d0 is less than 0.4444444
95 percent confidence interval:
 0.0000000 0.6937071
sample estimates:
Sorensen dissimilarity 
             0.6144578 
attr(,"se")
standard error 
    0.04818012 

> 
> tryCatch(equivTestSorensen(contiAsVectorLen3, boot = TRUE), error = function(e) {return(e)})
<simpleError in equivTestSorensen.numeric(contiAsVectorLen3, boot = TRUE): Bootstraping requires a numeric vector of 4 frequencies>
> 
> equivTestSorensen(c(0,0,0,45))

	No test performed due non finite (d - d0) / se statistic

data:  c(0, 0, 0, 45)
(d - d0) / se = NaN, p-value = NA
alternative hypothesis: true equivalence limit d0 is less than 0.4444444
95 percent confidence interval:
   0 NaN
sample estimates:
Sorensen dissimilarity 
                   NaN 
attr(,"se")
standard error 
           NaN 

> 
> # Sorensen-Dice computations from scratch, directly from gene lists
> data(allOncoGeneLists)
> ?allOncoGeneLists
allOncoGeneLists          package:goSorensen           R Documentation

_7 _g_e_n_e _l_i_s_t_s _p_o_s_s_i_b_l_y _r_e_l_a_t_e_d _w_i_t_h _c_a_n_c_e_r

_D_e_s_c_r_i_p_t_i_o_n:

     An object of class "list" of length 7. Each one of its elements is
     a "character" vector of gene identifiers. Only gene lists of
     length almost 100 were taken from their source web. Take these
     lists just as an illustrative example, they are not automatically
     updated.

_U_s_a_g_e:

     data(allOncoGeneLists)
     
_F_o_r_m_a_t:

     An object of class "list" of length 7. Each one of its elements is
     a "character" vector of gene identifiers.

_S_o_u_r_c_e:

     <http://www.bushmanlab.org/links/genelists>


> data(humanEntrezIDs)
> # First, the mutual GO node enrichment tables are built, then computations
> # proceed from these contingency tables.
> # Building the contingency tables is a slow process (many enrichment tests)
> normTest <- equivTestSorensen(allOncoGeneLists[["atlas"]], allOncoGeneLists[["sanger"]],
+                               listNames = c("atlas", "sanger"),
+                               onto = "BP", GOLevel = 5,
+                               geneUniverse = humanEntrezIDs, orgPackg = "org.Hs.eg.db")
> normTest

	Normal asymptotic test for 2x2 contingency tables based on the
	Sorensen-Dice dissimilarity

data:  tab
(d - d0) / se = -7.1312, p-value = 4.975e-13
alternative hypothesis: true equivalence limit d0 is less than 0.4444444
95 percent confidence interval:
 0.0000000 0.3678388
sample estimates:
Sorensen dissimilarity 
             0.3448718 
attr(,"se")
standard error 
    0.01396295 

> 
> # To perform a bootstrap test from scratch would be even slower:
> # set.seed(123)
> # bootTest <- equivTestSorensen(allOncoGeneLists[["atlas"]], allOncoGeneLists[["sanger"]],
> #                               listNames = c("atlas", "sanger"),
> #                               boot = TRUE,
> #                               onto = "BP", GOLevel = 5,
> #                               geneUniverse = humanEntrezIDs, orgPackg = "org.Hs.eg.db")
> # bootTest
> 
> # It is much faster to upgrade 'normTest' to be a bootstrap test:
> set.seed(123)
> bootTest <- upgrade(normTest, boot = TRUE)
> bootTest

	Bootstrap test for 2x2 contingency tables based on the Sorensen-Dice
	dissimilarity (10000 bootstrap replicates)

data:  tab
(d - d0) / se = -7.1312, p-value = 9.999e-05
alternative hypothesis: true equivalence limit d0 is less than 0.4444444
95 percent confidence interval:
 0.0000000 0.3677033
sample estimates:
Sorensen dissimilarity 
             0.3448718 
attr(,"se")
standard error 
    0.01396295 

> # To know the number of planned bootstrap replicates:
> getNboot(bootTest)
[1] 10000
> # To know the number of valid bootstrap replicates:
> getEffNboot(bootTest)
[1] 10000
> 
> # There are similar methods for dSorensen, seSorensen, duppSorensen, etc. to
> # compute directly from a pair of gene lists.
> # They are quite slow for the same reason as before (many enrichment tests).
> # dSorensen(allOncoGeneLists[["atlas"]], allOncoGeneLists[["sanger"]],
> #           listNames = c("atlas", "sanger"),
> #           onto = "BP", GOLevel = 5,
> #           geneUniverse = humanEntrezIDs, orgPackg = "org.Hs.eg.db")
> # seSorensen(allOncoGeneLists[["atlas"]], allOncoGeneLists[["sanger"]],
> #            listNames = c("atlas", "sanger"),
> #            onto = "BP", GOLevel = 5,
> #            geneUniverse = humanEntrezIDs, orgPackg = "org.Hs.eg.db")
> #
> # duppSorensen(allOncoGeneLists[["atlas"]], allOncoGeneLists[["sanger"]],
> #              listNames = c("atlas", "sanger"),
> #              onto = "BP", GOLevel = 5,
> #              geneUniverse = humanEntrezIDs, orgPackg = "org.Hs.eg.db")
> #
> # set.seed(123)
> # duppSorensen(allOncoGeneLists[["atlas"]], allOncoGeneLists[["sanger"]],
> #              boot = TRUE,
> #              listNames = c("atlas", "sanger"),
> #              onto = "BP", GOLevel = 5,
> #              geneUniverse = humanEntrezIDs, orgPackg = "org.Hs.eg.db")
> # etc.
> 
> # To build the contingency table first and then compute from it, may be a more flexible
> # and saving time strategy, in general:
> ?buildEnrichTable
buildEnrichTable          package:goSorensen           R Documentation

_C_r_e_a_t_e_s _a _2_x_2 _e_n_r_i_c_h_m_e_n_t _c_o_n_t_i_n_g_e_n_c_y _t_a_b_l_e _f_r_o_m _t_w_o _g_e_n_e _l_i_s_t_s, _o_r _a_l_l
_p_a_i_r_w_i_s_e _c_o_n_t_i_n_g_e_n_c_y _t_a_b_l_e_s _f_o_r _a "_l_i_s_t" _o_f _g_e_n_e _l_i_s_t_s.

_D_e_s_c_r_i_p_t_i_o_n:

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

_U_s_a_g_e:

     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),
       ...
     )
     
_A_r_g_u_m_e_n_t_s:

       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.

_D_e_t_a_i_l_s:

     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.

_V_a_l_u_e:

     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)

_M_e_t_h_o_d_s (_b_y _c_l_a_s_s):

        • 'default': S3 default method

        • 'character': S3 method for class "character"

        • 'list': S3 method for class "list"

_E_x_a_m_p_l_e_s:

     # 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)
     

> tab <- buildEnrichTable(allOncoGeneLists[["atlas"]], allOncoGeneLists[["sanger"]],
+                         listNames = c("atlas", "sanger"),
+                         onto = "BP", GOLevel = 5,
+                         geneUniverse = humanEntrezIDs, orgPackg = "org.Hs.eg.db")
> 
> tab
                 Enriched in sanger
Enriched in atlas TRUE FALSE
            TRUE   511   492
            FALSE   46  9151
> 
> # (Here, an obvious faster possibility would be to recover the enrichment contingency
> # table from the previous normal test result:)
> tab <- getTable(normTest)
> tab
                 Enriched in sanger
Enriched in atlas TRUE FALSE
            TRUE   511   492
            FALSE   46  9151
> 
> tst <- equivTestSorensen(tab)
> tst

	Normal asymptotic test for 2x2 contingency tables based on the
	Sorensen-Dice dissimilarity

data:  tab
(d - d0) / se = -7.1312, p-value = 4.975e-13
alternative hypothesis: true equivalence limit d0 is less than 0.4444444
95 percent confidence interval:
 0.0000000 0.3678388
sample estimates:
Sorensen dissimilarity 
             0.3448718 
attr(,"se")
standard error 
    0.01396295 

> set.seed(123)
> bootTst <- equivTestSorensen(tab, boot = TRUE)
> bootTst

	Bootstrap test for 2x2 contingency tables based on the Sorensen-Dice
	dissimilarity (10000 bootstrap replicates)

data:  tab
(d - d0) / se = -7.1312, p-value = 9.999e-05
alternative hypothesis: true equivalence limit d0 is less than 0.4444444
95 percent confidence interval:
 0.0000000 0.3677033
sample estimates:
Sorensen dissimilarity 
             0.3448718 
attr(,"se")
standard error 
    0.01396295 

> 
> dSorensen(tab)
[1] 0.3448718
> seSorensen(tab)
[1] 0.01396295
> # or:
> getDissimilarity(tst)
Sorensen dissimilarity 
             0.3448718 
attr(,"se")
standard error 
    0.01396295 
> 
> duppSorensen(tab)
[1] 0.3678388
> getUpper(tst)
   dUpper 
0.3678388 
> 
> set.seed(123)
> duppSorensen(tab, boot = TRUE)
[1] 0.3677033
attr(,"eff.nboot")
[1] 10000
> getUpper(bootTst)
   dUpper 
0.3677033 
> 
> # To perform from scratch all pairwise tests (or other Sorensen-Dice computations)
> # is even much slower. For example, all pairwise...
> # Dissimilarities:
> # # allPairDiss <- dSorensen(allOncoGeneLists,
> # #                          onto = "BP", GOLevel = 5,
> # #                          geneUniverse = humanEntrezIDs, orgPackg = "org.Hs.eg.db")
> # # allPairDiss
> #
> # # Still time consuming but faster: build all tables computing in parallel:
> # allPairDiss <- dSorensen(allOncoGeneLists,
> #                          onto = "BP", GOLevel = 5,
> #                          geneUniverse = humanEntrezIDs, orgPackg = "org.Hs.eg.db",
> #                          parallel = TRUE)
> # allPairDiss
> 
> # Standard errors:
> # seSorensen(allOncoGeneLists,
> #            onto = "BP", GOLevel = 5,
> #            geneUniverse = humanEntrezIDs, orgPackg = "org.Hs.eg.db")
> #
> # Upper confidence interval limits:
> # duppSorensen(allOncoGeneLists,
> #              onto = "BP", GOLevel = 5,
> #              geneUniverse = humanEntrezIDs, orgPackg = "org.Hs.eg.db")
> # All pairwise asymptotic normal tests:
> # allTests <- equivTestSorensen(allOncoGeneLists,
> #                               onto = "BP", GOLevel = 5,
> #                               geneUniverse = humanEntrezIDs, orgPackg = "org.Hs.eg.db")
> # getPvalue(allTests, simplify = FALSE)
> # getPvalue(allTests)
> # p.adjust(getPvalue(allTests), method = "holm")
> # To perform all pairwise bootstrap tests from scratch is (slightly)
> # even more time consuming:
> # set.seed(123)
> # allBootTests <- equivTestSorensen(allOncoGeneLists,
> #                                   boot = TRUE,
> #                                   onto = "BP", GOLevel = 5,
> #                                   geneUniverse = humanEntrezIDs, orgPackg = "org.Hs.eg.db")
> # Not all bootstrap replicates may conduct to finite statistics:
> # getNboot(allBootTests)
> 
> # Given the normal tests (object 'allTests'), it is much faster to upgrade
> # it to have the bootstrap tests:
> # set.seed(123)
> # allBootTests <- upgrade(allTests, boot = TRUE)
> # getPvalue(allBootTests, simplify = FALSE)
> 
> # Again, the faster and more flexible possibility may be:
> # 1) First, build all pairwise enrichment contingency tables (slow first step):
> # allTabsBP.4 <- buildEnrichTable(allOncoGeneLists,
> #                                 onto = "BP", GOLevel = 5,
> #                                 geneUniverse = humanEntrezIDs, orgPackg = "org.Hs.eg.db")
> # allTabsBP.4
> 
> # Better, directly use the dataset available at this package, goSorensen:
> data(allTabsBP.4)
> allTabsBP.4
$cangenes
$cangenes$atlas
                    Enriched in atlas
Enriched in cangenes TRUE FALSE
               TRUE     1     0
               FALSE  959  9397


$cis
$cis$atlas
               Enriched in atlas
Enriched in cis TRUE FALSE
          TRUE   181    11
          FALSE  779  9386

$cis$cangenes
               Enriched in cangenes
Enriched in cis  TRUE FALSE
          TRUE      1   191
          FALSE     0 10165


$miscellaneous
$miscellaneous$atlas
                         Enriched in atlas
Enriched in miscellaneous TRUE FALSE
                    TRUE   450    57
                    FALSE  510  9340

$miscellaneous$cangenes
                         Enriched in cangenes
Enriched in miscellaneous TRUE FALSE
                    TRUE     1   506
                    FALSE    0  9850

$miscellaneous$cis
                         Enriched in cis
Enriched in miscellaneous TRUE FALSE
                    TRUE   145   362
                    FALSE   47  9803


$sanger
$sanger$atlas
                  Enriched in atlas
Enriched in sanger TRUE FALSE
             TRUE   500    45
             FALSE  460  9352

$sanger$cangenes
                  Enriched in cangenes
Enriched in sanger TRUE FALSE
             TRUE     1   544
             FALSE    0  9812

$sanger$cis
                  Enriched in cis
Enriched in sanger TRUE FALSE
             TRUE   153   392
             FALSE   39  9773

$sanger$miscellaneous
                  Enriched in miscellaneous
Enriched in sanger TRUE FALSE
             TRUE   359   186
             FALSE  148  9664


$Vogelstein
$Vogelstein$atlas
                      Enriched in atlas
Enriched in Vogelstein TRUE FALSE
                 TRUE   542    76
                 FALSE  418  9321

$Vogelstein$cangenes
                      Enriched in cangenes
Enriched in Vogelstein TRUE FALSE
                 TRUE     1   617
                 FALSE    0  9739

$Vogelstein$cis
                      Enriched in cis
Enriched in Vogelstein TRUE FALSE
                 TRUE   163   455
                 FALSE   29  9710

$Vogelstein$miscellaneous
                      Enriched in miscellaneous
Enriched in Vogelstein TRUE FALSE
                 TRUE   374   244
                 FALSE  133  9606

$Vogelstein$sanger
                      Enriched in sanger
Enriched in Vogelstein TRUE FALSE
                 TRUE   512   106
                 FALSE   33  9706


$waldman
$waldman$atlas
                   Enriched in atlas
Enriched in waldman TRUE FALSE
              TRUE   641   138
              FALSE  319  9259

$waldman$cangenes
                   Enriched in cangenes
Enriched in waldman TRUE FALSE
              TRUE     1   778
              FALSE    0  9578

$waldman$cis
                   Enriched in cis
Enriched in waldman TRUE FALSE
              TRUE   171   608
              FALSE   21  9557

$waldman$miscellaneous
                   Enriched in miscellaneous
Enriched in waldman TRUE FALSE
              TRUE   467   312
              FALSE   40  9538

$waldman$sanger
                   Enriched in sanger
Enriched in waldman TRUE FALSE
              TRUE   446   333
              FALSE   99  9479

$waldman$Vogelstein
                   Enriched in Vogelstein
Enriched in waldman TRUE FALSE
              TRUE   488   291
              FALSE  130  9448


attr(,"class")
[1] "tableList" "list"     
> class(allTabsBP.4)
[1] "tableList" "list"     
> # 2) Then perform all required computatios from these enrichment contingency tables...
> # All pairwise tests:
> allTests <- equivTestSorensen(allTabsBP.4)
> allTests
$cangenes
$cangenes$atlas

	Normal asymptotic test for 2x2 contingency tables based on the
	Sorensen-Dice dissimilarity

data:  tab
(d - d0) / se = 266.22, p-value = 1
alternative hypothesis: true equivalence limit d0 is less than 0.4444444
95 percent confidence interval:
 0 1
sample estimates:
Sorensen dissimilarity 
             0.9979188 
attr(,"se")
standard error 
      0.002079 



$cis
$cis$atlas

	Normal asymptotic test for 2x2 contingency tables based on the
	Sorensen-Dice dissimilarity

data:  tab
(d - d0) / se = 13.583, p-value = 1
alternative hypothesis: true equivalence limit d0 is less than 0.4444444
95 percent confidence interval:
 0.0000000 0.7149878
sample estimates:
Sorensen dissimilarity 
             0.6857639 
attr(,"se")
standard error 
    0.01776688 


$cis$cangenes

	Normal asymptotic test for 2x2 contingency tables based on the
	Sorensen-Dice dissimilarity

data:  tab
(d - d0) / se = 52.885, p-value = 1
alternative hypothesis: true equivalence limit d0 is less than 0.4444444
95 percent confidence interval:
 0 1
sample estimates:
Sorensen dissimilarity 
             0.9896373 
attr(,"se")
standard error 
      0.010309 



$miscellaneous
$miscellaneous$atlas

	Normal asymptotic test for 2x2 contingency tables based on the
	Sorensen-Dice dissimilarity

data:  tab
(d - d0) / se = -3.8685, p-value = 5.474e-05
alternative hypothesis: true equivalence limit d0 is less than 0.4444444
95 percent confidence interval:
 0.000000 0.411139
sample estimates:
Sorensen dissimilarity 
             0.3865031 
attr(,"se")
standard error 
    0.01497758 


$miscellaneous$cangenes

	Normal asymptotic test for 2x2 contingency tables based on the
	Sorensen-Dice dissimilarity

data:  tab
(d - d0) / se = 140.39, p-value = 1
alternative hypothesis: true equivalence limit d0 is less than 0.4444444
95 percent confidence interval:
 0 1
sample estimates:
Sorensen dissimilarity 
              0.996063 
attr(,"se")
standard error 
   0.003929258 


$miscellaneous$cis

	Normal asymptotic test for 2x2 contingency tables based on the
	Sorensen-Dice dissimilarity

data:  tab
(d - d0) / se = 5.9904, p-value = 1
alternative hypothesis: true equivalence limit d0 is less than 0.4444444
95 percent confidence interval:
 0.000000 0.623749
sample estimates:
Sorensen dissimilarity 
             0.5851216 
attr(,"se")
standard error 
    0.02348381 



$sanger
$sanger$atlas

	Normal asymptotic test for 2x2 contingency tables based on the
	Sorensen-Dice dissimilarity

data:  tab
(d - d0) / se = -7.738, p-value = 5.051e-15
alternative hypothesis: true equivalence limit d0 is less than 0.4444444
95 percent confidence interval:
 0.0000000 0.3586962
sample estimates:
Sorensen dissimilarity 
             0.3355482 
attr(,"se")
standard error 
    0.01407301 


$sanger$cangenes

	Normal asymptotic test for 2x2 contingency tables based on the
	Sorensen-Dice dissimilarity

data:  tab
(d - d0) / se = 150.94, p-value = 1
alternative hypothesis: true equivalence limit d0 is less than 0.4444444
95 percent confidence interval:
 0 1
sample estimates:
Sorensen dissimilarity 
              0.996337 
attr(,"se")
standard error 
   0.003656295 


$sanger$cis

	Normal asymptotic test for 2x2 contingency tables based on the
	Sorensen-Dice dissimilarity

data:  tab
(d - d0) / se = 6.1374, p-value = 1
alternative hypothesis: true equivalence limit d0 is less than 0.4444444
95 percent confidence interval:
 0.0000000 0.6224203
sample estimates:
Sorensen dissimilarity 
             0.5848033 
attr(,"se")
standard error 
    0.02286957 


$sanger$miscellaneous

	Normal asymptotic test for 2x2 contingency tables based on the
	Sorensen-Dice dissimilarity

data:  tab
(d - d0) / se = -7.701, p-value = 6.75e-15
alternative hypothesis: true equivalence limit d0 is less than 0.4444444
95 percent confidence interval:
 0.0000000 0.3446065
sample estimates:
Sorensen dissimilarity 
             0.3174905 
attr(,"se")
standard error 
    0.01648539 



$Vogelstein
$Vogelstein$atlas

	Normal asymptotic test for 2x2 contingency tables based on the
	Sorensen-Dice dissimilarity

data:  tab
(d - d0) / se = -9.8173, p-value < 2.2e-16
alternative hypothesis: true equivalence limit d0 is less than 0.4444444
95 percent confidence interval:
 0.0000000 0.3350683
sample estimates:
Sorensen dissimilarity 
             0.3130545 
attr(,"se")
standard error 
    0.01338347 


$Vogelstein$cangenes

	Normal asymptotic test for 2x2 contingency tables based on the
	Sorensen-Dice dissimilarity

data:  tab
(d - d0) / se = 171.22, p-value = 1
alternative hypothesis: true equivalence limit d0 is less than 0.4444444
95 percent confidence interval:
 0 1
sample estimates:
Sorensen dissimilarity 
              0.996769 
attr(,"se")
standard error 
   0.003225798 


$Vogelstein$cis

	Normal asymptotic test for 2x2 contingency tables based on the
	Sorensen-Dice dissimilarity

data:  tab
(d - d0) / se = 7.0238, p-value = 1
alternative hypothesis: true equivalence limit d0 is less than 0.4444444
95 percent confidence interval:
 0.0000000 0.6333811
sample estimates:
Sorensen dissimilarity 
             0.5975309 
attr(,"se")
standard error 
    0.02179538 


$Vogelstein$miscellaneous

	Normal asymptotic test for 2x2 contingency tables based on the
	Sorensen-Dice dissimilarity

data:  tab
(d - d0) / se = -6.7191, p-value = 9.142e-12
alternative hypothesis: true equivalence limit d0 is less than 0.4444444
95 percent confidence interval:
 0.0000000 0.3618762
sample estimates:
Sorensen dissimilarity 
             0.3351111 
attr(,"se")
standard error 
    0.01627199 


$Vogelstein$sanger

	Normal asymptotic test for 2x2 contingency tables based on the
	Sorensen-Dice dissimilarity

data:  tab
(d - d0) / se = -32.259, p-value < 2.2e-16
alternative hypothesis: true equivalence limit d0 is less than 0.4444444
95 percent confidence interval:
 0.0000000 0.1360863
sample estimates:
Sorensen dissimilarity 
             0.1195185 
attr(,"se")
standard error 
     0.0100725 



$waldman
$waldman$atlas

	Normal asymptotic test for 2x2 contingency tables based on the
	Sorensen-Dice dissimilarity

data:  tab
(d - d0) / se = -15.308, p-value < 2.2e-16
alternative hypothesis: true equivalence limit d0 is less than 0.4444444
95 percent confidence interval:
 0.0000000 0.2823131
sample estimates:
Sorensen dissimilarity 
             0.2627947 
attr(,"se")
standard error 
    0.01186635 


$waldman$cangenes

	Normal asymptotic test for 2x2 contingency tables based on the
	Sorensen-Dice dissimilarity

data:  tab
(d - d0) / se = 215.94, p-value = 1
alternative hypothesis: true equivalence limit d0 is less than 0.4444444
95 percent confidence interval:
 0 1
sample estimates:
Sorensen dissimilarity 
             0.9974359 
attr(,"se")
standard error 
   0.002560815 


$waldman$cis

	Normal asymptotic test for 2x2 contingency tables based on the
	Sorensen-Dice dissimilarity

data:  tab
(d - d0) / se = 10.327, p-value = 1
alternative hypothesis: true equivalence limit d0 is less than 0.4444444
95 percent confidence interval:
 0.0000000 0.6801719
sample estimates:
Sorensen dissimilarity 
             0.6477858 
attr(,"se")
standard error 
    0.01968936 


$waldman$miscellaneous

	Normal asymptotic test for 2x2 contingency tables based on the
	Sorensen-Dice dissimilarity

data:  tab
(d - d0) / se = -12.16, p-value < 2.2e-16
alternative hypothesis: true equivalence limit d0 is less than 0.4444444
95 percent confidence interval:
 0.0000000 0.2968117
sample estimates:
Sorensen dissimilarity 
              0.273717 
attr(,"se")
standard error 
    0.01404058 


$waldman$sanger

	Normal asymptotic test for 2x2 contingency tables based on the
	Sorensen-Dice dissimilarity

data:  tab
(d - d0) / se = -7.9582, p-value = 8.729e-16
alternative hypothesis: true equivalence limit d0 is less than 0.4444444
95 percent confidence interval:
 0.0000000 0.3507062
sample estimates:
Sorensen dissimilarity 
              0.326284 
attr(,"se")
standard error 
    0.01484766 


$waldman$Vogelstein

	Normal asymptotic test for 2x2 contingency tables based on the
	Sorensen-Dice dissimilarity

data:  tab
(d - d0) / se = -10.211, p-value < 2.2e-16
alternative hypothesis: true equivalence limit d0 is less than 0.4444444
95 percent confidence interval:
 0.0000000 0.3244082
sample estimates:
Sorensen dissimilarity 
             0.3013601 
attr(,"se")
standard error 
    0.01401229 



attr(,"class")
[1] "equivSDhtestList" "list"            
> class(allTests)
[1] "equivSDhtestList" "list"            
> set.seed(123)
> allBootTests <- equivTestSorensen(allTabsBP.4, boot = TRUE)
> allBootTests
$cangenes
$cangenes$atlas

	Bootstrap test for 2x2 contingency tables based on the Sorensen-Dice
	dissimilarity (6298 effective bootstrap replicates of 10000)

data:  tab
(d - d0) / se = 266.22, p-value = 1
alternative hypothesis: true equivalence limit d0 is less than 0.4444444
95 percent confidence interval:
 0 1
sample estimates:
Sorensen dissimilarity 
             0.9979188 
attr(,"se")
standard error 
      0.002079 



$cis
$cis$atlas

	Bootstrap test for 2x2 contingency tables based on the Sorensen-Dice
	dissimilarity (10000 bootstrap replicates)

data:  tab
(d - d0) / se = 13.583, p-value = 1
alternative hypothesis: true equivalence limit d0 is less than 0.4444444
95 percent confidence interval:
 0.0000000 0.7143131
sample estimates:
Sorensen dissimilarity 
             0.6857639 
attr(,"se")
standard error 
    0.01776688 


$cis$cangenes

	Bootstrap test for 2x2 contingency tables based on the Sorensen-Dice
	dissimilarity (6342 effective bootstrap replicates of 10000)

data:  tab
(d - d0) / se = 52.885, p-value = 1
alternative hypothesis: true equivalence limit d0 is less than 0.4444444
95 percent confidence interval:
 0 1
sample estimates:
Sorensen dissimilarity 
             0.9896373 
attr(,"se")
standard error 
      0.010309 



$miscellaneous
$miscellaneous$atlas

	Bootstrap test for 2x2 contingency tables based on the Sorensen-Dice
	dissimilarity (10000 bootstrap replicates)

data:  tab
(d - d0) / se = -3.8685, p-value = 2e-04
alternative hypothesis: true equivalence limit d0 is less than 0.4444444
95 percent confidence interval:
 0.0000000 0.4111369
sample estimates:
Sorensen dissimilarity 
             0.3865031 
attr(,"se")
standard error 
    0.01497758 


$miscellaneous$cangenes

	Bootstrap test for 2x2 contingency tables based on the Sorensen-Dice
	dissimilarity (6382 effective bootstrap replicates of 10000)

data:  tab
(d - d0) / se = 140.39, p-value = 1
alternative hypothesis: true equivalence limit d0 is less than 0.4444444
95 percent confidence interval:
 0 1
sample estimates:
Sorensen dissimilarity 
              0.996063 
attr(,"se")
standard error 
   0.003929258 


$miscellaneous$cis

	Bootstrap test for 2x2 contingency tables based on the Sorensen-Dice
	dissimilarity (10000 bootstrap replicates)

data:  tab
(d - d0) / se = 5.9904, p-value = 1
alternative hypothesis: true equivalence limit d0 is less than 0.4444444
95 percent confidence interval:
 0.0000000 0.6245189
sample estimates:
Sorensen dissimilarity 
             0.5851216 
attr(,"se")
standard error 
    0.02348381 



$sanger
$sanger$atlas

	Bootstrap test for 2x2 contingency tables based on the Sorensen-Dice
	dissimilarity (10000 bootstrap replicates)

data:  tab
(d - d0) / se = -7.738, p-value = 9.999e-05
alternative hypothesis: true equivalence limit d0 is less than 0.4444444
95 percent confidence interval:
 0.0000000 0.3588894
sample estimates:
Sorensen dissimilarity 
             0.3355482 
attr(,"se")
standard error 
    0.01407301 


$sanger$cangenes

	Bootstrap test for 2x2 contingency tables based on the Sorensen-Dice
	dissimilarity (6403 effective bootstrap replicates of 10000)

data:  tab
(d - d0) / se = 150.94, p-value = 1
alternative hypothesis: true equivalence limit d0 is less than 0.4444444
95 percent confidence interval:
 0 1
sample estimates:
Sorensen dissimilarity 
              0.996337 
attr(,"se")
standard error 
   0.003656295 


$sanger$cis

	Bootstrap test for 2x2 contingency tables based on the Sorensen-Dice
	dissimilarity (10000 bootstrap replicates)

data:  tab
(d - d0) / se = 6.1374, p-value = 1
alternative hypothesis: true equivalence limit d0 is less than 0.4444444
95 percent confidence interval:
 0.0000000 0.6222143
sample estimates:
Sorensen dissimilarity 
             0.5848033 
attr(,"se")
standard error 
    0.02286957 


$sanger$miscellaneous

	Bootstrap test for 2x2 contingency tables based on the Sorensen-Dice
	dissimilarity (10000 bootstrap replicates)

data:  tab
(d - d0) / se = -7.701, p-value = 9.999e-05
alternative hypothesis: true equivalence limit d0 is less than 0.4444444
95 percent confidence interval:
 0.0000000 0.3449603
sample estimates:
Sorensen dissimilarity 
             0.3174905 
attr(,"se")
standard error 
    0.01648539 



$Vogelstein
$Vogelstein$atlas

	Bootstrap test for 2x2 contingency tables based on the Sorensen-Dice
	dissimilarity (10000 bootstrap replicates)

data:  tab
(d - d0) / se = -9.8173, p-value = 9.999e-05
alternative hypothesis: true equivalence limit d0 is less than 0.4444444
95 percent confidence interval:
 0.0000000 0.3357311
sample estimates:
Sorensen dissimilarity 
             0.3130545 
attr(,"se")
standard error 
    0.01338347 


$Vogelstein$cangenes

	Bootstrap test for 2x2 contingency tables based on the Sorensen-Dice
	dissimilarity (6273 effective bootstrap replicates of 10000)

data:  tab
(d - d0) / se = 171.22, p-value = 1
alternative hypothesis: true equivalence limit d0 is less than 0.4444444
95 percent confidence interval:
 0 1
sample estimates:
Sorensen dissimilarity 
              0.996769 
attr(,"se")
standard error 
   0.003225798 


$Vogelstein$cis

	Bootstrap test for 2x2 contingency tables based on the Sorensen-Dice
	dissimilarity (10000 bootstrap replicates)

data:  tab
(d - d0) / se = 7.0238, p-value = 1
alternative hypothesis: true equivalence limit d0 is less than 0.4444444
95 percent confidence interval:
 0.0000000 0.6328101
sample estimates:
Sorensen dissimilarity 
             0.5975309 
attr(,"se")
standard error 
    0.02179538 


$Vogelstein$miscellaneous

	Bootstrap test for 2x2 contingency tables based on the Sorensen-Dice
	dissimilarity (10000 bootstrap replicates)

data:  tab
(d - d0) / se = -6.7191, p-value = 9.999e-05
alternative hypothesis: true equivalence limit d0 is less than 0.4444444
95 percent confidence interval:
 0.0000000 0.3629782
sample estimates:
Sorensen dissimilarity 
             0.3351111 
attr(,"se")
standard error 
    0.01627199 


$Vogelstein$sanger

	Bootstrap test for 2x2 contingency tables based on the Sorensen-Dice
	dissimilarity (10000 bootstrap replicates)

data:  tab
(d - d0) / se = -32.259, p-value = 9.999e-05
alternative hypothesis: true equivalence limit d0 is less than 0.4444444
95 percent confidence interval:
 0.0000000 0.1369488
sample estimates:
Sorensen dissimilarity 
             0.1195185 
attr(,"se")
standard error 
     0.0100725 



$waldman
$waldman$atlas

	Bootstrap test for 2x2 contingency tables based on the Sorensen-Dice
	dissimilarity (10000 bootstrap replicates)

data:  tab
(d - d0) / se = -15.308, p-value = 9.999e-05
alternative hypothesis: true equivalence limit d0 is less than 0.4444444
95 percent confidence interval:
 0.000000 0.282671
sample estimates:
Sorensen dissimilarity 
             0.2627947 
attr(,"se")
standard error 
    0.01186635 


$waldman$cangenes

	Bootstrap test for 2x2 contingency tables based on the Sorensen-Dice
	dissimilarity (6279 effective bootstrap replicates of 10000)

data:  tab
(d - d0) / se = 215.94, p-value = 1
alternative hypothesis: true equivalence limit d0 is less than 0.4444444
95 percent confidence interval:
 0 1
sample estimates:
Sorensen dissimilarity 
             0.9974359 
attr(,"se")
standard error 
   0.002560815 


$waldman$cis

	Bootstrap test for 2x2 contingency tables based on the Sorensen-Dice
	dissimilarity (10000 bootstrap replicates)

data:  tab
(d - d0) / se = 10.327, p-value = 1
alternative hypothesis: true equivalence limit d0 is less than 0.4444444
95 percent confidence interval:
 0.0000000 0.6796177
sample estimates:
Sorensen dissimilarity 
             0.6477858 
attr(,"se")
standard error 
    0.01968936 


$waldman$miscellaneous

	Bootstrap test for 2x2 contingency tables based on the Sorensen-Dice
	dissimilarity (10000 bootstrap replicates)

data:  tab
(d - d0) / se = -12.16, p-value = 9.999e-05
alternative hypothesis: true equivalence limit d0 is less than 0.4444444
95 percent confidence interval:
 0.0000000 0.2973298
sample estimates:
Sorensen dissimilarity 
              0.273717 
attr(,"se")
standard error 
    0.01404058 


$waldman$sanger

	Bootstrap test for 2x2 contingency tables based on the Sorensen-Dice
	dissimilarity (10000 bootstrap replicates)

data:  tab
(d - d0) / se = -7.9582, p-value = 9.999e-05
alternative hypothesis: true equivalence limit d0 is less than 0.4444444
95 percent confidence interval:
 0.0000000 0.3515402
sample estimates:
Sorensen dissimilarity 
              0.326284 
attr(,"se")
standard error 
    0.01484766 


$waldman$Vogelstein

	Bootstrap test for 2x2 contingency tables based on the Sorensen-Dice
	dissimilarity (10000 bootstrap replicates)

data:  tab
(d - d0) / se = -10.211, p-value = 9.999e-05
alternative hypothesis: true equivalence limit d0 is less than 0.4444444
95 percent confidence interval:
 0.0000000 0.3243615
sample estimates:
Sorensen dissimilarity 
             0.3013601 
attr(,"se")
standard error 
    0.01401229 



attr(,"class")
[1] "equivSDhtestList" "list"            
> class(allBootTests)
[1] "equivSDhtestList" "list"            
> getPvalue(allBootTests, simplify = FALSE)
                   atlas cangenes cis miscellaneous    sanger Vogelstein
atlas         0.00000000        1   1    0.00019998 9.999e-05  9.999e-05
cangenes      1.00000000        0   1    1.00000000 1.000e+00  1.000e+00
cis           1.00000000        1   0    1.00000000 1.000e+00  1.000e+00
miscellaneous 0.00019998        1   1    0.00000000 9.999e-05  9.999e-05
sanger        0.00009999        1   1    0.00009999 0.000e+00  9.999e-05
Vogelstein    0.00009999        1   1    0.00009999 9.999e-05  0.000e+00
waldman       0.00009999        1   1    0.00009999 9.999e-05  9.999e-05
                waldman
atlas         9.999e-05
cangenes      1.000e+00
cis           1.000e+00
miscellaneous 9.999e-05
sanger        9.999e-05
Vogelstein    9.999e-05
waldman       0.000e+00
> getEffNboot(allBootTests)
          cangenes.atlas                cis.atlas             cis.cangenes 
                    6298                    10000                     6342 
     miscellaneous.atlas   miscellaneous.cangenes        miscellaneous.cis 
                   10000                     6382                    10000 
            sanger.atlas          sanger.cangenes               sanger.cis 
                   10000                     6403                    10000 
    sanger.miscellaneous         Vogelstein.atlas      Vogelstein.cangenes 
                   10000                    10000                     6273 
          Vogelstein.cis Vogelstein.miscellaneous        Vogelstein.sanger 
                   10000                    10000                    10000 
           waldman.atlas         waldman.cangenes              waldman.cis 
                   10000                     6279                    10000 
   waldman.miscellaneous           waldman.sanger       waldman.Vogelstein 
                   10000                    10000                    10000 
> 
> # To adjust for testing multiplicity:
> p.adjust(getPvalue(allBootTests), method = "holm")
          cangenes.atlas.p-value                cis.atlas.p-value 
                      1.00000000                       1.00000000 
            cis.cangenes.p-value      miscellaneous.atlas.p-value 
                      1.00000000                       0.00239976 
  miscellaneous.cangenes.p-value        miscellaneous.cis.p-value 
                      1.00000000                       1.00000000 
            sanger.atlas.p-value          sanger.cangenes.p-value 
                      0.00209979                       1.00000000 
              sanger.cis.p-value     sanger.miscellaneous.p-value 
                      1.00000000                       0.00209979 
        Vogelstein.atlas.p-value      Vogelstein.cangenes.p-value 
                      0.00209979                       1.00000000 
          Vogelstein.cis.p-value Vogelstein.miscellaneous.p-value 
                      1.00000000                       0.00209979 
       Vogelstein.sanger.p-value            waldman.atlas.p-value 
                      0.00209979                       0.00209979 
        waldman.cangenes.p-value              waldman.cis.p-value 
                      1.00000000                       1.00000000 
   waldman.miscellaneous.p-value           waldman.sanger.p-value 
                      0.00209979                       0.00209979 
      waldman.Vogelstein.p-value 
                      0.00209979 
> 
> # If only partial statistics are desired:
> dSorensen(allTabsBP.4)
                  atlas  cangenes       cis miscellaneous    sanger Vogelstein
atlas         0.0000000 0.9979188 0.6857639     0.3865031 0.3355482  0.3130545
cangenes      0.9979188 0.0000000 0.9896373     0.9960630 0.9963370  0.9967690
cis           0.6857639 0.9896373 0.0000000     0.5851216 0.5848033  0.5975309
miscellaneous 0.3865031 0.9960630 0.5851216     0.0000000 0.3174905  0.3351111
sanger        0.3355482 0.9963370 0.5848033     0.3174905 0.0000000  0.1195185
Vogelstein    0.3130545 0.9967690 0.5975309     0.3351111 0.1195185  0.0000000
waldman       0.2627947 0.9974359 0.6477858     0.2737170 0.3262840  0.3013601
                waldman
atlas         0.2627947
cangenes      0.9974359
cis           0.6477858
miscellaneous 0.2737170
sanger        0.3262840
Vogelstein    0.3013601
waldman       0.0000000
> duppSorensen(allTabsBP.4)
                  atlas cangenes       cis miscellaneous    sanger Vogelstein
atlas         0.0000000        1 0.7149878     0.4111390 0.3586962  0.3350683
cangenes      1.0000000        0 1.0000000     1.0000000 1.0000000  1.0000000
cis           0.7149878        1 0.0000000     0.6237490 0.6224203  0.6333811
miscellaneous 0.4111390        1 0.6237490     0.0000000 0.3446065  0.3618762
sanger        0.3586962        1 0.6224203     0.3446065 0.0000000  0.1360863
Vogelstein    0.3350683        1 0.6333811     0.3618762 0.1360863  0.0000000
waldman       0.2823131        1 0.6801719     0.2968117 0.3507062  0.3244082
                waldman
atlas         0.2823131
cangenes      1.0000000
cis           0.6801719
miscellaneous 0.2968117
sanger        0.3507062
Vogelstein    0.3244082
waldman       0.0000000
> seSorensen(allTabsBP.4)
                   atlas    cangenes        cis miscellaneous      sanger
atlas         0.00000000 0.002079000 0.01776688   0.014977580 0.014073007
cangenes      0.00207900 0.000000000 0.01030900   0.003929258 0.003656295
cis           0.01776688 0.010309002 0.00000000   0.023483807 0.022869567
miscellaneous 0.01497758 0.003929258 0.02348381   0.000000000 0.016485388
sanger        0.01407301 0.003656295 0.02286957   0.016485388 0.000000000
Vogelstein    0.01338347 0.003225798 0.02179538   0.016271992 0.010072500
waldman       0.01186635 0.002560815 0.01968936   0.014040581 0.014847661
               Vogelstein     waldman
atlas         0.013383469 0.011866345
cangenes      0.003225798 0.002560815
cis           0.021795381 0.019689356
miscellaneous 0.016271992 0.014040581
sanger        0.010072500 0.014847661
Vogelstein    0.000000000 0.014012289
waldman       0.014012289 0.000000000
> 
> 
> # Tipically, in a real study it would be interesting to scan tests
> # along some ontologies and levels inside these ontologies:
> # (which obviously will be a quite slow process)
> # gc()
> # set.seed(123)
> # allBootTests_BP_MF_lev4to8 <- allEquivTestSorensen(allOncoGeneLists,
> #                                                    boot = TRUE,
> #                                                    geneUniverse = humanEntrezIDs, orgPackg = "org.Hs.eg.db",
> #                                                    ontos = c("BP", "MF"), GOLevels = 4:8)
> # getPvalue(allBootTests_BP_MF_lev4to8)
> # getEffNboot(allBootTests_BP_MF_lev4to8)
> 
> proc.time()
   user  system elapsed 
182.712   8.124 293.669 

goSorensen.Rcheck/tests/test_nonsense_genes.Rout


R version 4.3.1 (2023-06-16) -- "Beagle Scouts"
Copyright (C) 2023 The R Foundation for Statistical Computing
Platform: aarch64-apple-darwin20 (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(goSorensen)



Attaching package: 'goSorensen'

The following object is masked from 'package:utils':

    upgrade

> 
> testError <- function(e) {return(e)}
> 
> tryCatch(dSorensen("Sec1", onto = "BP"), error = testError)
<simpleError in buildEnrichTable.character(x, y, check.table = check.table, ...): Argument 'y' is missing, 'x' and 'y' must be 'character' vectors of valid gene identifiers>
> 
> data(allOncoGeneLists)
> ?allOncoGeneLists
allOncoGeneLists          package:goSorensen           R Documentation

_7 _g_e_n_e _l_i_s_t_s _p_o_s_s_i_b_l_y _r_e_l_a_t_e_d _w_i_t_h _c_a_n_c_e_r

_D_e_s_c_r_i_p_t_i_o_n:

     An object of class "list" of length 7. Each one of its elements is
     a "character" vector of gene identifiers. Only gene lists of
     length almost 100 were taken from their source web. Take these
     lists just as an illustrative example, they are not automatically
     updated.

_U_s_a_g_e:

     data(allOncoGeneLists)
     
_F_o_r_m_a_t:

     An object of class "list" of length 7. Each one of its elements is
     a "character" vector of gene identifiers.

_S_o_u_r_c_e:

     <http://www.bushmanlab.org/links/genelists>


> data(humanEntrezIDs)
> 
> # Non-sense random gene lists. Generating Entrez-like gene identifiers, but random:
> set.seed(1234567)
> genList1 <- unique(as.character(sample.int(99999, size = 100)))
> genList2 <- unique(as.character(sample.int(99999, size = 100)))
> # Gene identifiers are numbers like Entrez identifiers at 'humanEntrezIDs', but random.
> dSorensen(genList1, genList2,
+           listNames = c("genList1", "genList2"),
+           onto = "BP", GOLevel = 5,
+           geneUniverse = humanEntrezIDs, orgPackg = "org.Hs.eg.db")
[1] NaN
> duppSorensen(genList1, genList2,
+              listNames = c("genList1", "genList2"),
+              onto = "BP", GOLevel = 5,
+              geneUniverse = humanEntrezIDs, orgPackg = "org.Hs.eg.db")
[1] NaN
> seSorensen(genList1, genList2,
+            listNames = c("genList1", "genList2"),
+            onto = "BP", GOLevel = 5,
+            geneUniverse = humanEntrezIDs, orgPackg = "org.Hs.eg.db")
[1] NaN
> nonSenseTst <- equivTestSorensen(genList1, genList2,
+                                  listNames = c("genList1", "genList2"),
+                                  onto = "BP", GOLevel = 5,
+                                  geneUniverse = humanEntrezIDs, orgPackg = "org.Hs.eg.db")
> nonSenseTst

	No test performed due not finite (d - d0) / se statistic

data:  tab
(d - d0) / se = NaN, p-value = NA
alternative hypothesis: true equivalence limit d0 is less than 0.4444444
95 percent confidence interval:
   0 NaN
sample estimates:
Sorensen dissimilarity 
                   NaN 
attr(,"se")
standard error 
           NaN 

> tab <- getTable(nonSenseTst)
> tab
                    Enriched in genList2
Enriched in genList1 TRUE FALSE
               TRUE     0     0
               FALSE    0 10200
> # Or, alternatively:
> tab <- buildEnrichTable(genList1, genList2,
+                         listNames = c("genList1", "genList2"),
+                         onto = "BP", GOLevel = 5,
+                         geneUniverse = humanEntrezIDs, orgPackg = "org.Hs.eg.db")
> tab
                    Enriched in genList2
Enriched in genList1 TRUE FALSE
               TRUE     0     0
               FALSE    0 10200
> dSorensen(tab)
[1] NaN
> duppSorensen(tab)
[1] NaN
> seSorensen(tab)
[1] NaN
> equivTestSorensen(tab)

	No test performed due not finite (d - d0) / se statistic

data:  tab
(d - d0) / se = NaN, p-value = NA
alternative hypothesis: true equivalence limit d0 is less than 0.4444444
95 percent confidence interval:
   0 NaN
sample estimates:
Sorensen dissimilarity 
                   NaN 
attr(,"se")
standard error 
           NaN 

> 
> # Even more non-sense, letters non numeric-style like those at 'humanEntrezIDs':
> set.seed(1234567)
> genList1 <- unique(vapply(seq_len(100), function(i) {
+   paste0(sample(c(letters, LETTERS), 6, replace = TRUE), collapse = "")
+ }, FUN.VALUE = character(1)))
> genList2 <- unique(vapply(seq_len(100), function(i) {
+   paste0(sample(c(letters, LETTERS), 6, replace = TRUE), collapse = "")
+ }, FUN.VALUE = character(1)))
> 
> # Gene identifiers incompatible with those at 'humanEntrezIDs':
> dSorensen(genList1, genList2,
+           listNames = c("genList1", "genList2"),
+           onto = "BP", GOLevel = 5,
+           geneUniverse = humanEntrezIDs, orgPackg = "org.Hs.eg.db")
--> No gene can be mapped....
--> Expected input gene ID: 3400,8614,222698,2683,284359,56979
--> return NULL...
--> No gene can be mapped....
--> Expected input gene ID: 55231,132612,3479,342977,84688,9289
--> return NULL...
[1] NaN
> duppSorensen(genList1, genList2,
+              listNames = c("genList1", "genList2"),
+              onto = "BP", GOLevel = 5,
+              geneUniverse = humanEntrezIDs, orgPackg = "org.Hs.eg.db")
--> No gene can be mapped....
--> Expected input gene ID: 2068,22803,221400,734,51433,373863
--> return NULL...
--> No gene can be mapped....
--> Expected input gene ID: 84464,10007,54456,5872,91603,84072
--> return NULL...
[1] NaN
> seSorensen(genList1, genList2,
+            listNames = c("genList1", "genList2"),
+            onto = "BP", GOLevel = 5,
+            geneUniverse = humanEntrezIDs, orgPackg = "org.Hs.eg.db")
--> No gene can be mapped....
--> Expected input gene ID: 100125288,151254,23641,5892,4986,128637
--> return NULL...
--> No gene can be mapped....
--> Expected input gene ID: 1082,431705,51298,57446,117144,6781
--> return NULL...
[1] NaN
> nonSenseTst <- equivTestSorensen(genList1, genList2,
+                                  listNames = c("genList1", "genList2"),
+                                  onto = "BP", GOLevel = 5,
+                                  geneUniverse = humanEntrezIDs, orgPackg = "org.Hs.eg.db")
--> No gene can be mapped....
--> Expected input gene ID: 2192,4342,6118,2069,8747,207
--> return NULL...
--> No gene can be mapped....
--> Expected input gene ID: 51361,5810,23626,79915,147912,7314
--> return NULL...
> nonSenseTst

	No test performed due not finite (d - d0) / se statistic

data:  tab
(d - d0) / se = NaN, p-value = NA
alternative hypothesis: true equivalence limit d0 is less than 0.4444444
95 percent confidence interval:
   0 NaN
sample estimates:
Sorensen dissimilarity 
                   NaN 
attr(,"se")
standard error 
           NaN 

> tab <- getTable(nonSenseTst)
> tab
                    Enriched in genList2
Enriched in genList1 TRUE FALSE
               TRUE     0     0
               FALSE    0 10200
> # Or, alternatively:
> tab <- buildEnrichTable(genList1, genList2,
+                         listNames = c("genList1", "genList2"),
+                         onto = "BP", GOLevel = 5,
+                         geneUniverse = humanEntrezIDs, orgPackg = "org.Hs.eg.db")
--> No gene can be mapped....
--> Expected input gene ID: 581,84519,23318,23705,91,409
--> return NULL...
--> No gene can be mapped....
--> Expected input gene ID: 84231,49,133308,406949,92667,55063
--> return NULL...
> tab
                    Enriched in genList2
Enriched in genList1 TRUE FALSE
               TRUE     0     0
               FALSE    0 10200
> dSorensen(tab)
[1] NaN
> duppSorensen(tab)
[1] NaN
> seSorensen(tab)
[1] NaN
> equivTestSorensen(tab)

	No test performed due not finite (d - d0) / se statistic

data:  tab
(d - d0) / se = NaN, p-value = NA
alternative hypothesis: true equivalence limit d0 is less than 0.4444444
95 percent confidence interval:
   0 NaN
sample estimates:
Sorensen dissimilarity 
                   NaN 
attr(,"se")
standard error 
           NaN 

> 
> proc.time()
   user  system elapsed 
288.182   7.528 450.650 

Example timings

goSorensen.Rcheck/goSorensen-Ex.timings

nameusersystemelapsed
allEquivTestSorensen0.0000.0010.000
buildEnrichTable20.630 1.79334.399
dSorensen0.1150.0780.342
duppSorensen0.1980.0500.412
equivTestSorensen0.1430.0050.229
getDissimilarity0.2800.1180.658
getEffNboot1.3180.0632.139
getNboot1.3090.0582.124
getPvalue0.2780.1200.675
getSE0.2850.1210.677
getTable0.3150.1460.794
getUpper0.2660.1150.634
nice2x2Table0.0030.0010.006
pbtAllOntosAndLevels0.1220.0520.299
seSorensen0.0020.0020.006
upgrade0.8830.2471.814