# Why Do My RNA-seq Samples Cluster by Batch Instead of Treatment?

You build the count matrix, run a [principal component analysis](/blog/data-analysis/principal-component-analysis-explained), and the plot answers a question you never asked. Your samples split cleanly into two groups, except the split follows the two days you prepared libraries, or the two sequencing runs, or the two people who did the extractions, rather than control versus treatment.

The most likely cause is that a technical variable, usually library preparation day or sequencing run, explains more total variance than your treatment does. The first thing to check takes about fifteen minutes. Recolor your PCA plot by every column in your metadata table, one variable at a time, and cross-tabulate treatment against batch. That single exercise tells you whether you are facing a modeling problem, a correction problem, or a design problem.

This guide covers the causes behind the classic complaint that rna-seq samples cluster by batch, ordered from most common to rarest, with the mechanism behind each failure, a diagnostic sequence you can follow today, concrete fixes in R, and prevention practices for the next experiment. One warning belongs up front. If every control sample was processed on Monday and every treated sample on Friday, treatment and batch are perfectly confounded, and no software can separate them. Every fix below assumes at least partial balance in your design.

## What "Clustering by Batch" Actually Means

A batch effect is systematic technical variation between groups of samples that were handled together, for example samples extracted on the same day, prepared with the same reagent lot, or sequenced in the same flow cell, and it has nothing to do with the biology you are testing. Principal component analysis (PCA) compresses expression values for thousands of genes into a few axes that capture the largest sources of variance. PCA has no way to know which source of variance matters scientifically. It simply reports the directions in which the data spread widest.

That is why batch dominates plots so often. Two properties of RNA-seq data conspire. First, the data are high dimensional, so small per-gene shifts that share a direction, such as marginally more efficient reverse transcription acting on every gene at once, accumulate into a dominant axis. Second, treatment effects in many careful experiments are intentionally modest. A stimulus might double a few hundred genes while nudging thousands of others by a few percent, which is meaningful biology but a small share of total variance. The technical variable wins on total variance even when the treatment wins on scientific meaning.

Two clarifications prevent wasted effort. A cluster of samples in PCA or UMAP is a description, not a finding, and it can be produced by [sequencing depth](/knowledge/diagnostics/molecular/how-to-calculate-sequencing-depth-and-coverage-for-your-ngs-run), by degradation, by label mix-ups, or by real biology. And separation by batch is not automatically fatal. If treatment effects exist and the design is balanced, a statistical model that includes batch will detect them even when the PCA plot looks hopeless.

## Start Here: A Bioinformatics Troubleshooting Sequence

![Decision path that starts from a treatment by batch cross-tabulation and ends at model batch, report reduced power, or repeat the experiment.](/article-images/illustrations/rna-seq-samples-cluster-by-batch-confounding-triage.webp)

Work through these eight steps in order. Most projects identify their culprit by step four, and skipping straight to batch correction is the most expensive mistake in this workflow because it buries the diagnosis.

1. **Rebuild the metadata table.** One row per sample, one column per variable you can think of: sample identifier, treatment, extraction date, operator, [RNA integrity number](/knowledge/diagnostics/molecular/rna-integrity-assessment-rin-values-gel-electrophoresis) (RIN, a 1 to 10 quality metric from a Bioanalyzer or TapeStation trace), input mass, library kit and lot number, barcode index, flow cell, lane, sequencing date, total reads, and alignment rate. Retrospective metadata is where most troubleshooting stalls, so pull what you can from lab notebooks and the sequencing provider's report.

2. **Normalize before you cluster.** Filter genes with very low counts, apply size-factor or TMM normalization, then transform, for example with DESeq2's [variance stabilizing transformation](/blog/research-skills/variance-stabilizing-transformation-when-and-how) or log counts per million from edgeR. PCA on raw counts clusters samples by sequencing depth, one of the most common rna seq error patterns in first-pass analyses, and no batch correction method will fix it.

3. **Recolor the PCA by every metadata column.** Treatment, batch, date, operator, RIN, library size, alignment rate. Save a screenshot of each. The variable whose colors line up with the PC1 axis is your prime suspect, and the runner-up variables matter too, because real projects usually carry several partial batch effects at once.

