Does order of removeBatchEffect() and DE subsetting matter for clustered heat map visualization?
1
0
Entering edit mode
Ekarl2 ▴ 80
@ekarl2-7202
Last seen 8.5 years ago
Sweden

I want to make a clustered heat map for the differentially expressed genes I identified with EdgeR where the batch effect was modeled as an experimental factor. To do this, I used the limma package removeBatchEffect() after TMM-normalization and log2 CPM transformation on the DE subset of the raw expression matrix and it worked.

Is there any concrete practical benefit in doing removeBatchEffect() on the entire dataset first (but with some independent filtering first), and then take out the rows corresponding to the DE genes for visualization? In terms of robustness and accuracy?

In other words, is it better to take out differentially expressed genes from the raw matrix first, and then run the batch correction described above or first run the batch correction procedure on the full raw matrix and only then take out the genes you want to visualize? My DE set is on the order of a few thousand de novo contigs. How much does the size of this DE set matter for the answer?

rna-seq edgeR limma removebatcheffect() batch • 1.3k views
ADD COMMENT
2
Entering edit mode
Aaron Lun ★ 28k
@alun
Last seen 3 hours ago
The city by the bay

Doesn't matter. The batch correction is done separately for each gene, so whether it's subsetted or not is irrelevant to the function as it'll give the same result for each gene:

y <- matrix(rnorm(10*6),10,6)
colnames(y) <- c("A1","A2","A3","B1","B2","B3")
y[,1:3] <- y[,1:3] + 10

# All together:
batch <- c("A","A","A","B","B","B")
out <- removeBatchEffect(y, batch=batch)

# One at a time:
out2 <- removeBatchEffect(y[1,,drop=FALSE], batch=batch)
all.equal(out[1,,drop=FALSE], out2) # should be TRUE

If you subset first, it'll be faster, but that shouldn't be a major issue unless you've got lots of features.

ADD COMMENT

Login before adding your answer.

Traffic: 341 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6