fisherTests | R Documentation |
A function to compute Fisher-tests for an object of class BSseq
.
fisherTests(BSseq, group1, group2, lookup = NULL,
returnLookup = TRUE, mc.cores = 1, verbose = TRUE)
BSseq |
An object of class |
group1 |
A vector of sample names or indexes for the ‘treatment’ group. |
group2 |
A vector of sample names or indexes for the ‘control’ group. |
lookup |
A ‘lookup’ object, see details. |
returnLookup |
Should a ‘lookup’ object be returned, see details. |
mc.cores |
The number of cores used. Note that setting
|
verbose |
Should the function be verbose. |
This function computes row-wise Fisher's exact tests. It uses an
internal lookup table so rows which forms equivalent 2x2 tables are
group together and only a single test is computed. If
returnLookup
is TRUE
the return object contains the
lookup table which may be feed to another call to the function using
the lookup
argument.
If group1
, group2
designates more than 1 sample, the
samples are added together before testing.
This function can use multiple cores on the same computer.
This test cannot model biological variability.
if returnLookup
is TRUE
, a list with components
results
and lookup
, otherwise just the results
component. The results
(component) is a matrix with the same
number of rows as the BSseq
argument and 2 columns
p.value
(the unadjusted p-values) and log2OR
(log2
transformation of the odds ratio).
Kasper Daniel Hansen khansen@jhsph.edu
fisher.test for information about Fisher's test.
mclapply
for the mc.cores
argument.
M <- matrix(1:9, 3,3)
colnames(M) <- c("A1", "A2", "A3")
BStest <- BSseq(pos = 1:3, chr = c("chr1", "chr2", "chr1"),
M = M, Cov = M + 2)
results <- fisherTests(BStest, group1 = "A1", group2 = "A2",
returnLookup = TRUE)
results
#-------------------------------------------------------------------------------
# An example using a HDF5Array-backed BSseq object
#
library(HDF5Array)
# See ?SummarizedExperiment::saveHDF5SummarizedExperiment for details
hdf5_BStest <- saveHDF5SummarizedExperiment(x = BStest,
dir = tempfile())
results <- fisherTests(hdf5_BStest,
group1 = "A1",
group2 = "A2",
returnLookup = TRUE)
results
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.