4. **Quantify what each variable explains.** Fit each principal component score against your metadata with simple linear models, or use the variancePartition package, which estimates the percent of variance attributable to each variable across genes. A variable that explains 30 percent of PC1 while treatment explains 3 percent has answered your question.

5. **Cross-tabulate treatment against batch.** In R, run table(meta$treatment, meta$batch). An empty cell means partial confounding, which you can model at some cost in power. A diagonal table, where each treatment occupies exactly one batch, means complete confounding, which you cannot model your way out of.

6. **Check replicate relationships.** A Spearman correlation heatmap across all samples should show biological replicates as the closest pairs. A treated sample that clusters with controls, or two supposedly independent tubes with near-identical profiles, points to swaps or duplicates rather than batch.

7. **Inspect sequencing metrics.** Run FastQC on the fastq files and aggregate with MultiQC. Look for per-base quality drops, adapter content, duplication, and, for 3'-tag library kits, bias toward the transcript 3' end. Per-lane breakdowns reveal whether one lane behaved differently from the others.

8. **Choose the response.** If the design is balanced, model the batch in your differential expression analysis and correct it only for visualization. If confounding is partial, model it and report the reduced power. If confounding is complete, the honest fix is a new experiment, and the sections below explain why no shortcut exists.

## Why RNA-seq Samples Cluster by Batch: Eight Causes, Most Common First

### 1. Treatment and Batch Are Confounded by Design

This is the most common and least fixable cause. In pilot projects, controls often get processed first and treated samples later, or each treatment gets its own sequencing run, and the analysis then hits a wall. In a linear model, two variables that always occur together are aliased, meaning the model sees one combined direction and cannot assign parts of it to treatment and batch separately. DESeq2 will drop columns from a rank-deficient design, and the batch coefficient and the treatment coefficient fight over the same signal.

Confirm it with the cross-tabulation from step 5 of the diagnostic. If the table is diagonal, stop tuning correction methods, because they cannot recover information the design never collected. Partial confounding, where some but not all samples overlap, is workable. The model can estimate batch from the overlapping portion, at a cost in power that grows with the degree of confounding. The fix is experimental. Rerun the key comparison with every treatment represented in every processing batch, or add bridge samples that tie old and new batches together.

### 2. Library Preparation Day, Kit Lot, or Operator

Even with a balanced design, the day a library was prepared leaves fingerprints. Reverse transcription efficiency, fragmentation timing, adapter ligation, and PCR amplification all vary with reagent lots, thaw cycles, incubator calibration, and pipetting habits. Each of these shifts thousands of genes slightly in a shared direction, which is exactly the kind of coordinated movement PCA amplifies. Operator effects are real as well, and experienced core staff can often guess which technician prepared a library from the PCA alone.

Confirmation is straightforward. Color the PCA by preparation date, kit lot, and operator, and check whether PC1 or PC2 scores correlate with date. The fix for downstream statistics is to include the batch variable in the design matrix. For visualization and cross-dataset work, empirical Bayes correction with ComBat is the standard tool, and for raw count data you should use ComBat-seq, which models counts under a negative binomial framework rather than forcing them onto a Gaussian scale.

### 3. Normalization and Transformation Mistakes

Some batch-looking plots are analysis artifacts. Raw counts scale with sequencing depth, so a 30-million-read sample and a 5-million-read sample differ on every gene, and PCA on raw counts returns library size as PC1. Composition bias adds another layer, because a handful of very highly expressed genes in one group depress the relative abundance of everything else. Skipping the low-count filter leaves thousands of near-zero genes that contribute pure noise dimensions, and forgetting the log or variance-stabilizing transform lets a few extreme genes dominate the geometry.

These failures produce a distinctive symptom. Everything separates, including samples you know are identical, and the separation shrinks dramatically after proper filtering, normalization, and transformation. The fix is procedural rather than computational. Filter, normalize, transform, then re-plot before you accuse anyone's pipetting.

### 4. Sequencing Run, Lane, and Flow-Cell Effects

Samples sequenced months apart, or on different instruments, carry run-level differences in cluster density, phasing, and calibration. Lane effects exist on most platforms, though they are usually smaller than library preparation effects. These effects matter most in long projects where cases and controls trickle in over time and get placed on whatever run has space.

