seurat 将细胞群合并

90 阅读1分钟
Idents(jushi_4_0.1)#cluster+细胞
levels(jushi_4)#cluster
head(jushi_4@meta.data)
##  method : 1 
new.cluster.ids <- c("Fibroblasts", "Macrophages","Macrophages", "T/NK cells", 
                     "Endothelial cells", "Fibroblasts", "Endothelial cells",
                     "Endothelial cells", "T/NK cells", "Dendritic cells","Fibroblasts","Granulocytes","Granulocytes","B cells","Plasma cells",
                     "Endothelial cells","Fibroblasts","Cardiomyocytes","Macrophages","Smooth muscle cells")
names(new.cluster.ids) <- levels(jushi_4)
jushi_4 <- RenameIdents(jushi_4, new.cluster.ids)
DimPlot(jushi_4, reduction = 'umap', 
        label = TRUE, pt.size = 0.5) + NoLegend()

## 一定要加上这两句,才可以修改细胞类型到celltype
jushi_4@meta.data$celltype<- jushi_4@meta.data$seurat_clusters
levels(jushi_4@meta.data$celltype) <- new.cluster.ids#