Learn R Programming

GreyListChIP (version 1.4.0)

calcThreshold-methods: Calculate Read Count Threshold

Description

Based on the counts from countReads, sample counts from the set several times, estimate the parameters of the negative binomial distribution for each sample, then calculate the mean of the parameters (size and mu). Use these values to calculate the read count threshold, given the specified p-value threshold.

Usage

calcThreshold(obj, reps=100, sampleSize=30000, p=0.99,cores=1)

Arguments

obj
A GreyList object for which to calculate the threshold.
reps
The number of times to sample bins and estimate the parameters of the negative binomial distribution.
sampleSize
The number of bins to sample on each repetition.
p
The p-value threshold for marking bins as ``grey''.
cores
The number of CPU cores (parallel threads) to use when sampling repeatedly from the set of counts

Value

GreyList object, with the threshold added.

Details

This method samples from the set of counts generated during the countReads step. Each sample is fitted to the negative binomial distribution, and the parameters estimated. The means of the mu and size parameters is calculated, then used to choose a read count threshold, given the p-value cutoff provided. If cores is given, the process will use that many cores to parallelize the parameter estimation.

References

Venables, W. N. and Ripley, B. D. (2002) Modern Applied Statistics with S. Fourth edition. Springer.

Examples

Run this code
# Load a pre-built R object with counts.
data(greyList)

# Calculate the threshold:
gl <- calcThreshold(gl,reps=10,sampleSize=1000,p=0.99,cores=1)

Run the code above in your browser using DataLab