美文网首页
生信笔记6-ComplexHeatmap包的使用

生信笔记6-ComplexHeatmap包的使用

作者: 江湾青年 | 来源:发表于2021-07-14 13:49 被阅读0次
    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

    相关文章

      网友评论

          本文标题:生信笔记6-ComplexHeatmap包的使用

          本文链接:https://www.haomeiwen.com/subject/cuyrultx.html