library(ComplexHeatmap)
library(circlize)
# 这里以画不同细胞类型的marker基因为例:
# 需要画图的矩阵
plotmtx <- tumor@assays$RNA@data[ordergenes,ordercells]
# 热图上下的标注使用函数HeatmapAnnotation()
ha = HeatmapAnnotation(
Celltype = c(rep('Astro',floor(length(which(tumor$scref13.2 == 'Astro'))/10)),
rep('qNSC' ,floor(length(which(tumor$scref13.2 == 'qNSC' ))/10)),
rep('aNSC' ,floor(length(which(tumor$scref13.2 == 'aNSC' ))/10)),
rep('NPC' ,floor(length(which(tumor$scref13.2 == 'NPC' ))/10)),
rep('Neu' ,floor(length(which(tumor$scref13.2 == 'Neu' ))/10)),
rep('OPC' ,floor(length(which(tumor$scref13.2 == 'OPC' ))/10)),
rep('Oligo',floor(length(which(tumor$scref13.2 == 'Oligo'))/10))),
col = list(Celltype = c('Astro' = "pink",
'qNSC' = "red",
'aNSC' = "orange",
'NPC' = "yellow",
'Neu' = "green",
'OPC' = 'skyblue',
'Oligo' = 'purple'))
)
参考
https://jokergoo.github.io/ComplexHeatmap-reference/book/
https://jokergoo.github.io/ComplexHeatmap-reference/book/more-examples.html
网友评论