Confirm by coloring PCA by run and lane, and by comparing per-lane quality metrics in MultiQC. The fix for statistics is to include run in the design when you have enough samples to estimate it. The fix for future projects is to randomize treatments across runs and lanes rather than filling one run per group.

### 5. RNA Quality and Input Differences

Degraded RNA produces its own expression signature. Fragmentation hits long transcripts first and biases read placement toward the 3' end, so degraded and intact samples separate on quality-driven axes that have nothing to do with your treatment. RIN captures much of this for fresh tissue, while DV200 is the standard metric for fragmented FFPE material. Input mass matters too, because very low input reduces library complexity and raises duplication.

Check whether principal component scores correlate with RIN or input, and whether 3' bias metrics track the clustering. Samples that fail quality thresholds deserve a documented exclusion or, when tissue is available, re-extraction. Where quality varies continuously, include RIN as a covariate in the design rather than dropping samples arbitrarily.

### 6. Sample Swaps, Duplicates, and Mislabels

A swapped tube produces a batch-like pattern that no correction method should touch, because the labels are simply wrong. Plate-based library preparation makes off-by-one row and column errors easy, and index misassignment during demultiplexing can redirect reads between samples.

The confirmation tools are identity checks rather than variance models. Sex-specific markers such as XIST and Y-linked genes should match recorded sex. Genotype concordance from variant calls should match known relationships. Known marker genes should match tissue of origin. Pairwise Spearman correlations should show replicates pairing up, and a pair of samples with correlation near 1.0 across supposedly independent biological replicates is a duplicate alarm. When a swap is confirmed, relabel if the truth is recoverable, exclude if it is not, and document either choice in your methods section.

### 7. Real Biology That Tracks Your Batch

Sometimes the variable correlated with batch is biology, not error. Samples collected on different days may differ in circadian state, feeding time, housing room, or disease severity if cases were recruited in waves. Postmortem interval separates living-tissue from postmortem-tissue profiles in ways that are genuine biology even though they track collection logistics. A human retina study illustrates the scale of such an axis. Researchers profiled 106,829 cells from nine living donor samples collected within 10 minutes of enucleation and four postmortem samples collected within 6 hours, and treated donor state as a feature of the dataset rather than as noise [1].

The response is to model these variables as covariates when they are nuisance factors, and to respect them as findings when they are not. The mistake to avoid is calling every variable correlated with date a batch effect and correcting it away, because aggressive correction of genuine biological signal is how overcorrection happens.

### 8. Rare Artifacts: Index Misassignment, Contamination, and Low-Complexity Libraries

The rarest causes still reach core facility queues. Index hopping and barcode misassignment move a fraction of reads between multiplexed samples, which matters most when indexes are similar or single-index schemes are used. Carryover contamination from a previous run, rRNA or globin dominance after failed enrichment, and low-complexity libraries from damaged input each leave characteristic metric signatures, such as elevated duplication, collapsed base composition, or unexpected off-target fractions. These problems show up in FastQC and MultiQC summaries before they show up in PCA, which is why step 7 of the diagnostic exists. Fixes live at the wet-lab and demultiplexing level: stricter index design, re-preparation of failed libraries, and read-level filtering where appropriate.

## Troubleshooting Table: Symptom, Cause, Confirmation, Fix

