xuranw / MuSiC

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

New "Too few common genes" bug #130

Closed alexandriatran closed 2 months ago

alexandriatran commented 2 months ago

Hello all, Out of curiosity I am trying to run MuSiC with LMC-RNA-seq data as the SingleCellExperiment. My input sce object and bulk matrices have the same number of rows and same rownames. Looking at the code to help debug, I found that music_basis() was called to extract genes from sce. Running that, I found that that basis$Disgn.mtx is a matrix without rownames. This may be the cause of the "Too few common genes" bug for me as in utils.R, cm.gene is calculated with intersect( rownames(sc.basis$Disgn.mtx), bulk.gene ).

Could you please look into this and see if there is a way to resolve the music_basis() helper function bug?

Thank you! Miscellaneous object details below to help reproduce issue:


> sce
class: SingleCellExperiment 
dim: 47100 56 
metadata(0):
assays(1): counts
rownames(47100): Sobic.004G056500.1
  Sobic.003G122000.1 ... Sobic.006G216600.2
  Sobic.002G128700.2
rowData names(0):
colnames(56): BundleSheathR1 BundleSheathR2 ...
  XylemR3_R XylemR4_R
colData names(4): Samples Type Stage Plant
reducedDimNames(0):
mainExpName: NULL
altExpNames(0):
> dim(bulk)
[1] 47100     8
> estim_props <- music2_prop_t_statistics(bulk.control.mtx = bulk[, 5:8], 
                                        bulk.case.mtx=bulk[, 1:4], 
                                        n_resample=4,
                                        select.ct=unique(lcm_meta$Type),
                                        sc.sce=sce, 
                                        clusters='Type', 
                                        samples='Plant')
Error in music_prop(bulk.mtx = bulk.control, sc.sce = sc.sce, clusters = clusters, : Too few common genes!
alexandriatran commented 2 months ago

I resolved this issue. It was a problem in how I created the SingleCellExperiment object. I had been using a data.frame to store the counts data, but it should be a matrix class.