Error: Every gene contains at least one zero, cannot compute log geometric means
3
1
Entering edit mode
16 months ago

Hi there,

When I am running the DESeq pipeline on the dds object and getting this error message.

> dds_res<-DESeq(dds_PvsN)
estimating size factors
Error in estimateSizeFactorsForMatrix(counts(object), locfunc = locfunc,  : 
  every gene contains at least one zero, cannot compute log geometric means
In addition: Warning message:
In class(object) <- "environment" :
  Setting class(x) to "environment" sets attribute to NULL; result will no longer be an S4 object

What strategy should be applied to resolve this conflict?

Thank you very much!

Imran

RNA-Seq DESeq R bioconductor • 5.8k views
ADD COMMENT
0
Entering edit mode

Thanks, Kevin and swbarnes2 for your replies,

Kevin your reply was the right solution. This helps us not to remove any sample during this analysis.

So adding a pseudo-count value of '1' to each entry in my data helps to resolve this error.

Best regards: Imran

ADD REPLY
5
Entering edit mode
16 months ago

I encountered this error only once in the past. It is as stated: every gene in your data has at least one zero value, and this creates an issue for the size-factor calculation.

Solutions:

  1. add a pseudo-count value of '1' to your data
  2. use: estimateSizeFactors(dds_PvsN, type = 'iterate')

Kevin

ADD COMMENT
4
Entering edit mode

I just want to add as a comment that this is a technical solution, but it is unclear what the implications are for the downstream analysis which then depends on the analysis goal. If in normal RNA-seq there is at least one zero per gene that means that (I guess) either samples are notably under-sequenced or there are any other kinds of dropout events that I'd investigate. it is in any case not normal and should probably not be ignored by just adding a pseudocount. If this is single-cell data one might consider single-cell-specific normalization methods such as the deconvolution method in the scran package.

ADD REPLY
1
Entering edit mode
16 months ago

Check your count matrix. That error can happen if you have a couple of rotten samples. Omitting them might fix things.

ADD COMMENT
1
Entering edit mode
10 months ago
el24 ▴ 20

I encountered the same problem and fixed it by using Kevin's first solution above. I used the below command. I hope it helps anyone who faces this error in the future.

my_data[["RNA"]]@counts <- as.matrix(my_data[["RNA"]]@counts)+1

ADD COMMENT
2
Entering edit mode

Is this single-cell data in your case (asking because it looks Seurat-ish to me)? Can you clarify what you aim to do, maybe other methods fit better than DESeq2 here?

ADD REPLY
1
Entering edit mode

Agreed. If this is single cell, I have a very hard time imagining running into this unless you have a very small number of cells or a handful of "cells" that are pretty much complete junk/empty droplets that should be easily removed by any sensible filtering.

ADD REPLY
0
Entering edit mode

You are correct, this is Seurat code for scRNA data. I want to get marker genes of scRNAseq from this paper which is pretty standard, but I am not sure why I face this problem. I previously used Wilcoxon rank sum test method, but I want to explore further and see which method works the best for this data, so that's why I use DEseq2 now. I followed the Seurat tutorial and their default filtering parameters and normalization to do so. I saw that Kevin has provided another solution here, I try to see if that works for me.

Please let me know if you have any ideas, I really appreciate it!

ADD REPLY

Login before adding your answer.

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