Sample code for edgeR and DESeq for differential expressed gene
Best step-by-step code
http://www.nbic.nl/uploads/media/Practical_DiffExpr.pdf
Comparision of edgeR and DESeq
http://gettinggeneticsdone.blogspot.com/2012/09/deseq-vs-edger-comparison.html
# edgeR
========## Make design matrixcondition < relevel(factor(meta$condition), ref="untreated")libType < factor(meta$libType)edesign < model.matrix(~libType+condition)## Make new DGEList, normalize by library size, and estimate dispersion allowinge < DGEList(counts=counttable)
possible trend with average count sizee < calcNormFactors(e)e < estimateGLMCommonDisp(e, edesign)e < estimateGLMTrendedDisp(e, edesign)e < estimateGLMTagwiseDisp(e, edesign)## MDS PlotplotMDS(e, main="edgeR MDS Plot")## Biological coefficient of variation plotplotBCV(e, cex=0.4, main="edgeR: Biological coefficient of variation (BCV) vs abundance")## Fit the model, testing the coefficient for the treated vs untreated comparisonefit < glmFit(e, edesign)efit < glmLRT(efit, coef="conditiontreated")## Make a table of resultsetable < topTags(efit, n=nrow(e))$tableetable < etable[order(etable$FDR), ]head(etable)## ~MA Plotwith(etable, plot(logCPM, logFC, pch=20, main="edgeR: Fold change vs abundance"))with(subset(etable, FDR<0.05), points(logCPM, logFC, pch=20, col="red"))abline(h=c(-1,1), col="blue")
Comments
Post a Comment