| Symptom | Likely cause | How to confirm | Fix |
|--|--|--|--|
| PCA splits follow library prep dates | Prep-day batch effect | PCA colored by date, PC scores regressed on date | Batch term in the design, ComBat-seq or removeBatchEffect for plots |
| Splits follow sequencing run or lane | Run or lane effect | Color by run and lane, per-lane MultiQC metrics | Include run in the design, randomize lanes next time |
| Treatment and batch occupy the same samples | Complete confounding | table(treatment, batch) is diagonal | No computational fix, redesign with balanced batches or bridge samples |
| One or two samples far from everyone | Swap, duplicate, or outlier | Identity checks, correlation heatmap, mapping metrics | Relabel or exclude with documentation |
| Splits track RNA quality scores | Degradation artifact | PC scores versus RIN or DV200, 3' bias metrics | RIN as covariate, re-extract failed samples |
| Everything separates, even replicates | Normalization or transform mistake | Wide library size spread, no low-count filter, raw-count PCA | Filter, normalize, transform, re-plot |
| Batch clustering survives correction | Wrong tool for data type, or hidden batch | ComBat applied to raw counts, unrecorded variables | ComBat-seq for counts, add missing covariates, try surrogate variable methods |
| Groups only separate after supervised correction | Information leakage | Check whether the method used group labels | Use unsupervised correction for discovery |
| Single-cell UMAP splits by donor or chip | scRNA-seq batch effects | Color UMAP by donor, chip, chemistry version | Harmony, scVI, or Seurat integration, or cluster-independent marker methods |
| Rare cell populations vanish after integration | Overcorrection | Compare marker expression before and after correction | Weaken correction, keep raw counts for marker analysis |

Keep this table beside the diagnostic sequence. The symptom column is what you see, the confirmation column is what you owe yourself before acting, and the fix column assumes the confirmation step passed.

## How to Fix RNA-seq Samples That Cluster by Batch

### Fix Differential Expression in the Model, Not in the Counts

The primary solution for batch effects in differential expression is not a correction algorithm. It is a design formula. In DESeq2, edgeR, or limma, batch enters the model as a term, and the treatment contrast is estimated after accounting for the batch direction. This preserves the raw counts, keeps the statistical machinery honest about uncertainty, and requires no corrected data object at all.

In DESeq2 the design reads ~ batch + treatment, with batch written first by convention so the treatment effect is estimated after batch. If you suspect the treatment behaves differently in different batches, add an interaction term, ~ batch + treatment + batch:treatment, and test it explicitly. If the design is completely confounded, the model matrix is rank deficient and the software will drop terms, which is the mathematics telling you the experiment cannot answer the question.

### Correct for Visualization Without Fooling Yourself

Plots for humans, including PCA, heatmaps, and multidimensional scaling, benefit from batch-adjusted values, provided the adjustment knows about the treatment. In limma, removeBatchEffect accepts a design argument, and passing the treatment design removes batch while preserving the biology you care about. The same principle applies to ComBat on log-scale values and ComBat-seq on counts. Corrected values are for looking, not for testing.

A published pattern worth copying appears in integrative oncology workflows that log-transform, apply ComBat across cohorts, and only then cluster and test. A wheezing recovery-phase study combined two independent GEO cohorts of 39 nasal mucosal samples with ComBat before limma-trend differential expression [2], and a prostate cancer lactylation study mitigated batch effects with ComBat across TCGA-PRAD, GSE116918, and GSE54460 bulk and single-cell data [3].

### Choose Correction Methods by How Much They Transform the Data

![Comparison of unsupervised sample-wise, unsupervised gene-wise and supervised batch correction methods by error control and discovery use.](/article-images/illustrations/rna-seq-samples-cluster-by-batch-correction-classes.webp)

A recent evaluation of ten batch-effect correction methods for integrated microarray and RNA-seq analysis grouped them into three classes forming a spectrum from least to most data processing: unsupervised sample-wise methods, unsupervised gene-wise methods, and supervised methods that use outcome information to guide correction [4]. The evaluation tested distribution alignment, clustering, outcome prediction, and differential expression performance across paired real datasets and simulations, and the findings map directly onto practical decisions.

Supervised methods achieved strong distribution alignment and clustering by biological group, but they introduced information leakage and inflated Type I error, which makes them unsuitable for unbiased discovery [4]. Unsupervised sample-wise methods were often conservative under balanced settings but showed inflated Type I error under imbalanced ones. Unsupervised gene-wise methods generally maintained appropriate Type I error control and achieved higher power, with limma showing the strongest differential expression performance [4]. The practical translation is simple. For discovery, prefer unsupervised gene-wise corrections, and treat any beautiful separation that appears only after a supervised correction as a red flag rather than a result.

### Estimate Unknown or Residual Unwanted Variation

