Body: <p>While trying to run the following code in <code>R</code>:</p>
  
  <pre><code>list_of_sce &lt;- 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 &lt; ncols) {
      idx = i + split_factor
    } 
  sce &lt;- SingleCellExperiment(list(counts=UMI_count[, i : idx]))
  # Normalization of the dataset containing 
  # heterogenous cell data (different cell types)
  clusters &lt;- quickCluster(sce)
  sce &lt;- computeSumFactors(sce, cluster=clusters)
  list_of_sce[[num_loop]] &lt;- sce
  }
  </code></pre>
  
  <p>I am getting the error:</p>
  
  <pre><code>Error in .computeSumFactors(assay(x, i = assay.type), subset.row = 
  subset.row,  : 
  cells should have non-zero library sizes
  </code></pre>
  
  <p>There are <code>warnings</code>, so when I run <code>warnings()</code> command I see the following:</p>
  
  <pre><code>&gt; 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:....
  </code></pre>
  
  <p>I do not understand why is this happening, and how to debug it. Any suggestions would be greatly appreciated.</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-12-19T07:45:22.423Z
Comments.Text: 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?
Comments.UserDisplayName: llrs
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-12-19T07:46:44.877Z
Comments.Text: Do you have a sample with all 0s?
Comments.UserDisplayName: Devon Ryan
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-12-19T08:16:10.020Z
Comments.Text: Your code is different from another question you posted ([here](https://bioinformatics.stackexchange.com/q/3123/48)). Is this the same data/problem as in the linked question?
Comments.UserDisplayName: llrs
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-12-19T15:17:03.777Z
Comments.Text: It is the same. Where is the difference? Can't see it. These are related but different questions, so I asked them separately.
Comments.UserDisplayName: Nikita Vlasenko
Tags: <rna-seq><r><scran>
Title: Error in .computeSumFactors: cells should have non-zero library sizes
ThreadText: # Error in .computeSumFactors: cells should have non-zero library sizes
  
  (Asked by: username_0 on 2017-12-18)
  
  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.
  
  **Tags:** rna-seq, r, scran
  
  > **Comments:**
  > **username_1**: 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?  
  > **username_2**: Do you have a sample with all 0s?  
  > **username_1**: Your code is different from another question you posted ([here](https://bioinformatics.stackexchange.com/q/3123/48)). Is this the same data/problem as in the linked question?  
  > **username_0**: It is the same. Where is the difference? Can't see it. These are related but different questions, so I asked them separately.  
  
  ---
  
  ## 0 answers
  
  