Greetings all,
I've been researching ways to remove batch effects from RNA-Seq count matrices. Basically, I'm starting with a counts matrix that includes batch effects, and want to generate a new matrix of counts that has the batch effects removed.
I'm looking to apply this to sets of RNA-Seq samples (~100 samples) that were sequenced in batches on different days (factor) and for which I also have other metadata with continuous values (covariates such as total sequenced reads in each sample, quality metrics, etc). I want to study all these samples in an unsupervised manner, and don't have a model for anything but the various batch effects that I want removed (ie. no cancer vs. normal labeling, instead they're all 'normal' and I'd like to see if they form clusters based on natural variation in the population, and perhaps identify subtypes).
From what I've read thus far, methods like sva (and the included Combat) require that you provide a model for the covariates that you do not want removed (biological factors) in addition to the ones you do want removed (batch effects). Is it not possible to use these methods in my scenario, where I don't have factors other than the specified batch effects?
In searching the bioconductor mailing list archive, I found:
edgeR package, removeBatchEffect() function
which seems to do exactly what I want, and I'll experiment with it shortly. I'm mostly curious about what other methods might be available to do this, and whether the SVA or other libraries contain functions that I should explore.
Many thanks in advance for any advice!
~brian
Originally I mistyped the argument to removeBatchEffect() as y instead of y2, now corrected.
Thanks, Gordon!
If I want to also remove effects related to total read counts or coverage biases or other library quality metrics, which sometimes end up being highly correlated with principal component 1, do I include these continuous values as covariates in the removeBatchEffect() method? I was looking for some examples on how to use it, but couldn't find any.
Thx
-Brian
Yes, just input continuous variables as covariates.
Gordon
Dear Gordon,
I know this post is from a year ago but I've only just had the need to use batch correction on my data. Thank you so much for this post, it has been very helpful to me.
I have a couple of minor clarifications to pursue...
First - in the filtering step above, y2 is a subset of y where the average log CPM > 1 - right ? So should it say
rather than what it says below ?
Assuming my first comment isn't absolute gibberish, y2 being a subset of y means it is as yet un-logged. This means that logCPM is on a logged scale but logCPMc is on an unlogged scale. I only noticed this as I plotted before and after plots using plotMDS and noted the scales differed quite vastly.
I can think of two potential solutions here - (1) to turn 'log' off in the cpm function (2) to pass logCPM into the 'removeBatchEffect' function. However, having read the 'removeBatchEffect' manual, the 2nd option seems the more correct option as it assumes one is giving it log-expression values.
I am writing to check if my line of thought is correct and to hopefully help others who might be toying with a similar notion, however minor that group might be.
Thank you for your time.
Kind regards,
Manasa
Thank you for this!