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
119 stars 55 forks source link

Error in `[.default`(clusts, , paste0("sc3_", hash.table[i, 1], "_clusters")) #73

Open DrLucyMac opened 6 years ago

DrLucyMac commented 6 years ago

Hello! I am using SC3 for clustering of pbmc single cell data which was originally a Seurat object converted to SCE. However, I have encountered the following issue...

pbmc <- sc3_estimate_k(pbmc)
metadata(pbmc)$sc3$k_estimation

#Transform counts slot in pbmc object to full matrix as sparse matrix throws error about wrong dimension
counts(pbmc) <- as.matrix(counts(pbmc))
logcounts(pbmc) <- as.matrix(logcounts(pbmc))
pbmc <- sc3(pbmc, ks = 11, biology = TRUE)

Error in checkForRemoteErrors(val) : 3 nodes produced errors; first error: Error in [.default(clusts, , paste0("sc3_", hash.table[i, 1], "_clusters")) : incorrect number of dimensions

Is there something i am doing wrong?

Cheers, Lucy

wikiselev commented 6 years ago

Hi, could you please check this issue first? https://github.com/hemberg-lab/SC3/issues/61

DrLucyMac commented 6 years ago

Hi, I had a look at the issue 61. What n_dim do you recommend for a sample of >5000 cells? This is the SCE object. I do all my preprocessing (QC/normalization) with Seurat then convert to SCE.

screen shot 2018-07-17 at 14 58 55

Thanks for your help. Lucy

wikiselev commented 6 years ago

Hi, sorry for a very long delay, I suppose you figured this out already, or still need help?

reemagit commented 5 years ago

Hello, I have a similar problem. I use an external environment to make QC and preprocessing, and after import the table in R and create a SingleCellExperiment. Error in[.default(clusts, , paste0("sc3_", hash.table[i, 1], "_clusters")) : incorrect number of dimensions Error in[.default(clusts, , paste0("sc3_", hash.table[i, 1], "_clusters")) : incorrect number of dimensions Error in[.default(clusts, , paste0("sc3_", hash.table[i, 1], "_clusters")) : incorrect number of dimensions Error in checkForRemoteErrors(val) : 3 nodes produced errors; first error: Error in[.default(clusts, , paste0("sc3_", hash.table[i, 1], "_clusters")) : incorrect number of dimensions. Just for reference, my code is:

library(SingleCellExperiment)
library(SC3)
data <- read.table(file = 'scdata.csv', header = TRUE, row.names=1, sep=',')
sce <- SingleCellExperiment(assays = list(logcounts = as.matrix(t(data))))
rowData(sce)$feature_symbol <- rownames(sce)
sce <- sce[!duplicated(rowData(sce)$feature_symbol), ]
sce <- sc3_estimate_k(sce)
metadata(sce)$sc3$k_estimation
system.time(sce <- sc3(sce, ks = 31, biology = TRUE, gene_filter=FALSE))

As a note, I get a very high number of estimated clusters with sc3_estimate_k (301!!). Is there something I am doing wrong?

Thanks in advance, Enrico

wikiselev commented 5 years ago

@reemagit, would you be able to share your dataset so that I can check the errors? You can share it with vk6@sanger.ac.uk

reemagit commented 5 years ago

Hello, I apologize for answering late. Unfortunately I am not authorized to share the dataset, but I think I solved my problem since the error is not showing up anymore. I am not sure what the problem was, but in previous iterations the preprocessing for the data was done in python and the processed data was loaded in R. Switching to a pure R processing solved the issue, so maybe there was some problem in the transfer. Thanks for the help anyways, Enrico

wikiselev commented 5 years ago

Ok, I will close it for now, thanks for replying.

mariaprimo commented 5 years ago

I think I found the problem!!! In this line if there is only one k provided then clusts becomes a vector and the subsetting of the vector throws an error. https://github.com/hemberg-lab/SC3/blob/eaae33bb5bccfb1cdd8ff05ef8f3aa216efb9c1d/R/CoreMethods.R#L705

So, one either has to run with at least two values in ks or @wikiselev has to fix this!

wikiselev commented 5 years ago

Thanks, Maria! I will try to fix this asap, for the moment please use Maria's advice - have at least two values in ks.

poseidonchan commented 2 years ago

Thanks for @mariaprimo 's answer, but it's been three years and this issue still exists 👀