I have RNA-Seq data from two batches and know there is significant batch effect in the data.And I just want to get the normalized data without batch effect,and the data still fits a negative binomial distribution.
I run code like this :
counts.spikein = as.matrix(CountSet2, colnames = FALSE, row.names = FALSE) ddsHTSeq1<- DESeqDataSetFromMatrix(counts.spikein, colData, design =~batch+condition) dds1<-DESeq(ddsHTSeq1,full=~ batch + condition, reduced=~batch, test="LRT") estimating size factors estimating dispersions gene-wise dispersion estimates mean-dispersion relationship final dispersion estimates fitting model and testing
I need only to perform estimating size factors in the function DESeq,and needn't perform estimating dispersions,gene-wise dispersion estimates,mean-dispersion relationship,final dispersion estimates,fitting model and testing. And are there options to turn off the functions of estimating dispersions,gene-wise dispersion estimates,mean-dispersion relationship,final dispersion estimates,fitting model and testing?
Thanks in advance!
Thank you! Micheal ! I know I can call the sub functions size factor estimation,But the sub functions size factor estimation can't remove the batch effect
You could use limma’a removeBatchEffect, but I recommend this on the transformed counts (VST). I don’t have a recommendation for removing batch from (normalized) counts really.
Why could't remove batch from (normalized) counts ?
And what's a better manner to get the normalized data without batch effect?
If I run this code, how would I modify it better?
idx1<-which(rowMeans(Countset)>1) CountSet2<-Countset[idx1,] counts.spikein = as.matrix(CountSet2, colnames = FALSE, row.names = FALSE) ddsHTSeq1<- DESeqDataSetFromMatrix(counts.spikein, colData, design =~batch+condition) dds<-estimateSizeFactors(ddsHTSeq1) data_remove<-limma::removeBatchEffect(counts(dds, normalized = TRUE),colData$batch)
Again, I would not remove batch effects from counts, but from transformed counts.
Thank you for your kind answer,Micheal
last question, would transformed counts fit negative binomial distribution?
No, they are log scale. Take a look at the vignette and the workflow, both have sections on the transformations.
We don't have anything for that.