how to remove batch effects of RNA seq data based on continuous variables(like surrogate variables from sva package) using combatseq or limma (removebatcheffect function)?)
1
1
Entering edit mode
amnahsiddiqa ▴ 10
@amnahsiddiqa-15854
Last seen 9 months ago
United States

Hi All,

I have counts normalized matrix and sva run on it and have two surrogate variables (which are continuous variables ofcourse) for hidden batch effects in my RNAseq data.

Now I am aware of combatseq package and limmas removebatcheffect() function but they don't take continuous variables. What are my options or probably I am missing something regarding continuous batch variables(in this case surrogate variables from sva). Please help me.

combatseq RNASeqData sva limma • 917 views
ADD COMMENT
1
Entering edit mode
@gordon-smyth
Last seen 15 minutes ago
WEHI, Melbourne, Australia

removeBatchEffect does take continuous variables. It works with any combination of discrete factors and continuous covariates.

If your purpose is a differential expression analysis, then you don't even need batch removal, you simply include the surrogate variables in the design matrix.

ADD COMMENT
1
Entering edit mode

@OP, it's the covariates argument in said function.

ADD REPLY
0
Entering edit mode

Thank you both- Yeah I figured covariates is my shot to go. Just for everyone else who comes back , code below worked for me without any problem and my batch effect was certainly controlled for that I was able to visualize with pac :)

normalized_data <- counts(dds, normalized = TRUE)%>%data.frame(check.names = FALSE)
normalized_data_log=log2(normalized_data+1)
design <- model.matrix(~1+visit+response_status,metadata)
normalized_data_log_batcheffectsremoved <- removeBatchEffect(normalized_data_log,covariates =metadata$sv1, design=design)
ADD REPLY

Login before adding your answer.

Traffic: 433 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