jr-leary7 / SCISSORS

SCISSORS builds upon the Louvain graph-based clustering in Seurat by optimizing parameter selection when reclustering cell groups, with an eye towards identifying rare cell types.
MIT License
9 stars 4 forks source link

Error: No cells found in ReclusterCells #32

Open gianfilippo opened 6 months ago

gianfilippo commented 6 months ago

Hi,

I am testing your package with my data. I have an integrated Seurat object. I used STACAS for integration and the clustering at this point is already defined as cell types strings. I converted the strings describing cell types to integers, as it seems required by the ReclusterCells function and created a seurat_clusters variable. Clusters IDs are integers from 1 to 15. I then run directly t_reclust <- ReclusterCells(scdata.combined,auto=T,redo.embedding=T,n.cores=20,is.integrated = T, integration.ident="SampleName") but I get Error: No cells found

I could trace this error to if (!merge.clusters) { temp_obj <- subset(seurat.object, subset = seurat_clusters == which.clust[[i]]) }

The issue seems to be in which.clust <- as.integer(names(which(ComputeSilhouetteScores(seurat.object) < cutoff.score)))

this results in a which.clust with cluster IDs shifted by 1, i.e. if seurat_clusters range is [1,15], the which.clust range is [0,14] and as a consequence temp_obj <- subset(seurat.object, subset = seurat_clusters == which.clust[[i]]) fails.

I am probably doing something wrong. Can you please help ?

Thanks