bsseq (version 1.8.2)

fisherTests: Compute Fisher-tests for a BSseq object

Description

A function to compute Fisher-tests for an object of class BSseq.

Usage

fisherTests(BSseq, group1, group2, lookup = NULL, returnLookup = TRUE, mc.cores = 1, verbose = TRUE)

Arguments

BSseq
An object of class BSseq.
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 mc.cores to a value greater than 1 is not supported on MS Windows, see the help page for mclapply.
verbose
Should the function be verbose.

Value

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

Details

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.

See Also

fisher.test for information about Fisher's test. mclapply for the mc.cores argument.

Examples

Run this code
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

Run the code above in your browser using DataLab