getNboot: Access to the number of initially planned bootstrap...

View source: R/getNboot.R

getNbootR Documentation

Access to the number of initially planned bootstrap replicates in one or more equivalence test results (only in their bootstrap version)

Description

Given objects representing the result(s) of one or more equivalence tests (classes "equivSDhtest", "equivSDhtestList" or "allEquivSDtest", i.e., the result of functions 'equivTestSorensen' and 'allEquivTestSorensen' with the parameter boot = TRUE), this function returns the number of initially planned bootstrap replicates in these equivalence tests, which may be greater than the number of finally effective or valid bootstrap replicates. See the details section for more information on this.

Usage

getNboot(x, ...)

## S3 method for class 'equivSDhtest'
getNboot(x, ...)

## S3 method for class 'equivSDhtestList'
getNboot(x, simplify = TRUE, ...)

## S3 method for class 'AllEquivSDhtest'
getNboot(x, onto, GOLevel, listNames, simplify = TRUE, ...)

Arguments

x

an object of class "equivSDhtest" or "equivSDhtestList" or "allEquivSDtest".

...

Additional parameters.

simplify

logical, if TRUE the result is simplified, e.g., returning a vector instead of a matrix.

onto

character, a vector with one or more of "BP", "CC" or "MF", ontologies to access.

GOLevel

numeric or character, a vector with one or more GO levels to access. See the details section and the examples.

listNames

character(2), the names of a pair of gene lists.

Details

In the bootstrap version of the equivalence test, resampling is performed generating new bootstrap contingency tables from a multinomial distribution based on the "real", observed, frequencies of mutual enrichment. In some bootstrap iterations, the generated contingency table of mutual enrichment may have very low frequencies of enrichment, which makes it unable for Sorensen-Dice computations. Then, the number of effective bootstrap resamples may be lower than those initially planned. To get the number of effective bootstrap resamples use function getEffNboot.

Argument GOLevel can be of class "character" or "numeric". In the first case, the GO levels must be specified like "level 6" or c("level 4", "level 5", "level 6") In the second case ("numeric"), the GO levels must be specified like6 or seq.int(4,6).

Value

When x is an object of class "equivSDhtest" (i.e., the result of a single equivalence test), the returned value is a single numeric value, the number of initially planned bootstrap replicates, or NA if bootstrapping has not been performed. For an object of class "equivSDhtestList" (i.e. all pairwise tests for a set of gene lists), if simplify = TRUE (the default), the resulting value is a vector with the number of initially bootstrap replicates in all those tests, or the symmetric matrix of all these values if simplify = TRUE. If x is an object of class "allEquivSDtest" (i.e., the test iterated along GO ontologies and levels), the preceding result is returned in the form of a list along the ontologies, levels and pairs of gene lists specified by the arguments onto, GOlevel and listNames (or all present in x for missing arguments).

Methods (by class)

  • getNboot(equivSDhtest): S3 method for class "equivSDhtest"

  • getNboot(equivSDhtestList): S3 method for class "equivSDhtestList"

  • getNboot(AllEquivSDhtest): S3 method for class "AllEquivSDhtest"

See Also

getEffNboot

Examples

# Dataset 'allOncoGeneLists' contains the result of the equivalence test between gene lists
# 'sanger' and 'atlas', at level 4 of the BP ontology:
data(eqTest_atlas.sanger_BP4)
eqTest_atlas.sanger_BP4
class(eqTest_atlas.sanger_BP4)
# This may correspond to the result of code like:
# eqTest_atlas.sanger_BP4 <- equivTestSorensen(
#   allOncoGeneLists[["sanger"]], allOncoGeneLists[["atlas"]],
#   geneUniverse = humanEntrezIDs, orgPackg = "org.Hs.eg.db",
#   onto = "BP", GOLevel = 4, listNames = c("sanger", "atlas"))
#
# (But results may vary according to GO updating)

# Not a bootstrap test, first upgrade to a bootstrap test:
boot.eqTest_atlas.sanger_BP4 <- upgrade(eqTest_atlas.sanger_BP4, boot = TRUE)

getNboot(eqTest_atlas.sanger_BP4)
getNboot(boot.eqTest_atlas.sanger_BP4)

# All pairwise equivalence tests at level 4 of the BP ontology
data(eqTest_all_BP4)
?eqTest_all_BP4
class(eqTest_all_BP4)
# This may correspond to a call like:
# eqTest_all_BP4 <- equivTestSorensen(allOncoGeneLists,
#                           geneUniverse = humanEntrezIDs, orgPackg = "org.Hs.eg.db",
#                           onto = "BP", GOLevel = 4)
boot.eqTest_all_BP4 <- upgrade(eqTest_all_BP4, boot = TRUE)
getNboot(eqTest_all_BP4)
getNboot(boot.eqTest_all_BP4)
getNboot(boot.eqTest_all_BP4, simplify = FALSE)

# Bootstrap equivalence test iterated over all GO ontologies and levels 3 to 10.
# data(allEqTests)
# ?allEqTests
# class(allEqTests)
# This may correspond to code like:
# (By default, the tests are iterated over all GO ontologies and for levels 3 to 10)
# allEqTests <- allEquivTestSorensen(allOncoGeneLists,
#                                             geneUniverse = humanEntrezIDs,
#                                             orgPackg = "org.Hs.eg.db",
#                                             boot = TRUE)
# boot.allEqTests <- upgrade(allEqTests, boot = TRUE)
# All numbers of bootstrap replicates:
# getNboot(boot.allEqTests)
# getNboot(boot.allEqTests, simplify = FALSE)

# Number of bootstrap replicates for specific GO ontologies, levels or pairs of gene lists:
# getNboot(boot.allEqTests, GOLevel = "level 6")
# getNboot(boot.allEqTests, GOLevel = 6)
# getNboot(boot.allEqTests, GOLevel = seq.int(4,6))
# getNboot(boot.allEqTests, GOLevel = "level 6", simplify = FALSE)
# getNboot(boot.allEqTests, GOLevel = "level 6", listNames = c("atlas", "sanger"))
# getNboot(boot.allEqTests, GOLevel = seq.int(4,6), onto = "BP")
# getNboot(boot.allEqTests, GOLevel = seq.int(4,6), onto = "BP", simplify = FALSE)
# getNboot(boot.allEqTests, GOLevel = "level 6", onto = "BP",
#          listNames = c("waldman", "sanger"))
# getNboot(boot.allEqTests$BP$`level 4`)


pablof1988/goSorensen documentation built on Dec. 15, 2024, 12:01 p.m.