Seurat 提取亚细胞群并画出给定基因列表的Dotplot图
2023-08-13 本文已影响0人
火卫控
Seurat 提取亚细胞群并画出给定基因列表的Dotplot图
代码如下:
library(SeuratDisk)
library(patchwork)
library(dplyr)
library(Seurat)
hv1 <- readRDS(file = "./singlecell/bairong/fastgenomics-Hv1h5ad_2000vf-202304231117.rds")
# hv1_3 <- readRDS(file = "./singlecell/bairong/fastg-hv1-subcells_202308081058.rds")
hv1
# 28527 features across 584884 samples within 1 assay
# 2 dimensional reductions calculated: scanvi_emb, umap
head(hv1@meta.data$anatomical_region_level_1)
# [1] parenchyma parenchyma parenchyma airway airway airway
# Levels: airway nose parenchyma
table(hv1@meta.data$anatomical_region_level_1)
# airway nose parenchyma
# 173194 78279 333411
# 需要提取一下细胞群作为亚群
sub_class = c("Basal resting","Suprabasal","Multiciliated (nasal)",
"Multiciliated (nasal)","Multiciliated (non-nasal)",
"Club (non-nasal)","Club (nasal)","Goblet (nasal)",
"Goblet (bronchial)","Goblet (subsegmental)","AT1","AT2",
"AT2 proliferating")
# hv1_finest_sub 亚群提取 到hv1_fs
hv1_fs = hv1[,hv1@meta.data$ann_finest_level %in% sub_class]
# 需要展示的基因名
Proteases = c("MMP1","CTSL","TMPRSS2","IHH","IMMP2L","ZFYVE9","\
NAALADL2","USP39","TMPRSS11E","MMP2","PRSS22","MMP15","ECE2","PRSS35","\
RNF128","ADAMTS4","ADAM33","CAPN13","USP47","CAPN11","KLK5","AGTPBP1","\
TINAGL1","ADAMTS12","PSMB9","USP29","ASPRV1","CNDP1","DNPEP","PSMB1","CTSE","\
RNF13","PSMA1","CELA1")
# 保存亚群
#saveRDS(hv1_fs, file = "./singlecell/bairong/fastg-hv1-subcells_202308081058.rds",compress = F)#快
# Test用
# Proteases = c("ADAM33")
# 作点图 轴翻转,基因名为纵坐标
DotPlot(hv1_fs, features = Proteases, group.by="ann_finest_level" ,
dot.min = 0,
dot.scale = 4,
col.min=-2.5, col.max=2.5,
scale.min = 0,
scale.max = 40,
cols = c("yellow","red"))+ RotatedAxis()+coord_flip()
DotPlot(hv1_fs, features = Proteases, group.by="ann_finest_level" ,
dot.min = 0,
dot.scale = 4,
col.min=-2.5, col.max=2.5,
scale.min = 0,
scale.max = 0.1,
cols = c("yellow","red"))+ RotatedAxis()
hv1@meta.data$ann_finest_level
hv1_3@meta.data$ann_finest_level
scale.min max影响圆圈显示大小 上下限
cols = c("yellow","red") 颜色由黄到红