Skip to content

sparse matrix support #2

@RubenVanEsch

Description

@RubenVanEsch

hey team,
Super cool paper and technique. I was trying to run it on a somewhat bigger dataset using the matrix from a Seurat object.
I turned it into the 'gene_expression part of the GEMLI_items like this:

List of 1
 $ gene_expression:Formal class 'dgCMatrix' [package "Matrix"] with 6 slots
  .. ..@ i       : int [1:327799321] 0 20 21 37 40 44 50 64 65 66 ...
  .. ..@ p       : int [1:172848] 0 2984 5662 6968 9743 11607 15467 16008 18143 20988 ...
  .. ..@ Dim     : int [1:2] 29394 172847
  .. ..@ Dimnames:List of 2
  .. .. ..$ : chr [1:29394] "ENSG00000121410" "ENSG00000268895" "ENSG00000148584" "ENSG00000175899" ...
  .. .. ..$ : chr [1:172847] "KB1_AAACCCAAGCCGATAG" "KB1_AAACCCAAGGAACTAT" "KB1_AAACCCAAGGTTATAG" "KB1_AAACCCAGTAATGCGG" ...
  .. ..@ x       : num [1:327799321] 1.04 1.87 1.04 1.54 1.04 ...
  .. ..@ factors : list()

I wanted to use the sparse matrix (dgCMatrix), but this throws an error:

Error in rowMeans(data_matrix): 'x' must be an array of at least two dimensions
Traceback:

1. predict_lineages(GEMLI_items)
2. potential_markers(data_matrix)
3. rowMeans(data_matrix)
4. stop("'x' must be an array of at least two dimensions")

however, running rowMeans(GEMLI_items[['gene_expression']]) works just fine.
the error is fixed by turning the matrix into a dense matrix, however this takes up a lot of space (~40Gb in this case) and tends to crash the kernel.

i don't know if this has something to do with my input, but if it is indeed the case that sparse matrix is not supported, I think it would be nice if this were the case

EDIT:
i found that the first error can be solved by specifying the rowMeans in the potential_markers.R function to Matrix::rowMeans(data_matrix). However, I am not sure if the rest of the code supports it

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions