I'm having trouble setting the FindMarkers function in Seurat to particular clusters in my dataset. I've tried this code and some variations of it several times but nothing seems to be working unfortunately:
DefaultAssay(seurat_integrated) <- "RNA"
cell.8.markers <- FindMarkers(seurat_integrated, ident.1=8, group.by="groups")
write.csv(cell.8.markers %>% group_by(cluster), 'cluster_8_markers_seurat_integrated_01072022.csv')
DefaultAssay(seurat_integrated) <- "integrated"
It returns this error:
Error in WhichCells.Seurat(object = object, idents = ident.1) :
Cannot find the following identities in the object: 1
Could tell me why this might be happening? I have already put my data through an integration pipeline and I've heard that the FindMarkers function should be run on the "RNA" data instead of the "integrated," which is why I set the assay to "RNA" in the first line. From what I understand, it does seem that "8" is a cluster in my dataset:
> head(Idents(seurat_integrated), 5)
AAACCTGAGAGGGATA-1_1 AAACCTGAGCTTTGGT-1_1 AAACCTGAGGACAGAA-1_1
1 6 1
AAACCTGAGGATGCGT-1_1 AAACCTGAGTGAAGAG-1_1
18 6
26 Levels: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 ... 25
I hope this question isn't too simple, but would someone be able to help me with this?
Did you try to run
FindConservedMarker
on the same cluster?