I am working with RNA seq data. I would like to compute the residuals with DESeq2 to remove confounding effect in the data before running WGCNA.
We computed the residuals by using DESeq2 on our RNA Seq count matrix with this code:
fitted.common.scale = t(t(assays(dds)[["mu"]])/sizeFactors(dds))
counts(dds, normalized=TRUE) - fitted.common.scale
WGCNA suggests to log2 transform count data (from RNA-seq) before the analysis.
We noticed that the residuals are computed in the scale of the counts.
Is it correct to log2 transform the residuals (computed as described above) before using them in WGCNA? Or this would be a mistake?
Thank you in advance for your help.