- Published on
- 10 min read
DESeq2 vs edgeR: which one should you use and does it actually matter?
- Authors

- Name
- BioTech Bench
Table of contents
- The Bioinformatics Holy War
- 1. Normalization: Median-of-Ratios vs TMM
- 2. Statistical Machinery: Wald vs QL F-Test
- 3. Outlier Handling: Filtration vs Robust Fitting
- Code: Comparing them on the airway dataset
- Summary Comparison: DESeq2 vs edgeR
- The Verdict: Which should you use?
- What's next?
- Additional Resources
This is Arc 3, Part 15 of the R for Biologists series.
Updated November 2026: the comparison now runs both tools on the real airway RNA-seq dataset, and every output was produced by running the code shown. An earlier version displayed results that did not come from running the packages, and misdescribed edgeR's robust option.
The Bioinformatics Holy War
If you walk into a room of computational biologists and ask whether they prefer DESeq2 or edgeR, you are likely to trigger a passionate, hour-long debate.
Both packages are absolute titans. Together, they account for the vast majority of RNA-seq differential expression analyses published in the last decade. Both are hosted on Bioconductor, run in R, use the Negative Binomial distribution to model count variance, and estimate dispersion parameters by sharing information across genes.
But under the hood, they make different mathematical design decisions.
As a bench biologist writing a paper, which one should you choose? More importantly: does your choice actually change the biological conclusions of your study?
Let's put them head-to-head on the same dataset to find out.
1. Normalization: Median-of-Ratios vs TMM
Before fitting statistical models, both packages calculate scaling factors to correct for library size and composition effects. They do this differently:
- DESeq2 (Median-of-Ratios): Creates a "pseudo-reference" sample by taking the geometric mean of each gene across all samples. It then calculates the ratio of each sample's counts to this reference. The median of these ratios for a given sample becomes its scaling factor.
- edgeR (Trimmed Mean of M-values / TMM): Assumes that the majority of genes are not differentially expressed. It chooses one sample as a reference, calculates log-fold-changes (M-values) relative to it, trims away the top and bottom 30% of M-values (and top/bottom 5% of average intensities), and calculates a weighted mean of the remaining genes.
Does it matter?
Almost never. On typical datasets the two methods produce nearly identical scaling factors. On the airway data below they correlate at . They only diverge meaningfully in unusual experiments where a large fraction of genes change in the same direction.
2. Statistical Machinery: Wald vs QL F-Test
The core difference lies in how they test for significance:
- DESeq2 default is the Wald Test. It estimates the log2 fold change for a gene, divides it by its standard error, and compares the resulting -statistic to a standard normal distribution to calculate a p-value.
- edgeR modern default is the Quasi-likelihood (QL) F-test. It fits a negative binomial generalized linear model but adds an extra quasi-likelihood dispersion term. This term acts like the error term in a standard ANOVA, accounting for uncertainty in the dispersion estimation itself. It uses an F-distribution rather than a normal distribution, which is mathematically more rigorous when sample sizes are small (e.g. per group).
3. Outlier Handling: Filtration vs Robust Fitting
What happens when a single sample has an abnormally high count for a gene (e.g. due to a PCR clump)?
- DESeq2 calculates Cook's distance for every gene. If a gene has a high Cook's distance (indicating a single outlier sample is driving the effect), DESeq2 automatically sets its p-value and adjusted p-value to
NA. - edgeR does not drop genes this way. Its
robust = TRUEoption (inglmQLFit()) is about outlier genes, not outlier samples: it stops a handful of genes with unusually high variability from distorting the empirical Bayes step that shares information across all genes. If you need to downweight individual outlier observations, edgeR offers a separate robust-weights method,estimateGLMRobustDisp().
Code: Comparing them on the airway dataset
Let's run both tools on the real airway dataset from post 14: airway smooth muscle cells from four donors, each treated with dexamethasone or left untreated. We use the same filtered genes and the same design (~ cell + dex, donor plus treatment) for both, so any difference comes from the tools themselves.
Install edgeR once with BiocManager::install("edgeR"), then set up the data exactly as in post 14:
library(DESeq2)
library(edgeR)
library(airway)
data("airway")
counts <- assay(airway)
coldata <- as.data.frame(colData(airway))[, c("cell", "dex")]
coldata$dex <- relevel(coldata$dex, ref = "untrt")
keep <- rowSums(counts >= 10) >= 4
counts <- counts[keep, ]
symbols <- rowData(airway)[rownames(counts), "gene_name"]
First, the DESeq2 run (quiet = TRUE just hides the progress messages you saw in post 14):
dds <- DESeqDataSetFromMatrix(countData = counts, colData = coldata,
design = ~ cell + dex)
dds <- DESeq(dds, quiet = TRUE)
res_deseq <- as.data.frame(results(dds))
Now the edgeR quasi-likelihood workflow. edgeR uses a design matrix instead of a formula inside the object, so we build one from the same formula:
# 1. Create a DGEList object (counts plus gene annotation)
dge <- DGEList(counts = counts, genes = data.frame(symbol = symbols))
# 2. TMM normalization (called calcNormFactors() in older edgeR versions)
dge <- normLibSizes(dge)
# 3. Design matrix: donor + treatment
design <- model.matrix(~ cell + dex, data = coldata)
colnames(design)
[1] "(Intercept)" "cellN061011" "cellN080611" "cellN61311" "dextrt"
The last column, dextrt, is the treatment effect we want to test. The cell columns soak up donor-to-donor differences, just as in DESeq2.
# 4. Fit the quasi-likelihood model and test the treatment coefficient
fit <- glmQLFit(dge, design, robust = TRUE)
qlf <- glmQLFTest(fit, coef = "dextrt")
# 5. Top genes
topTags(qlf, n = 10)
Coefficient: dextrt
symbol logFC logCPM F PValue FDR
ENSG00000165995 CACNB2 3.281423 4.530775 1570.4439 1.052835e-10 1.699170e-06
ENSG00000109906 ZBTB16 7.151605 4.170124 1369.8055 2.113165e-10 1.705219e-06
ENSG00000146250 PRSS35 -2.760920 3.893322 798.8250 1.677950e-09 5.962860e-06
ENSG00000162493 PDPN 1.883342 5.685026 791.0205 1.745665e-09 5.962860e-06
ENSG00000168309 FAM107A 4.728673 2.874035 726.0622 1.915629e-09 5.962860e-06
ENSG00000157214 STEAP2 1.968747 7.136631 696.8685 2.928380e-09 5.962860e-06
ENSG00000120129 DUSP1 2.939580 7.315944 679.4830 3.246278e-09 5.962860e-06
ENSG00000250978 RP11-357D18.1 6.168031 1.403800 398.2199 3.294110e-09 5.962860e-06
ENSG00000154930 ACSS1 1.890864 4.970531 668.8619 3.461826e-09 5.962860e-06
ENSG00000106976 DNM1 -1.762872 5.378619 658.2670 3.694690e-09 5.962860e-06
Familiar names (DUSP1, ZBTB16, CACNB2, STEAP2) are already in the top 10. logFC is edgeR's log2 fold change, logCPM is average expression in log counts-per-million, and FDR is the Benjamini-Hochberg adjusted p-value, the equivalent of DESeq2's padj.
How many genes change overall?
summary(decideTests(qlf))
dextrt
Down 2427
NotSig 11182
Up 2530
At FDR < 0.05 with no fold-change cutoff, edgeR calls about 5,000 genes, in the same range as DESeq2's summary() in post 14.
Comparison 1: normalization
Put DESeq2's size factors next to edgeR's effective library sizes, rescaled the same way so they're directly comparable:
sf_deseq <- sizeFactors(dds)
sf_edger <- dge$samples$norm.factors * dge$samples$lib.size
sf_edger <- sf_edger / exp(mean(log(sf_edger)))
round(data.frame(DESeq2 = sf_deseq, edgeR = sf_edger), 3)
cor(sf_deseq, sf_edger)
DESeq2 edgeR
SRR1039508 1.022 1.014
SRR1039509 0.896 0.893
SRR1039512 1.174 1.169
SRR1039513 0.668 0.669
SRR1039516 1.175 1.173
SRR1039517 1.399 1.402
SRR1039520 0.917 0.914
SRR1039521 0.945 0.939
[1] 0.9998772
Different algorithms, practically the same answer. Normalization is not where these tools differ.
Comparison 2: the significant genes
Apply the same cutoffs to both (adjusted p < 0.05 and at least 2-fold change) and count the overlap:
res_edger <- topTags(qlf, n = Inf, sort.by = "none")$table
sig_deseq <- rownames(res_deseq)[which(res_deseq$padj < 0.05 & abs(res_deseq$log2FoldChange) > 1)]
sig_edger <- rownames(res_edger)[res_edger$FDR < 0.05 & abs(res_edger$logFC) > 1]
c(DESeq2 = length(sig_deseq),
edgeR = length(sig_edger),
both = length(intersect(sig_deseq, sig_edger)))
cor(res_deseq$log2FoldChange, res_edger$logFC)
DESeq2 edgeR both
938 1025 907
[1] 0.9974996
907 genes are called by both: 97% of DESeq2's list and 88% of edgeR's. The fold-change estimates correlate at 0.997. (sort.by = "none" keeps edgeR's rows in the same gene order as DESeq2's, so the correlation compares like with like.)
Comparison 3: the genes they disagree on
The disagreements are the interesting part. Look at the 31 genes only DESeq2 calls:
only_deseq <- setdiff(sig_deseq, sig_edger)
summary(abs(res_edger[only_deseq, "logFC"]))
Min. 1st Qu. Median Mean 3rd Qu. Max.
0.9181 0.9683 0.9860 0.9885 0.9967 1.2792
edgeR's fold change for most of them is 0.97 to 1.00: just under the 2-fold line. Both tools see the same gene changing; it lands a hair either side of an arbitrary cutoff.
And the 118 genes only edgeR calls:
only_edger <- setdiff(sig_edger, sig_deseq)
summary(res_deseq[only_edger, "padj"])
Min. 1st Qu. Median Mean 3rd Qu. Max. NA's
0.00000 0.05458 0.07261 0.08500 0.11108 0.30312 55
Two groups. 55 have padj = NA in DESeq2: these are mostly low-count genes that DESeq2's independent filtering set aside (see post 14), which edgeR does not do. Most of the rest have DESeq2 adjusted p-values between 0.05 and 0.11, just missing the cutoff, and a few pass it but fall just short of 2-fold in DESeq2's estimate. Again: borderline genes, not contradictory biology.
Comparison 4: the genes that matter
Finally, the known glucocorticoid-response genes from post 14:
known <- c("FKBP5", "TSC22D3", "PER1", "KLF15", "ZBTB16", "DUSP1", "CRISPLD2")
k <- res_edger$symbol %in% known
data.frame(symbol = res_edger$symbol[k],
DESeq2_lfc = round(res_deseq$log2FoldChange[k], 2),
edgeR_lfc = round(res_edger$logFC[k], 2),
DESeq2_padj = signif(res_deseq$padj[k], 3),
edgeR_FDR = signif(res_edger$FDR[k], 3))
symbol DESeq2_lfc edgeR_lfc DESeq2_padj edgeR_FDR
1 FKBP5 4.04 4.01 7.30e-26 8.90e-05
2 CRISPLD2 2.63 2.62 1.56e-45 1.13e-04
3 ZBTB16 7.35 7.15 2.67e-40 1.71e-06
4 DUSP1 2.94 2.94 1.25e-124 5.96e-06
5 TSC22D3 3.19 3.19 3.18e-19 1.26e-04
6 KLF15 4.46 4.48 7.65e-78 2.39e-05
7 PER1 3.19 3.18 1.83e-81 1.65e-05
The fold changes agree to the first or second decimal. But look at the p-values: DESeq2 reports 10−124 for DUSP1 where edgeR reports 10−6. That isn't a disagreement about DUSP1. The quasi-likelihood F-test accounts for uncertainty in the dispersion estimates and uses an F-distribution with limited degrees of freedom, so with 8 samples it produces far less extreme p-values than the Wald test's normal approximation does. Compare rankings and gene lists between tools, never raw p-values.
On speed: on a laptop, DESeq() took about 10 seconds on this dataset and the edgeR fit about 2. Irrelevant at 8 samples; it starts to matter with hundreds.
Summary Comparison: DESeq2 vs edgeR
| Feature | DESeq2 | edgeR |
|---|---|---|
| Primary Normalization | Median-of-Ratios | Trimmed Mean of M-values (TMM) |
| Default Test | Wald test | Quasi-likelihood (QL) F-test |
| Outlier Handling | Cook's distance filtering (yields NA) | Robust empirical Bayes; optional observation weights |
| Speed | Moderate (can take minutes on large datasets) | Extremely fast (usually seconds) |
| User Interface | Highly automated, simpler for beginners | More modular, gives finer control to users |
The Verdict: Which should you use?
Honestly? Either one is fine.
If you have a standard experimental design and a real biological signal, both packages find the same key genes. On the airway data they agree on 907 genes and on every known dexamethasone target; where they differ, it's genes sitting right at a cutoff.
Here is a simple rule of thumb:
- Use DESeq2 if you want a highly automated, "plug-and-play" pipeline that handles outlier detection for you, and if you are already comfortable with the Bioconductor syntax we practiced in post 14.
- Use edgeR if you have a massive dataset (hundreds of samples) where DESeq2's run-time becomes a bottleneck, or if you want finer control over each step of the model.
Regardless of which tool you pick, never switch tools mid-project just to find more significant genes. That is called p-hacking, and it makes your results unreproducible. Choose your tool, document your parameters, and stick to it.
What's next?
Now that we have tables of differential expression results from DESeq2 or edgeR, how do we present them to our readers? 20,000 rows of numbers are impossible to digest.
In the next post, we will learn how to turn these results tables into publication-ready Volcano plots and MA plots using R.
Additional Resources
- edgeR User Guide (Bioconductor)
- Chen Y, Lun ATL, Smyth GK (2016). From reads to differentially expressed genes: an edgeR workflow. F1000Research.
Keep reading
Your first single-cell RNA-seq analysis in R with Seurat
Cell Ranger just handed you three files — matrix.mtx, genes.tsv, and barcodes.tsv — and a matrix that is 93% zeros. Here is how to take a real 10x Genomics dataset from raw UMI counts to an annotated UMAP of human immune cell types in R with Seurat v5.
Volcano plots and MA plots: visualizing RNA-seq results in R
Your DESeq2 results table has thousands of rows, and sorting it in Excel tells you almost nothing about your experiment. Here is how to build volcano plots and MA plots in R with ggplot2 — and how to read what they are actually telling you.
Gene ontology and pathway enrichment analysis in R with clusterProfiler
You ran DESeq2 and got your list of differentially expressed genes. Now what? Here is how to use clusterProfiler to find out which biological pathways are actually changing in your experiment — with real code, real output, and real plots.