Answers.Body: <p>Ultimately I just implemented it manually with the precursor to <code>SingleCellExperiment</code> matrix (<code>UMI_count</code> which is <code>dgcMatrix</code> type) object in the following way:</p>
  
  <pre><code># Removing genes with 0 - counts in all of the columns
  num_removed = 0
  for(i in 1:nrow(UMI_count)) {
    idx = i - num_removed
    if(sum(UMI_count[idx,]) &lt; 1) {
      UMI_count &lt;- UMI_count[-idx,]
      num_removed = num_removed + 1
      print(i)
    }
  }
  
  sce &lt;- SingleCellExperiment(list(counts=UMI_count))
  </code></pre>
  
  <p>I am getting sums of the columns for each row and then filtering out rows with the <code>sum &lt; 1</code>. So, <code>sum</code> function for the slices - rows (<code>numeric</code> type) is working.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-12-20T15:28:28.540Z
Answers.LastActivityDate: 2017-12-20T15:28:28.540Z
Answers.UserDisplayName: Nikita Vlasenko
Body: <p>I am having a <code>SingleCellExperiment</code> (sce) object:</p>
  
  <blockquote>
    <p>sce &lt;- SingleCellExperiment(list(counts=UMI_count)) </p>
  </blockquote>
  
  <p>which has two dimensions:</p>
  
  <pre><code>dim(sce)
  [1] 46761 68027
  </code></pre>
  
  <p>When I am trying to get column sums for all rows the following does not work:</p>
  
  <pre><code>colSums(assay(sce), na.rm = FALSE, dims = 1)
  </code></pre>
  
  <p>Giving me an error: </p>
  
  <blockquote>
    <p>Error in colSums(assay(sce)) : 'x' must be an array of at least two dimensions</p>
  </blockquote>
  
  <p>Apparently the issue was already described:</p>
  
  <p><a href="https://support.bioconductor.org/p/100954/" rel="nofollow noreferrer">https://support.bioconductor.org/p/100954/</a></p>
  
  <p>However, I can not find the solution. Is there another way of getting sums of columns of either <code>SingleCellExperiment</code> object or just <code>dgcMatrix</code>?</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-12-20T09:09:16.607Z
Comments.Text: Are you trying to get the sum of the rows or the columns?
Comments.UserDisplayName: AudileF
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-12-21T08:17:50.967Z
Comments.Text: Did you check what does `assay(sce)` return? Which is the output of `dim(assay(sce))` ?
Comments.UserDisplayName: llrs
Tags: <rna-seq><r>
Title: Error in colSums(assay(sce)) : 'x' must be an array of at least two dimensions
ThreadText: # Error in colSums(assay(sce)) : 'x' must be an array of at least two dimensions
  
  (Asked by: username_0 on 2017-12-19)
  
  I am having a `SingleCellExperiment` (sce) object:
  
  > sce <- SingleCellExperiment(list(counts=UMI\_count))
  
  which has two dimensions:
  
  ```
  dim(sce)
  [1] 46761 68027
  
  ```
  
  When I am trying to get column sums for all rows the following does not work:
  
  ```
  colSums(assay(sce), na.rm = FALSE, dims = 1)
  
  ```
  
  Giving me an error:
  
  > Error in colSums(assay(sce)) : 'x' must be an array of at least two dimensions
  
  Apparently the issue was already described:
  
  <https://support.bioconductor.org/p/100954/>
  
  However, I can not find the solution. Is there another way of getting sums of columns of either `SingleCellExperiment` object or just `dgcMatrix`?
  
  **Tags:** rna-seq, r
  
  > **Comments:**
  > **username_1**: Are you trying to get the sum of the rows or the columns?  
  > **username_2**: Did you check what does `assay(sce)` return? Which is the output of `dim(assay(sce))` ?  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2017-12-20. Score: 0 | Accepted answer
  
  Ultimately I just implemented it manually with the precursor to `SingleCellExperiment` matrix (`UMI_count` which is `dgcMatrix` type) object in the following way:
  
  ```
  # Removing genes with 0 - counts in all of the columns
  num_removed = 0
  for(i in 1:nrow(UMI_count)) {
    idx = i - num_removed
    if(sum(UMI_count[idx,]) < 1) {
      UMI_count <- UMI_count[-idx,]
      num_removed = num_removed + 1
      print(i)
    }
  }
  
  sce <- SingleCellExperiment(list(counts=UMI_count))
  
  ```
  
  I am getting sums of the columns for each row and then filtering out rows with the `sum < 1`. So, `sum` function for the slices - rows (`numeric` type) is working.
  
  
  ---
  
  