limma (Linear Models for Microarray Data), is a package for the analysis of gene expression data arising from microarray or RNA-seq technologies [32]. A core capability is the use of linear models to assess differential expression in the context of multi-factor designed experiments. Limma provides the ability to analyze comparisons between many RNA targets simultaneously. It has features that make the analyses stable even for experiments with small number of arrays—this is achieved by borrowing information across genes. It is specially designed for analysing complex experiments with a variety of experimental conditions and predictors. The linear model and differential expression functions are applicable to data from any quantitative gene expression technology including microarrays, RNA-seq and quantitative PCR. Limma can handle both single-channel and two-color microarrays.

#Normalization and filtering
dge <- DGEList(counts=counts)

# keep <- filterByExpr(dge, design)
# dge <- dge[keep,,keep.lib.sizes=FALSE]
# dge <- calcNormFactors(dge)

# logCPM <- cpm(dge, log=TRUE, prior.count=3)

#Differential expression
condition=factor(c('treat','treat','ctrl','ctrl'),levels=c('ctrl','treat'))
design <- model.matrix(~condition)

fit <- lmFit(logCPM, design)
fit <- eBayes(fit, trend=TRUE)
topTable(fit, coef=ncol(design))