【问题标题】:Association Clusters to Heatmap将集群关联到热图
【发布时间】:2020-04-20 12:41:41
【问题描述】:

我有两个单独的数据框,其中一个我已经从第一个数据框创建了一个热图,但是我想添加一个侧边栏,指示基因实际上与之相关的家族类型。

数据框 1

BGC1     BGC2    Distance
-----------------------------------------------
BGC31     BGC34     0.6
BGC34     BGC45     0.7
BGC34     BGC53     0.2
BGC53     BGC31     0.8

数据框2

BGC1     Association  
----------------------------------
BGC31     Skin Cancer
BGC34     Skin Cancer     
BGC34     Lung Cancer     
BGC53     Liver Cancer

热图创建:

p3 <- heatmap.3(comat, scale = "none", trace = "none", col = color,  main="GCF Co-Occurrence Map"
                ,lhei=c(0.5,1),  keysize=0.5, cexRow = 0.60, cexCol = 0.65)

我正在寻找这样的东西,其中每种颜色代表一种与特定基因类相关的基因簇:

【问题讨论】:

    标签: r ggplot2 heatmap heatmaply


    【解决方案1】:

    查看 heatmaply 手册中的“使用 RowSideColors 添加基于附加因素的注释”部分:

    https://talgalili.github.io/heatmaply/articles/heatmaply.html#adding-annotation-based-on-additional-factors-using-rowsidecolors

    x  <- as.matrix(datasets::mtcars)
    rc <- colorspace::rainbow_hcl(nrow(x))
    
    heatmaply(
      x[, -c(8, 9)],
      seriate = "mean",
      col_side_colors = c(rep(0, 5), rep(1, 4)),
      row_side_colors = x[, 8:9]
    )
    

    结果:

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2013-09-04
      • 1970-01-01
      • 2013-11-12
      • 2020-04-03
      • 1970-01-01
      • 2014-02-08
      • 2019-06-10
      相关资源
      最近更新 更多