# Error in .computeSumFactors: cells should have non-zero library sizes

While trying to run the following code in R:

list_of_sce <- list()
# Looping though the UMI_count 'split_factor' columns at a time
split_factor = 500
for(i in seq(1,ncols, split_factor)) {
num_loop = floor(i / split_factor) + 1
idx = ncols
if (i + split_factor < ncols) {
idx = i + split_factor
}
sce <- SingleCellExperiment(list(counts=UMI_count[, i : idx]))
# Normalization of the dataset containing
# heterogenous cell data (different cell types)
clusters <- quickCluster(sce)
sce <- computeSumFactors(sce, cluster=clusters)
list_of_sce[[num_loop]] <- sce
}


I am getting the error:

Error in .computeSumFactors(assay(x, i = assay.type), subset.row =
subset.row,  :
cells should have non-zero library sizes


There are warnings, so when I run warnings() command I see the following:

> warnings()
Warning messages:
1: In .computeSumFactors(assay(x, i = assay.type), subset.row =
subset.row,  ... :
encountered negative size factor estimates
2: In .computeSumFactors(assay(x, i = assay.type), subset.row =
subset.row,  ... :
encountered negative size factor estimates
3:...
...
39:....


I do not understand why is this happening, and how to debug it. Any suggestions would be greatly appreciated.

• What is the library size of the samples? computeSumFactors is failing because it can't compute the library size. I am not sure if your code is working as intended, shouldn't the sce be inside your loop?
– llrs
Dec 19 '17 at 7:45
• Do you have a sample with all 0s? Dec 19 '17 at 7:46
• Your code is different from another question you posted (here). Is this the same data/problem as in the linked question?
– llrs
Dec 19 '17 at 8:16
• It is the same. Where is the difference? Can't see it. These are related but different questions, so I asked them separately. Dec 19 '17 at 15:17