Recorded metadata never captures every technical influence. Surrogate variable analysis estimates unwanted factors directly from the expression data, without needing to know what caused them, and adjusts for them alongside your variables of interest. The approach scales to large harmonization projects. A transcriptomic atlas of 5,402 neoplastic and 1,973 nonneoplastic nervous system samples adjusted for surrogate variable effects before machine learning based clustering and reclassification, and after adjustment, sample clustering was driven primarily by diagnosis rather than by batch [5]. Use surrogate variables when batch clustering persists after your recorded covariates are in the model, and keep the treatment term in the model simultaneously so the estimated factors absorb variation orthogonal to biology.

### Single-Cell Data: Integrate Carefully or Sidestep Integration

Single-cell RNA-seq (scRNA-seq) adds batch layers, because donors, chips, chemistry versions, and capture dates all imprint on the data. Published workflows routinely correct with Harmony before clustering, in settings ranging from an acute myeloid leukemia tumor microenvironment atlas built from 59 samples and 284,687 high-quality cells [6], to prostate cancer [7], lung adenocarcinoma [8], and tuberculosis PBMC studies [9]. Atlas-scale projects increasingly use scVI, as in the human retina reference that generated a batch-corrected integrated atlas from 106,829 cells [1].

Aggressive integration has costs. Autoencoder-based methods that compress batches into a shared latent space before clustering can lose rare cell types, a limitation acknowledged in the design of newer correction models [10]. An alternative strategy skips correction entirely for certain questions. The Localized Marker Detector (LMD) scores genes on a cell-cell affinity graph and identifies localized markers across samples without requiring batch effect correction or integration [11].

One more single-cell subtlety concerns phenotype testing. If you cluster cells and then test whether those clusters associate with a sample-level phenotype using the same expression data, you invite a post-selection problem known as double dipping. Simulations show that naive clustering on uncorrected embeddings severely inflates false discovery rates when phenotypic differences are strong, while applying correction that removes phenotypic effects before clustering resolved the inflation with no obvious loss of power [12]. The same study provides measures of phenotypic imbalance that estimate the risk in real datasets [12].

### When the Only Real Fix Is a New Experiment

If the cross-tabulation is diagonal, budget for a repeat of the key comparison with a balanced design. Interim options exist and all of them are compromises. You can report the confounding honestly and frame the results as hypothesis generating. You can use within-sample or paired measurements if your system allows them, because pairing removes between-batch variance from the comparison by construction. What you cannot do is correct your way to an unbiased treatment estimate, and reviewers increasingly know it.

## A Worked Diagnostic and Fix in R

The following snippets assume a count matrix named counts with genes in rows and samples in columns, and a metadata data frame named meta with columns treatment, batch, RIN, and operator. Adjust factor level names to yours.

**Check confounding first.**

```r
table(meta$treatment, meta$batch)
```

**Standard DESeq2 workflow with batch in the design.**

```r
library(DESeq2)
dds <- DESeqDataSetFromMatrix(countData = counts,
                              colData   = meta,
                              design    = ~ batch + treatment)
dds <- DESeq(dds)
res <- results(dds, contrast = c("treatment", "treated", "control"))

vsd <- vst(dds, blind = FALSE)
plotPCA(vsd, intgroup = c("batch", "treatment"))
```

The blind = FALSE argument lets the transformation use your design, which is what you want once batch is part of the model.

**limma-voom equivalent with a corrected PCA.**

```r
library(edgeR)
library(limma)
y      <- DGEList(counts = counts)
y      <- calcNormFactors(y)
logCPM <- cpm(y, log = TRUE, prior.count = 1)
design <- model.matrix(~ batch + treatment, data = meta)
v      <- voom(y, design, plot = TRUE)
fit    <- eBayes(lmFit(v, design))
topTable(fit, coef = "treatmenttreated")

corrected <- removeBatchEffect(logCPM,
                               batch  = meta$batch,
                               design = model.matrix(~ treatment, data = meta))
plotMDS(corrected, labels = meta$treatment, col = as.numeric(factor(meta$batch)))
```

Note that the design passed to removeBatchEffect contains treatment but not batch, because the function removes batch and preserves whatever the design describes. The coefficient name in topTable depends on your factor levels, so print colnames(design) and match it.

**Variance partitioning across candidate variables.**

