1. #怎么样的分群是合理的
    2. rm(list = ls())
    3. # devtools::install_github('satijalab/seurat-data')
    4. library(SeuratData)
    5. library(ggplot2)
    6. library(patchwork)
    7. library(dplyr)
    8. load(file = 'basic.sce.pbmc.Rdata')
    9. DimPlot(pbmc,
    10. reduction = 'umap',
    11. label = TRUE,
    12. pt.size = 0.5) + NoLegend()
    13. sce=pbmc
    14. #先执行不同resolution 下的分群
    15. library(Seurat)
    16. library(clustree)
    17. sce <- FindClusters(object = sce,
    18. resolution = c(seq(.1,1.6,.2)))
    19. clustree(sce@meta.data,
    20. prefix = "RNA_snn_res.")
    21. colnames(sce@meta.data)

    image.png

    1. ##
    2. p1=DimPlot(sce,
    3. reduction = 'umap',
    4. group.by = 'RNA_snn_res.0.5',
    5. label = TRUE, pt.size = 0.5) + NoLegend()
    6. p2=DimPlot(pbmc,
    7. reduction = 'umap',# group.by = 'seurat_clusters',
    8. label = TRUE, pt.size = 0.5) + NoLegend()
    9. p1+p2
    10. ##
    11. p1=DimPlot(sce,
    12. reduction = 'umap',
    13. group.by = 'RNA_snn_res.0.5',
    14. label = TRUE, pt.size = 0.5) + NoLegend()
    15. p2=DimPlot(sce,
    16. reduction = 'umap',
    17. group.by = 'RNA_snn_res.1.5',
    18. label = TRUE, pt.size = 0.5) + NoLegend()
    19. p1+p2

    image.png
    image.png