# Example taken from edgeR documentation:
# generate raw counts from NB, create list object
# this creates 50 genes across 4 samples, 2 from each group
y <- matrix(rnbinom(50*4,size=1/0.2,mu=10),nrow=50,ncol=4)
d <- DGEList(counts=y, group=c(1,1,2,2), lib.size=colSums(y))
d <- calcNormFactors(d)
d <- estimateCommonDisp(d)
d <- estimateTagwiseDisp(d)
#using edgeR CONDITIONAL exact test
de.edgeR <- exactTest(d)
topTags(de.edgeR)
#using edgeRun, UNCONDITIONAL exact test
#argument 'upper' specifies the number of iterations
#higher values give more accurate p-values but take longer to run.
#The example below uses upper=10,000 for speed, but we highly
#recommend to use at least 50,000.
#See Supplementary Methods (Dimont, et al. 2014) for details
de.edgeRun <- UCexactTest(d,upper=10000)
topTags(de.edgeRun)
Run the code above in your browser using DataLab