> sessionInfo() R version 3.2.4 (2016-03-10) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 7 x64 (build 7601) Service Pack 1 locale: [1] LC_COLLATE=Norwegian (Bokmål)_Norway.1252 LC_CTYPE=Norwegian (Bokmål)_Norway.1252 LC_MONETARY=Norwegian (Bokmål)_Norway.1252 LC_NUMERIC=C [5] LC_TIME=Norwegian (Bokmål)_Norway.1252 attached base packages: [1] splines parallel stats graphics grDevices utils datasets methods base other attached packages: [1] edgeR_3.2.4 limma_3.26.3 DESeq_1.12.1 lattice_0.20-33 locfit_1.5-9.1 Biobase_2.20.1 BiocGenerics_0.6.0 loaded via a namespace (and not attached): [1] IRanges_1.18.4 XML_3.98-1.1 grid_3.2.4 xtable_1.7-4 DBI_0.3.1 stats4_3.2.4 RSQLite_0.11.4 genefilter_1.42.0 [9] annotate_1.38.0 RColorBrewer_1.0-5 tools_3.2.4 geneplotter_1.38.0 survival_2.38-3 AnnotationDbi_1.22.6 > library(edgeR) ## Read in the data making the row names the first column counttable <- read.table("allcounts.txt", header=T, row.names=1) ## Make metadata data.frame meta <- data.frame( row.names=colnames(counttable), condition=c("Bad","Good") #repeated until n=5/4 "Good" and 5/6 "Bad" for Landrace/Duroc, according to counttable meta$condition <- relevel(meta$condition, ref="Good") ## Make design matrix condition <- relevel(factor(meta$condition), ref="Good") edesign <- model.matrix(~condition) ## Make new DGEList, normalize by library size, and estimate dispersion allowing possible trend with average count size e <- DGEList(counts=counttable) dim(e) keep <- rowSums(cpm(e)>1) >=n/2 #filtering: keep genes that achieve at least one count per million in at least half of the samples e <- e[keep,] dim(e) e$samples$lib.size <- colSums(e$counts) e <- calcNormFactors(e, method="TMM") e <- estimateGLMCommonDisp(e, edesign) e <- estimateGLMTrendedDisp(e, edesign) e <- estimateGLMTagwiseDisp(e, edesign) ## Fit the model, testing the coefficient for the Good vs Bad comparison efit <- glmFit(e, edesign) efit <- glmLRT(efit, coef="conditionBad") ## Make a table of results etable <- topTags(efit, n=nrow(e))$table etable <- etable[order(etable$FDR), ]