Free audit for one project, up to 30 samples. No payment today. Request yours

CodeISB / Blog

Batch effects in RNA-seq: check whether batch is confounded with condition

2026-11-05 · 5 min read

Batch correction gets most of the attention, but the question to ask first is simpler: is batch tangled up with the thing you are testing? If it is, no correction method can rescue the comparison.

What confounding means

A batch is any technical grouping: a sequencing run, a library prep day, a plate, a lane, a technician. Batch is confounded with condition when the two line up so closely that the data cannot tell them apart. The extreme case is all control samples in batch 1 and all treated samples in batch 2. Any difference you see between treated and control is also exactly the difference between batch 1 and batch 2, and nothing in the data can say which one caused it.

The check takes one table

Cross-tabulate batch against condition from your sample sheet. Count the samples in each cell.

DesignBatch 1Batch 2Can you separate them?
Fully confounded6 control6 treatedNo
Partly overlapping5 control, 1 treated1 control, 5 treatedBarely, with very low power
Balanced3 control, 3 treated3 control, 3 treatedYes

If any condition appears in only one batch, or batch and condition predict each other almost perfectly, treat the experiment as having a design problem rather than a software problem.

A second check: the model itself

Differential expression tools such as DESeq2, edgeR and limma build a design matrix from your sample sheet. When batch and condition are fully confounded, that matrix is rank deficient: one column is a combination of the others, and the model cannot estimate both effects. DESeq2 stops with an error in this case. If you ever see a message about the model matrix not being full rank, this is the likely cause, and the fix is not to delete a term until the error goes away.

Then look at the PCA

Plot the first principal components twice, once colored by batch and once by condition. If the main axis of variation follows batch and condition together, that is the same warning visually. If the picture separates by batch but condition is spread across both batches, you have a batch effect you can model.

What you can do about it

  • Balanced design: include batch as a term in the model (for example ~ batch + condition in DESeq2). This works because both conditions appear in each batch.
  • Partly overlapping design: the same model is possible, but expect wide confidence intervals and say so in the methods.
  • Fully confounded design: correction tools will run, but the output cannot be trusted for the condition effect. The honest options are to add samples that break the overlap, or to report the comparison as exploratory.
  • Next experiment: spread every condition across every batch, plate and lane. Randomize rather than arrange by convenience.

One warning on tools that remove batch effects before analysis, such as removeBatchEffect in limma or ComBat-seq. They are useful for plots, but running them on a confounded design can strip out the real biological signal along with the batch. Include batch in the model rather than cleaning the counts first when you can.

Do not find out after it costs you

CodeISB checks your count matrix and sample sheet for swapped samples, weak libraries and batch confounding, and returns a one-page report. No raw reads or patient identifiers needed.

The first audit is free. Current prices hold for 12 months from your first project; later customers pay list.

Get your free audit