在对粒度进行选择或注释存在疑问时,往往需要对粒度进行调整,为方便的查看不同粒度下的细胞走向,使用以下代码进行可视化。
rm(list = ls())
library(Seurat)
# devtools::install_github('satijalab/seurat-data')
library(SeuratData)
library(ggplot2)
library(patchwork)
library(dplyr)
load(file = 'basic.sce.pbmc.Rdata')
DimPlot(pbmc, reduction = 'umap',
label = TRUE, pt.size = 0.5) + NoLegend()
sce=pbmc
#先执行不同resolution 下的分群
library(Seurat)
library(clustree)
sce <- FindClusters(
object = sce,
resolution = c(seq(.1,1.6,.2)) #起始粒度,结束粒度,间隔
)
clustree(sce@meta.data, prefix = "RNA_snn_res.")
参考来源:
https://mp.weixin.qq.com/s/WRhMC3Ojy1GWYfLS_4vSeA
鸣谢:
I thank Dr.Jianming Zeng(University of Macau), and all the members of his bioinformatics team, biotrainee, for generously sharing their experience and codes.
问题交流:
Email: xuran@hrbmu.edu.cn