Entering edit mode
Sorry to resurrect a somehow old thread, but I wanted to kick the
tires on this and wanted to clarify the google-record for posterity
... so:
On Sun, Jul 20, 2014 at 5:18 PM, Gordon K Smyth <smyth at="" wehi.edu.au="">
wrote:
>
> On Mon, 21 Jul 2014, Gordon K Smyth wrote:
>
>> logCPMc <- removeBatchEffect(y, batch)
>
>
> Should have written
>
> logCPMc <- removeBatchEffect(y2, batch)
Shouldn't the correction actually be this?
R> lobCPMc <- removeBatchEffect(logCPM, batch)
Because in the code snippet `y2` is a DGEList dataset (of counts).
So, removing batch effects from soup to nuts:
## ------------------------------------------------
library(edgeR)
y <- DGEList(counts=counts)
## Filter non-expressed genes:
A <- aveLogCPM(y)
y2 <- y2[A>1,]
## Then normalize and compute log2 counts-per-million with an offset
y2 <- calcNormFactors(y2)
logCPM <- cpm(y2, log=TRUE, prior.count=5)
## Then remove batch correct:
logCPMc <- removeBatchEffect(logCPM, batch)
## ------------------------------------------------
Thanks,
-steve
--
Steve Lianoglou
Computational Biologist
Genentech