How to add pseudocount to DESeq2 dds object
1
0
Entering edit mode
nabiyogesh • 0
@nabiyogesh-11718
Last seen 3 months ago
United Kingdom

Hi,

I am getting error while running DESeq2, as some of the samples contain 0 so I want to add pseudo-count to dds so that I can able to run it without any error but I am not sure how should I add 1 to dds?

    dds <- DESeqDataSetFromMatrix(countData=count,colData=colData,design=~Season)
keep <- rowSums(counts(dds)) >= 10
dds <- dds[keep,]
dds <- DESeq(dds, test="Wald")
estimating size factors
Error in estimateSizeFactorsForMatrix(counts(object), locfunc = locfunc,  :
every gene contains at least one zero, cannot compute log geometric means

After adding pseudocount I am thinking to run further code like this:

dds<-estimateSizeFactors(dds, type = 'iterate')
dds <- estimateDispersions(dds)
dds <- nbinomWaldTest(dds)

deseq2 r • 658 views
0
Entering edit mode
swbarnes2 ▴ 800
@swbarnes2-14086
Last seen 15 minutes ago
San Diego

It's not normal for the kind of bulk seq DESeq was designed for to have zeroes in every single gene. Are you sure that you don't have a couple of failed samples included?

0
Entering edit mode

Hi

I used the below code to check if samples with all 0; and it shows no samples with all 0.

all.zero <- apply(count, 2, function(x) all(x==0))
> all.zero
PN0086D.1.S1     PN0086D.2.S2     PN0086D.3.S3     PN0086D.4.S4
FALSE            FALSE            FALSE            FALSE
PN0086D.5.S5     PN0086D.6.S6     PN0086D.7.S7     PN0086D.8.S8
FALSE            FALSE


Thanks

0
Entering edit mode

The problem is that you have no genes with all positive counts. This is strange for bulk RNA-seq, and worth exploring.

To answer your question at the outset, we don't have any way to add pseudo-counts. I'd recommend to figure out what is going on though with all genes having a zero.

0
Entering edit mode

Hi Michael,

This is microbial amplicon sequencing data for a marker genes and we collected soil samples from different location so it can be possible that no rep.seq with all positive count.

sorry for this confusion!

many thanks

0
Entering edit mode

It was not my suggestion that you have one sample with all zeros. However, you might have 2 or more failed samples which, between them, have zeros in every single gene. If you have this, adding pseudocounts is not the answer. The answer is to get rid of the bad samples. If you have very atypical samples that really do have zeros in every gene, don't just blindly add pseducounts to force the data through a workflow that is not designed for your kind of data. You'll have to stop and consider if a different workflow would be more appropriate for your experiment.