constantAmateur / SoupX

R package to quantify and remove cell free mRNAs from droplet based scRNA-seq data
249 stars 34 forks source link

Invalid cluster specification #85

Closed peachgong closed 2 years ago

peachgong commented 2 years ago

when I run setCluster function as follow:

clusters<-c(as.matrix(FemaleM@meta.data$seurat_clusters)) barcodes<-c(as.matrix(rownames(FemaleM@meta.data))) sc = setClusters(sc, setNames(clusters, barcodes))

It always gets an error say "Error in setClusters(sc, setNames(clusters, barcodes)) : Invalid cluster specification. See help."

FemaleM is a Seurat object in which I have clustered the data and had specific cluster information.

Any idea for the error?

peachgong commented 2 years ago

The cluster information is from the Seurat object. I did the PCA and KNN based clustering at first. So it is known which barcode belongs to which cluster, and this information is stored in Seurat object. When I try to refer to this information when using setClusters, there is always an error showing "invalid cluster specification". I wonder how people usually get clustering information of the samples in this algorithm? The vignette uses the table from PBMC samples that have already contains this.

hothri commented 2 years ago

@peachgong Hi, Have you solved this? Which cluster information did you use?

peachgong commented 2 years ago

Yes. I think so. I later use that from cellranger instead of seurat object

mihem commented 2 years ago

Using the Seurat information works for me (e.g. in case you run cellranger with --nosecondary, which I often due to save time). It's important that you create the Seurat object with minmal restriction, so that you end up with the same dims, so e.g.

CreateSeuratObject(sc, min.cells = 0, min.features = 0)

which is the default, but usually you select min.cells = 3 and min.features = 200 as suggested in the Seurat vignette, which would throw an error.

domenico-somma commented 1 year ago

Thanks for the suggestion, it solved for me as well. I was wondering whether they changed SoupX behaviour or is possible to make it work even if there are a different number of cells between the Seurat object and the original raw data.