```r
library(variancePartition)
form    <- ~ batch + treatment + RIN + operator
varPart <- fitExtractVarPartModel(logCPM, form, meta)
plotVarPart(sortCols(varPart))
```

**ComBat-seq for count-level correction ahead of visualization or integration.**

```r
library(sva)
corrected_counts <- ComBat_seq(counts,
                               batch = meta$batch,
                               group = meta$treatment)
```

Pass the group argument only when treatments are balanced across batches, because the argument preserves treatment signal and can leak it when the design is unbalanced.

**Replicate and identity checks.**

```r
library(pheatmap)
pheatmap(cor(logCPM, method = "spearman"),
         annotation_col = meta[, c("treatment", "batch")])
```

**Sequencing quality aggregation.**

```
fastqc *.fastq.gz
multiqc .
```

**Harmony for single-cell integration inside a Seurat workflow.**

```r
library(harmony)
seurat_obj <- RunPCA(seurat_obj)
seurat_obj <- RunHarmony(seurat_obj, group.by = "batch")
```

Each snippet is short on purpose. Run them in the order of the diagnostic sequence, and the offending variable usually names itself by the time you reach the variance partitioning plot.

## Prevention: Design the Batch Out Before You Extract RNA

Batch effects cannot be prevented entirely, but they can be made small, known, and modeled. Every practice below costs less than one ruined experiment.

1. **Balance every batch.** Each library preparation day, each sequencing run, and ideally each lane should contain every treatment. A balanced block design converts batch from a confounder into a nuisance term with a clean estimate.

2. **Randomize handling order.** Assign extraction order, library prep order, and lane positions randomly across treatments rather than processing groups in sequence. Randomization spreads residual day-to-day drift evenly across groups.

3. **Record metadata at the bench.** Extraction date, operator, kit lot, RIN or DV200, input mass, index, flow cell, and lane go into a spreadsheet the day they happen. Retrospective reconstruction is the slowest part of every troubleshooting session.

4. **Freeze a bridge sample.** A pooled reference RNA, aliquoted once and included in every batch, gives every batch a common anchor and makes cross-batch drift visible and estimable.

5. **Hold reagent lots constant when feasible.** Buy enough kit for the whole study when budgets allow, and record lot numbers regardless, because lots are among the first variables reviewers ask about.

6. **Pilot before committing.** Sequence a small balanced subset first. If the treatment effect is visibly larger than the batch effect in the pilot, the full experiment will behave. If it is not, you have saved a full run's budget.

7. **Pre-specify the model.** Write the design formula, ~ batch + treatment, into the analysis plan before data arrive. Decisions made before seeing the PCA are the ones that survive review.

Safety note: the wet-lab steps upstream of this analysis carry chemical hazards. Phenol-chloroform and TRIzol are corrosive and toxic, so work with them in a chemical fume hood while wearing nitrile gloves and eye protection, and route phenol waste through your institution's hazardous waste program. Beta-mercaptoethanol and formamide demand the same handling. For RNase decontamination of work surfaces, a freshly prepared 10 percent bleach dilution is standard practice, followed by a water rinse and complete drying before samples return to the bench.

## Common Mistakes and Limitations

- **Testing on corrected counts.** Batch-corrected values are shrunken toward batch means, so their variances understate real uncertainty, and standard tests run on them produce false positives. Corrected data are for plots and integration. Testing belongs on raw counts with batch in the design.

- **Trusting supervised correction for discovery.** Methods that use outcome labels during correction can manufacture the very separation you then report. Discovery claims need unsupervised correction, and separation that appears only after supervised adjustment should be treated as a warning sign.

- **Assuming the batch variable you wrote down is the only one.** Real projects carry hidden structure, from incubator calibration to operator fatigue. Estimate unwanted factors from the data with surrogate variable approaches rather than guessing at them.

- **Overcorrecting shared biology.** When batch and treatment affect overlapping genes, correction can remove real signal along with noise. Compare marker expression before and after correction, and keep raw counts for differential analysis.

- **Reading UMAP geometry too literally.** UMAP distances and cluster shapes depend heavily on parameters, and a plot that mixes or separates batches can change with a single neighbor count. Use UMAP for display and PCA plus quantitative variance partitioning for decisions.

