Question 20 of 20 Advanced Troubleshooting
How would you correct for unwanted variation in RNA-seq when the batch was never recorded?
Short answer
Estimate the hidden factors from the data with surrogate variable analysis (svaseq) or RUVSeq, add them to the design as covariates, and check they are not absorbing the treatment effect. Estimated factors are a repair, not a substitute for a recorded, balanced design.
Why
Library preparation day, operator or reagent lot can move many genes at once, and often nobody wrote it down. The DESeq2 documentation recommends correcting for unwanted variation either by putting known batch variables in the design or by estimating factors with svaseq or RUVSeq. svaseq models expression as known variables of interest, known adjustment variables and unknown artifacts, and estimates surrogate variables for the unknowns from the residual structure. RUVSeq estimates factors from genes or samples that should not respond to treatment.
RUVg uses negative control genes, RUVs uses replicate samples, and RUVr uses residuals. The RUVSeq authors also found ERCC spike-ins were not reliable enough for standard global-scaling normalization, which is why empirical control genes are common. The Bioconductor workflow shows svaseq run with a full model containing treatment and a null model with only an intercept, then the surrogate variables added to the DESeq2 design.
The danger is the same for both methods. A hidden factor that correlates with treatment cannot be cleanly separated, and the adjustment then removes real signal or leaves bias in place.
How to work it through
- Confirm on a PCA plot that structure exists which no recorded variable explains.
- Filter out very low count genes and run svaseq with a full model that contains the condition and a null model that does not.
- Add the surrogate variables to the DESeq2 design ahead of the condition term.
- Plot each surrogate variable against the condition and stop if any is strongly correlated with it.
- Compare results with and without adjustment, and against RUVg using empirical control genes.
- Report the number of factors used and how it was chosen.
An example
In a hypothetical 16-sample study, PCA shows two clusters of eight that match neither treatment nor donor. svaseq finds two surrogate variables, and the first separates the clusters while correlating with treatment at only 0.1. With design ~ SV1 + SV2 + condition, significant genes rise from 85 to 410, and the known target genes move up the ranking. The lab later finds that the clusters match two library preparation days, which confirms the factor was technical.
Where the answer stops holding
The number of factors to keep is a judgment, and too many can remove biology. Factors strongly correlated with treatment cannot be adjusted away safely. Unknown factors estimated in a small study are unstable, so results should be presented with and without adjustment.
A strong answer covers
- Known batches go in the design, unknown ones are estimated
- svaseq estimates surrogate variables from residual structure
- RUVg, RUVs and RUVr use control genes, replicate samples or residuals
- Check that estimated factors are not correlated with treatment
- Report results with and without adjustment
Common mistakes
- Estimating surrogate variables without protecting the condition in the full model
- Using ERCC spike-ins alone as normalization controls without checking their behavior
- Adding as many factors as possible until the gene list looks better
The interviewer might ask next
How would you choose negative control genes for RUVg in a study with no spike-ins?