DESeq2 estimateSizeFactors iterate takes too long
Entering edit mode
Karthik • 0
Last seen 22 days ago


The data is related to my previous post. We decided to remove 3 genes from the sample count matrix as they were also present in negative controls in very high count. When running DESeq(dds), we got the following error -

estimating size factors
Error in estimateSizeFactorsForMatrix(counts(object), locfunc = locfunc,  : 
  every gene contains at least one zero, cannot compute log geometric means

It is worth noting, that our data is very sparse, and most of the counts are zero. Before running DESeq2, we filtered our data slightly differently. Instead of the default filtering strategy which is -

smallestGroupSize <- 3
keep <- rowSums(counts(dds) >= 10) >= smallestGroupSize
dds <- dds[keep,]

We decided to remove genes based on how many samples didn't show expression, i.e based on the number of 0 counts across the gene.

more_than_50_pct <- rowSums(counts(dds) == 0) <= ncol(dds) /2
dds <- dds[more_than_50_pct,]

This reduced the number of genes to 1058. (We have 200 samples in one group, around 104 samples in another group, along with 18 negative controls and 4 blank water samples)

There are recommendations to add a pseudocount of 1 to the count table and to use estimateSizeFactors(dds, type = 'iterate'), however my concerns are as follows,

  1. Due to the sparse nature of data, I'm afraid if it will skew the results.
  2. Even with a smaller subset of sample, it ran for 2+ hours and still couldn't finish the step :/
RNASeq DESeq2 • 332 views
Entering edit mode

I wouldn't add 1 to the matrix.

I would use ATpoint advice and use a sc method. Or type="poscounts".

Entering edit mode
ATpoint ★ 3.9k
Last seen 21 hours ago

You have quite a custom dataset here and the support site is not meant to guide you through your analysis. So generally:

  • if data are counts and sparse then go into single-cell RNA-seq literature (such as the great OSCA book from Aaron Lun) and see which methods have been developed for normalization of sparse data
  • since you have some sort of input controls you could read ChIP-seq methodologies as this is conceptually similar to ChIP-seq IP vs chromatin/IgG input controls

Please understand that with such custom experiments one would essentially need to see the data at hand and then develop a strategy together. Consider to look for local collaboration if you need guidance, but the support site is not suited or intended for this.

Entering edit mode


I agree with you, and we are in process of working with collaborators, but I wanted to get a general opinion on the data and get a feel for it (My past experience has been vastly with rare disorder diagnosis with exome / genome) so I am getting used to RNA-seq analysis. I came across the OSCA and SingleR resources when I was trying to assign cell types from the experiment data (That is another analysis aspect we're working on) but I will go through them both.

I will try to keep the discussions to technical support aspects! Thanks!


Login before adding your answer.

Traffic: 857 users visited in the last hour
Help About
Access RSS

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6