dylkot / cNMF

Code and example data for running Consensus Non-negative Matrix Factorization on single-cell RNA-Seq data
MIT License
243 stars 57 forks source link

Usages matrix is empty #76

Closed ccruizm closed 1 month ago

ccruizm commented 6 months ago

Good day,

I am using cNMF in 10x scRNA data and run the whole pipeline without any problem, and the outputs look good except for the consensus matrix which is empty and only returns the cells and programs.

I am trying to figure out what the issue can be. I have read several issues in GitHub related to errors when there are low gene counts or cells that do not express any of the overdispersed genes, but in my case, I do not get any error, but all files are output by cnmf consensus with the drawback of the usage matrix. Attached is the output, so maybe you can help me understand where the problem relies.

Thanks in advance! output_ngenes5000_niter100_ruiz.gene_spectra_tpm.k_17.dt_0_02.txt output_ngenes5000_niter100_ruiz.spectra.k_17.dt_0_02.consensus.txt output_ngenes5000_niter100_ruiz.usages.k_17.dt_0_02.consensus.txt

output_ngenes5000_niter100_ruiz clustering k_17 dt_0_02 output_ngenes5000_niter100_ruiz.gene_spectra_score.k_17.dt_0_02.txt

ccruizm commented 6 months ago

I have dug a bit into the source of the issue, and I found that the step for refitting the usage is causing the problem. When in set refit_usage=False I get the usages matrix. I still have not understood why the refit_usage is giving an empty matrix. If you can provide any insights, it will be greatly appreciated.

dylkot commented 4 months ago

Hi, sorry for slow reply. Can you copy your full consensus command? Does the problem persist if you use density_threshold=0.15 which seems more appropriate based on the histogram? My guess is maybe you are filtering out all of the representative spectra from one of the clusters. refit_usage only updates the usage matrix so it really shouldn't make any difference for the spectra output at all. As a sanity check, maybe try it with density_threshold=0.15 or =1 and lets see what it does. I'm also happy to trouble shoot if you send a reproducible example.

Also, just to confirm, what version are you using for cnmf, is it from pip from the development branch? Thanks!