Skip to content

edgeR

DESeq2 is one of three standard routes from a count matrix to a differential expression table. The other two are edgeR and limma-voom. edgeR keeps the negative binomial model that DESeq2 uses and differs in the details: TMM normalization instead of size factors, a filter that reads the design, and a different test. Its recommended route for bulk RNA-seq is the quasi-likelihood F-test, which adds a second, gene-wise layer of variability on top of the negative binomial and accounts for the uncertainty in estimating it. On a design with eight samples, that uncertainty is large.

The model is the one the DESeq2 page fits, ~ cell + dex, so the treatment effect is estimated within each donor cell line. airway ships dex with trt as its first level, and without a relevel the coefficient would measure untreated against treated, with every sign reversed.

The count object comes from Michael Love’s airway 1.32.0 data package, which declares LGPL. It represents the Himes and colleagues experiment, deposited as GSE52778 and SRP033351. The source and license notice identifies the original object. This lesson derives its summaries and analysis results from that object.

library(edgeR)
library(airway)
data(airway)
counts <- assay(airway, "counts")
samples <- as.data.frame(colData(airway))[, c("cell", "dex")]
# Make untreated the reference, so the dex coefficient is treated against
# untreated, as on the DESeq2 page.
samples$dex <- relevel(samples$dex, ref = "untrt")
design <- model.matrix(~ cell + dex, data = samples)
colnames(design)
[1] "(Intercept)" "cellN061011" "cellN080611" "cellN61311" "dextrt"

filterByExpr keeps a gene when it passes two tests. Its count per million must reach a cutoff in enough samples, and its total count across all samples must reach min.total.count, a fixed 15 by default. The cutoff is min.count, 10 reads by default, divided by the median library size in millions, so it moves with the library sizes. The number of samples is the size of the smallest group when you pass group. With a design matrix and no group, as here, it is the inverse of the largest hat value of the design. TMM then computes one normalization factor per sample, which corrects for composition: a few very highly expressed genes in one sample take reads away from every other gene in that sample. A factor below 1 marks a library where a small number of high-count genes take a larger share of the reads, so its other genes count lower than its size suggests.

The edgeR filterByExpr reference documents this filter and subsetting pattern. The lesson also resets library sizes. The review has not established its original tutorial source.

y <- DGEList(counts = counts, samples = samples)
keep <- filterByExpr(y, design)
y <- y[keep, , keep.lib.sizes = FALSE]
nrow(y)
# TMM normalization factors, one per sample.
y <- normLibSizes(y)
round(y$samples$norm.factors, 4)
[1] 16860
[1] 1.0563 1.0212 0.9912 0.9483 1.0315 0.9772 1.0281 0.9517

The filter keeps 16,860 of the 63,677 genes. The factors sit between 0.9483 and 1.0563, so composition differs little between these eight libraries.

glmQLFit fits the negative binomial model to every gene and estimates a quasi-dispersion for each one, then shrinks those toward a trend with empirical Bayes. In edgeR 4 the negative binomial dispersion is estimated inside the fit, so the older estimateDisp step is not needed. glmQLFTest then tests the treatment coefficient.

fit <- glmQLFit(y, design)
qlf <- glmQLFTest(fit, coef = "dextrt")
topTags(qlf, n = 5)
Coefficient: dextrt
logFC logCPM F PValue FDR
ENSG00000165995 3.282605 4.530757 1548.3908 8.202643e-11 1.283926e-06
ENSG00000109906 7.152969 4.170502 1379.1228 1.523044e-10 1.283926e-06
ENSG00000146250 -2.759652 3.892495 794.4904 1.321372e-09 4.670691e-06
ENSG00000162493 1.884502 5.684448 780.6381 1.420768e-09 4.670691e-06
ENSG00000168309 4.728702 2.873491 722.9692 1.515272e-09 4.670691e-06

The signs agree with DESeq2. ENSG00000165995 has a log fold change of 3.28 here and 3.29 on the DESeq2 page, and it is also the top gene of limma-voom. The F statistic takes the place of the Wald statistic as the column that ranks the genes, and FDR is the Benjamini-Hochberg adjusted p-value.

summary(decideTests(qlf, p.value = 0.05))
dextrt
Down 2506
NotSig 11738
Up 2616

edgeR calls 5,122 genes at an FDR of 0.05, 2,616 up and 2,506 down, out of the 16,860 it tested. On the same samples DESeq2 calls 4,000 of 18,032 and limma-voom 5,014 of 15,926. The three filters keep different numbers of genes, so these counts do not rank the methods. A gene that passes in all three is less sensitive to the choice of method, but the three fits use the same samples, so the agreement gives no error bound for that gene.

Package Model and test Use it when
DESeq2 negative binomial, Wald test the standard choice, with fold change shrinkage built in
edgeR negative binomial, quasi-likelihood F-test the design is small and false discovery control matters most
limma-voom linear model on log-counts the design is complex, the study is large, or the lab already runs limma on microarrays

Himes and colleagues, 2014 report the airway smooth muscle RNA-seq experiment that the airway data package holds.

Chen and colleagues, 2025 describe edgeR version 4 and its differential analysis of sequencing count data.

The edgeR filterByExpr reference explains how the design and library sizes determine the expression filter. It helps interpret the genes retained for this paired comparison.

The edgeR quasi-likelihood reference defines the fitted model and tested coefficient. Read it before interpreting the treatment contrast or choosing a likelihood-ratio test.