I am aware of this question Manually define clusters in Seurat and determine marker genes that is similar but I couldn't make tit work for my use case.
So I have a single cell experiments and the clustering id not great I have a small groups of 6 cells (I know it is extremely small, but nonetheless I would like to make the most of it) that are clearly isolate in UMAP and display marker that I am interresting in.
I managed to get those cells names in barcode (e.g.: AGCCAGCTCGCTTTAT).
I would like to compute differential expression of those cells against all others groups (using FindMarkers or FindAllMarkers).
I tried to manually define the cluster in: [email protected]$seurat_clusters But using FindMarkers (it says this groups don't exist)
then I try to modify [email protected]
but then it could not found metadata attached to my newly define group.
I am kind of stuck and any help is warmly welcome
Code
My R is quite rusty...
names_ # a vector with the names of the cell I want as a cluster
# my seurat object have 5 cluster 0..4. So I want to add a 6th clusters with id 5
#First attempt manually modify the vector active.ident and cluster
# they are both factor so we need to add a factor level
levels([email protected]) = c(levels([email protected]), 5)
levels([email protected]$seurat_clusters) = c(levels([email protected]$seurat_clusters), 5)
# then modify them :
[email protected][which(row.names([email protected]) %in% names_)] = 5
[email protected]$seurat_clusters[which(row.names([email protected]) %in% names_)] = 5
FindMarkers(s_19270BC, ident.1 = 5)
So This morning it works... I don't know what I have done yesterday...
EDIT: I added the Code I used