hemberg-lab / SC3

A tool for the unsupervised clustering of cells from single cell RNA-Seq experiments
http://bioconductor.org/packages/SC3
GNU General Public License v3.0
118 stars 55 forks source link

Error in prcomp.default #97

Closed dsimps1993 closed 4 years ago

dsimps1993 commented 4 years ago

Describe the bug I've got a dataset of 1175 cells, which I've filtered down to 18 genes. I want to run SC3 on these cells with just these genes to see how much these genes contribute to the separation of these cells. I've done a similar thing before except with more genes (40ish). When I try to run it this time, I get the following error:

JM.EndoEM.nSt4.EGenes.sc3 <- sc3(JM.EndoEM.nSt4.EGenes, ks = 2:10, biology = T) Setting SC3 parameters... Calculating distances between the cells... Performing transformations and calculating eigenvectors... Error in checkForRemoteErrors(val) : 4 nodes produced errors; first error: Error in prcomp.default(dists, center = TRUE, scale. = TRUE) : cannot rescale a constant/zero column to unit variance

To Reproduce Please provide the exact code that you run and ideally share your dataset with vk6@sanger.ac.uk

Session Info: (I'm using a slightly old R environment and older packages since this is an older project I'm working on.) R version 3.5.0 (2018-04-23) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 10 x64 (build 17134) SC3_1.10.1
scater_1.8.4 Seurat_2.3.4

wikiselev commented 4 years ago

Hi, I think this:

cannot rescale a constant/zero column to unit variance

means that you have some columns (cells) in your dataset containing only zeros, which is quite possible when you reduce the dataset to just 18 genes. Try to filter these columns out and see whether it will help.

dsimps1993 commented 4 years ago

Thanks, that seems to have worked!

boyiguo1 commented 1 year ago

Just to confirm, should the root cause for this problem be one of the distance matrices calculated contains elements that have 0 variances, instead of the cells that have 0 variances?

means that you have some columns (cells) in your dataset containing only zeros, which is quite possible when you reduce the dataset to just 18 genes. Try to filter these columns out and see whether it will help.

wikiselev commented 1 year ago

I think the problem happened when the cell expression matrix contained columns with all zeros after filtering.