- **Over-reading PCA in tiny experiments.** With a handful of samples, some apparent structure is arithmetic inevitability rather than biology or batch. Resist narrating groups of two or three points.

- **Confusing correction with validation.** A successful correction aligns distributions. It does not repair a confounded design, and it does not prove the treatment effect exists.

- **Troubleshooting alone and late.** When the diagnostic sequence stalls, bring the metadata table and the colored PCA plots to a statistician or genomics core before commissioning the next sequencing round, because design flaws are cheapest to fix before samples exist.

## Frequently Asked Questions

### Why does my PCA show separation by library preparation date instead of treatment?

Because preparation date explains more total variance than your treatment, usually through reagent lots, operator differences, and day-to-day handling that shift thousands of genes slightly in the same direction. Confirm it by coloring the PCA by every metadata column and quantifying the variance each variable explains.

### Can I run differential expression on batch-corrected counts?

No. Corrected values are shrunken estimates whose variances no longer support standard tests, so model batch in the design formula instead, for example ~ batch + treatment in DESeq2, and reserve corrected data for visualization and integration.

### What is the difference between modeling batch and removing it with ComBat?

Modeling keeps raw counts and accounts for batch inside the statistical test, while ComBat adjusts the values themselves. Adjustment is appropriate for plots and cross-dataset integration, and modeling is appropriate for differential expression.

### My samples still cluster by batch after ComBat. What next?

Match the method to the data type first, since ComBat expects log-scale values and ComBat-seq expects raw counts. Then hunt for unrecorded batch variables such as operator, kit lot, or extraction day, and consider surrogate variable methods when the unwanted factor is unknown.

### Can batch correction rescue a fully confounded experiment?

No. When each treatment appears in exactly one batch, treatment and batch are mathematically indistinguishable, and no correction method can recover information the design never collected. The honest options are reporting the limitation or repeating the key comparison with a balanced design.

### Should I batch-correct single-cell data before clustering?

Usually yes when integrating donors, chips, or chemistry versions, and published workflows commonly use Harmony or scVI for that step. If you plan to test sample-level phenotype differences, correcting before clustering also protects against false discovery inflation from double dipping.

### How many samples do I need per batch to adjust for it?

Every batch should contain every treatment, and each treatment-by-batch cell benefits from multiple replicates because more replicates per cell give the model a cleaner batch estimate. One replicate of each treatment per batch is the minimum viable structure, not a target.

### Can good lab practice prevent batch effects entirely?

No, but randomization, balanced processing, consistent reagent lots, and bridge samples shrink batch effects until routine modeling handles the rest. Some technical drift is unavoidable, which is exactly why design matrices include batch terms.

