FisherTest {MethylIT}R Documentation

Fisher's exact test for read counts on GRanges objects

Description

Given a GRanges object with the methylated and unmethylated read counts for control and treatment in its metacolumn, Fisher's exact test is performed for each cytosine site.

Usage

FisherTest(LR, count.col = c(1, 2), control.names = NULL,
  treatment.names = NULL, pooling.stat = "sum", tv.cut = NULL,
  hdiv.cut = NULL, hdiv.col = NULL, pAdjustMethod = "BH",
  pvalCutOff = 0.05, saveAll = FALSE, num.cores = 1L, tasks = 0L,
  verbose = FALSE, ...)

Arguments

LR

A list of GRanges, a GRangesList, a CompressedGRangesList object, or an object from Methyl-IT downstream analyses: 'InfDiv' or "pDMP" object. Each GRanges object from the list must have two columns: methylated (mC) and unmethylated (uC) counts. The name of each element from the list must coincide with a control or a treatment name.

count.col

2d-vector of integers with the indexes of the read count columns. If not given, then it is asssumed that the methylated and unmethylated read counts are located in columns 1 and 2 of each GRanges metacolumns. If object LR is the output of Methyl-IT function estimateDivergence, then columns 1:4 are the read count columns: columns 1 and 2 are methylated and unmethylated read counts from the reference group, while columns 3 and 4 are methylated and unmethylated read counts from the treatment group, respectively. In this case, if the requested comparison is reference versus treatment, then no specification is needed for count.col. The comparison control versus treatment can be obtained by setting count.col = 3:4 and providing control.names and treatment.names.

control.names, treatment.names

Names/IDs of control and treatment samples, which must be included in the variable GR at the metacolumn. Default NULL. If provided the Fisher's exact test control versus trearment is performed. Default is NULL. If NULL, then it is assumed that each GRanges object in LR has four columns of counts. The first two columns correspond to the methylated and unmethylated counts from control/reference and the other two columns are the methylated and unmethylated counts from treatment, respectively.

pooling.stat

statistic used to estimate the methylation pool: row sum, row mean or row median of methylated and unmethylated read counts across individuals. If the number of control samples is greater than 2 and pooling.stat is not NULL, then they will pooled. The same for treatment. Otherwise, all the pairwise comparisons will be done.

tv.cut

A cutoff for the total variation distance (TVD; absolute value of methylation levels differences) estimated at each site/range as the difference of the group means of methylation levels. If tv.cut is provided, then sites/ranges k with abs(TV_k) < tv.cut are removed before performing the regression analysis. Its value must be NULL or a number 0 < tv.cut < 1.

hdiv.cut

An optional cutoff for the Hellinger divergence (*hdiv*). If the LR object derives from the previous application of function estimateDivergence, then a column with the *hdiv* values is provided. If combined with tv.cut, this permits a more effective filtering of the signal from the noise. Default is NULL.

hdiv.col

Optional. Columns where *hdiv* values are located in each GRange object from LR. It must be provided if together with *hdiv.cut*. Default is NULL.

pAdjustMethod

method used to adjust the results; default: BH

pvalCutOff

cutoff used then a p-value adjustment is performed

saveAll

if TRUE all the temporal results are returned

num.cores

The number of cores to use, i.e. at most how many child processes will be run simultaneously (see bpapply function from BiocParallel).

tasks

integer(1). The number of tasks per job. value must be a scalar integer >= 0L. In this documentation a job is defined as a single call to a function, such as bplapply, bpmapply etc. A task is the division of the X argument into chunks. When tasks == 0 (default), X is divided as evenly as possible over the number of workers (see MulticoreParam from BiocParallel package).

verbose

if TRUE, prints the function log to stdout

...

Additional parameters for function uniqueGRanges.

Details

Samples from each group are pooled according to the statistic selected (see parameter pooling.stat) and a unique GRanges object is created with the methylated and unmethylated read counts for each group (control and treatment) in the metacolumn. So, a contingency table can be built for range from GRanges object.

Value

The input GRanges object with the columns of Fisher's exact test p-value, total variation (difference of methylation levels), and p-value adjusment.

See Also

rmstGR

Examples

## Get a dataset of Hellinger divergency of methylation levels
## from the package
data(HD)
## Only the first four cytosine sites from each sample are tested
hd <- lapply(HD, function(hd) hd[1:4])

FisherTest(LR = hd, pooling.stat = "sum",
        treatment.names = c("T1", "T2"), tv.cut = NULL,
        pAdjustMethod="BH", pvalCutOff = 0.05, num.cores = 1L,
        verbose=FALSE)


[Package MethylIT version 0.3.1 ]