MarcElosua/SPOTlight

error when using trainNMF function

Closed this issue · 3 comments

I was trying to use trainNMF function, and here is the error code:

Error in asMethod(object) :
Cholmod error 'problem too large' at file ../Core/cholmod_dense.c, line 102

Do you know how to fix it? Thanks!

hi @sarashen2017

This seems to be a problem when trying to convert a sparse matrix to dense (necessary with the current implementation but being fixed as we speak), see stackoverflow. How large is your dataset (number of genes and cells?) I recommend subsetting the number of genes to the DE genes and up to 100 cells per cell type.

Let me know if this helps or if you have any further questions!

I subset my genes to around 9000, and subset cells to 100cells/cell type. My final scRNA matrix is 9000x4700, however, my spatial data is still very large. The matrix is 9000x127810 (the 9000 genes are DE gene intersect of scRNA and spatial data).

Oh! Technically trainNMF doesn't need the information from the entire spatial matrix, it just needs the rownames to determine the union gene set with ST to use. Instead of the spatial matrix I would suggest to feed it a matrix of 9000x1 dimensions so that it can grab the rownames. This is something we are improving in the development version of SPOTlight!

Let me know if it works now!