I previously worked with SingleR
and Seurat
to annotate my clusters. I have followed the workflow stated here and it all worked fine.
The Seurat
object is already scaled and normalized.
Now, when trying to do it again, with the same data set,:
sce <- as.SingleCellExperiment(seurat_starsolo)
ref <- cells_highquality_ovary.sce
pred <- SingleR(test=sce, ref=ref, labels=ref$ident, method = "wilcox", clusters = colData(sce)$ident)
seurat_starsolo[["SingleR.labels"]] <- pred$labels
it throws an error:
Error: Cannot add more or fewer cell meta.data information without values being named with cell names
I don't understand why it's not working no, that I haven't change anything.
any help would be appreciated.
Yes, it does explain the problem. You have a vector with 32 values and try to feed that into an object that is much longer. This is a simple matching problem so you need some sort of join operation to give the label per cluster to every cell in your sce that belongs to this cluster. Many base R ways to do this, but that's not a Bioconductor issue.