xuranw / MuSiC

Multi-subject Single Cell Deconvolution
https://github.com/xuranw/MuSiC
GNU General Public License v3.0
235 stars 94 forks source link

Sparse matrix support in MuSiC 1.0 isn't working #99

Closed jaclynbeck-sage closed 2 years ago

jaclynbeck-sage commented 2 years ago

I installed the latest version of MuSiC today and am attempting to run it with a SingleCellExperiment object that has a sparse matrix as the count matrix. When I call music_prop, it crashes at the start of the function music_basis here:

if (non.zero) {
    x <- x[rowSums(counts(x)) > 0, ]
}

The issue is with rowSums: Error in rowSums(x) : 'x' must be an array of at least two dimensions

counts(x) returns a sparse matrix of class "dgCMatrix". If I run rowSums(counts(x)) in my console, it is able to handle the function call because it figures out it needs to use Matrix::rowSums. However when calling the music_prop / music_basis function, it tries to use the base rowSums function instead and throws an error.

xuranw commented 2 years ago

I have updated MuSiC. Could you please try again?

utkarsh0493 commented 2 years ago

@xuranw I updated the MuSiC to 1.0.0 version, and I got the same error as that of @jaclynbeck-sage . I second the suggestion provided by @jaclynbeck-sage on this issue about explicitly mentioning the package name for the function.

xuranw commented 2 years ago

Could you please try again? @utkarsh0493 @jaclynbeck-sage

jaclynbeck-sage commented 2 years ago

It's working! Thank you so much, you're awesome for fixing this so quickly!