<script type="application/ld+json">
{
  "@context": "https://schema.org",
  "@type": "FAQPage",
  "mainEntity": [
    {
      "@type": "Question",
      "name": "Why does my PCA show separation by library preparation date instead of treatment?",
      "acceptedAnswer": {
        "@type": "Answer",
        "text": "Because preparation date explains more total variance than your treatment, usually through reagent lots, operator differences, and day-to-day handling that shift thousands of genes slightly in the same direction. Confirm it by coloring the PCA by every metadata column and quantifying the variance each variable explains."
      }
    },
    {
      "@type": "Question",
      "name": "Can I run differential expression on batch-corrected counts?",
      "acceptedAnswer": {
        "@type": "Answer",
        "text": "No. Corrected values are shrunken estimates whose variances no longer support standard tests, so model batch in the design formula instead, for example ~ batch + treatment in DESeq2, and reserve corrected data for visualization and integration."
      }
    },
    {
      "@type": "Question",
      "name": "What is the difference between modeling batch and removing it with ComBat?",
      "acceptedAnswer": {
        "@type": "Answer",
        "text": "Modeling keeps raw counts and accounts for batch inside the statistical test, while ComBat adjusts the values themselves. Adjustment is appropriate for plots and cross-dataset integration, and modeling is appropriate for differential expression."
      }
    },
    {
      "@type": "Question",
      "name": "My samples still cluster by batch after ComBat. What next?",
      "acceptedAnswer": {
        "@type": "Answer",
        "text": "Match the method to the data type first, since ComBat expects log-scale values and ComBat-seq expects raw counts. Then hunt for unrecorded batch variables such as operator, kit lot, or extraction day, and consider surrogate variable methods when the unwanted factor is unknown."
      }
    },
    {
      "@type": "Question",
      "name": "Can batch correction rescue a fully confounded experiment?",
      "acceptedAnswer": {
        "@type": "Answer",
        "text": "No. When each treatment appears in exactly one batch, treatment and batch are mathematically indistinguishable, and no correction method can recover information the design never collected. The honest options are reporting the limitation or repeating the key comparison with a balanced design."
      }
    },
    {
      "@type": "Question",
      "name": "Should I batch-correct single-cell data before clustering?",
      "acceptedAnswer": {
        "@type": "Answer",
        "text": "Usually yes when integrating donors, chips, or chemistry versions, and published workflows commonly use Harmony or scVI for that step. If you plan to test sample-level phenotype differences, correcting before clustering also protects against false discovery inflation from double dipping."
      }
    },
    {
      "@type": "Question",
      "name": "How many samples do I need per batch to adjust for it?",
      "acceptedAnswer": {
        "@type": "Answer",
        "text": "Every batch should contain every treatment, and each treatment-by-batch cell benefits from multiple replicates because more replicates per cell give the model a cleaner batch estimate. One replicate of each treatment per batch is the minimum viable structure, not a target."
      }
    },
    {
      "@type": "Question",
      "name": "Can good lab practice prevent batch effects entirely?",
      "acceptedAnswer": {
        "@type": "Answer",
        "text": "No, but randomization, balanced processing, consistent reagent lots, and bridge samples shrink batch effects until routine modeling handles the rest. Some technical drift is unavoidable, which is exactly why design matrices include batch terms."
      }
    }
  ]
}
</script>

## Sources

1. [A scRNA-seq reference contrasting living and early post-mortem human retina across diverse donor states.](https://pubmed.ncbi.nlm.nih.gov/40660409/)
2. [Machine learning reveals immune heterogeneity in recovery-phase samples of pediatric wheezing.](https://pubmed.ncbi.nlm.nih.gov/42707154/)
3. [Integrative analysis of lactylation related genes in prostate cancer: unveiling heterogeneity through single-cell RNA-seq, bulk RNA-seq and machine learning.](https://pubmed.ncbi.nlm.nih.gov/40832598/)
4. [Evaluating Cross-Platform Batch Correction Methods for Integrated Microarray and RNA-seq Data Analysis.](https://pubmed.ncbi.nlm.nih.gov/42244530/)
5. [A clinically annotated transcriptomic atlas of nervous system tumors.](https://pubmed.ncbi.nlm.nih.gov/40423244/)
6. [Single-cell RNA sequencing reveals immunological heterogeneity of the tumor microenvironment in acute myeloid leukemia.](https://pubmed.ncbi.nlm.nih.gov/42524819/)
7. [Integrative analysis of molecular mechanisms in prostate cancer via single-cell RNA sequencing and weighted gene co-expression network analysis.](https://pubmed.ncbi.nlm.nih.gov/41006377/)
8. [Targeted and personalized immunotherapy in lung adenocarcinoma: single-cell RNA sequencing of MAFF+ tumor cells and the therapeutic potential of FOS.](https://pubmed.ncbi.nlm.nih.gov/40936936/)
9. [Single-cell RNA sequencing reveals immune cell dysfunction and rewired interaction networks in the peripheral blood of active tuberculosis patients.](https://pubmed.ncbi.nlm.nih.gov/41315935/)
10. [Batch effects correction in scRNA-seq based on biological-noise decoupling autoencoder and central-cross loss.](https://pubmed.ncbi.nlm.nih.gov/39461162/)
11. [Cluster-independent multiscale marker identification in single-cell RNA-seq data using localized marker detector (LMD).](https://pubmed.ncbi.nlm.nih.gov/40670619/)
12. ["Double-dipping" in testing for phenotypic differences with scRNA-Seq.](https://pubmed.ncbi.nlm.nih.gov/42926519/)