❝1、《KS科研分享与服务》公众号有QQ交流群,进入门槛是20元(完全是为了防止白嫖党,请理解),请考虑清楚。群里有免费推文的注释代码和示例数据(终身拥有),没有付费内容,群成员福利是购买单个付费内容半价!
2、《KS科研分享与服务》微信VIP群只针对购买打包代码的小伙伴(公众号所有付费内容合集)!微信群不是单独的,是对于打包的人答疑解惑和交流的平台、群成员专享视频教程,帖子提前发布,以及其他更多福利!
点击:→ 加入微信vip群:2024-2025《KS科研分享与服务》付费内容打包集合
3、需进QQ群或者打包代码入微信VIP的小伙伴请添加作者微信了解,请备注目的,除此之外请勿添加,谢谢!
详情请联系作者:
❞
#marker genes 和scRNA一样得操作
Spatial_integrated = PrepSCTFindMarkers(Spatial_integrated)
Markers <- FindAllMarkers(object = Spatial_integrated, only.pos = TRUE, min.pct = 0.1,
thresh.use = 0.1, verbose = T, assay = 'SCT')
current.cluster.ids <- c(0, 1, 2, 3,
4, 5, 6, 7,
8, 9, 10, 11,
12, 13, 14, 15,
16, 17, 18, 19,
20, 21, 22, 23,
24, 25, 26)
new.cluster.ids_clusterLevel <- c("White matter", "Th1", "Th2", "GPi",
"Striatum", "V", "Hy", "Amy",
"II", "III", "IV", "Mol",
"Cort.sub", "I", "DG", "Rsp1&2",
"I", "Bla", "Rtn", "VI",
"Ent", "Cort.sub", "Vent", "Ep",
"Chor.plx", "Th3", "CA3")
new.cluster.ids_regionLevel <- c("White matter", "Thalamus", "Thalamus", "GPi",
"Striatum", "Cortex", "Hypoth", "Amyg",
"Cortex", "Cortex", "Cortex", "Hipp.",
"Cort.sub", "Cortex", "Hipp.", "Cortex",
"Cortex", "Bla", "Rtn", "Cortex",
"Cortex", "Cort.sub", "Vent", "Cortex",
"Chor.plx", "Thalamus", "Hipp.")
Idents(Spatial_integrated) <- 'clusterLevel'
SpatialDimPlot(Spatial_integrated, images = 'Early2',
stroke=0.1, label = T, label.size = 4,
label.box=F, label.color = 'black',repel = T)&
scale_fill_manual(values = cols) &
theme_bw()&
theme(axis.text = element_blank(),
axis.ticks = element_blank(),
axis.title = element_blank(),
legend.position = "none")&
ggtitle("#Replicate2 Early")
SpatialDimPlot(Spatial_integrated,
ncol = 3,
cells.highlight = CellsByIdentities(object = Spatial_integrated, idents = c('II')))
DefaultAssay(Spatial_integrated) <- 'SCT'
pdf('./Figures/figure4.pdf', height = 8, width = 12)
SpatialFeaturePlot(Spatial_integrated, 'Ttr', ncol = 3)&
theme_bw()&
theme(axis.text = element_blank(),
axis.ticks = element_blank(),
axis.title = element_blank())
dev.off()
#注意,基因集是list
CASgene <- list(c("Trem2","C4b","Lyz2","Gfap","Cd52","Ctss","C1qc","H2-D1",
"Gpr17","Hsph1","Ctsz","Hist3h2a"))
#计算评分
Spatial_integrated <- AddModuleScore(object = Spatial_integrated,
features = CASgene,
name = 'CAS')
#plot==figure9
SpatialFeaturePlot(Spatial_integrated,
features = c("CAS1"),
alpha = c(0.1,1),
ncol = 3,
min.cutoff = 0,
max.cutoff = 1)&
theme_bw()&
theme(axis.text = element_blank(),
axis.ticks = element_blank(),
axis.title = element_blank())