【问题标题】:Heatmap with Spearman correlation coefficient between gene expression and protein expression基因表达和蛋白质表达之间具有Spearman相关系数的热图
【发布时间】:2021-03-31 12:08:30
【问题描述】:

我有兴趣使用图 A(Int. J. Mol. Sci. 2018 年,19 (12),3836;https://doi.org/10.3390/ijms19123836)。我在网上搜索以查看相关代码,但这些代码给出了具有 Spearman 相关性的热图,具有相同的 X 和 Y 轴变量,如图 B 所示。(ggplot2:快速相关矩阵热图 - R 软件和数据可视化 - Easy Guides - Wiki - STHDA. 我需要一个热图,显示 1 轴 (var 1) 上的基因表达数据和其他轴 (var 2) 上的蛋白质表达的变量。 提前致谢!! 图片链接:https://community.rstudio.com/t/heatmap-with-correlation-coefficient/100543

【问题讨论】:

    标签: r heatmap correlation


    【解决方案1】:

    这对你有用吗?该示例来自于 heartmaply 包的介绍。

    library(dplyr)
    library(heatmaply)
    library(dendextend)
    
    x  <- mtcars %>%
      head() %>%
      as.matrix()
    
    row_dend  <- x %>% 
      dist %>% 
      hclust %>% 
      as.dendrogram %>%
      set("branches_k_color", k = 3) %>% 
      set("branches_lwd", c(1, 3)) %>%
      ladderize
    # rotate_DendSer(ser_weight = dist(x))
    col_dend  <- x %>% 
      t %>% 
      dist %>% 
      hclust %>% 
      as.dendrogram %>%
      set("branches_k_color", k = 2) %>% 
      set("branches_lwd", c(1, 2)) %>%
      ladderize
    #    rotate_DendSer(ser_weight = dist(t(x)))
    
    heatmaply(
      percentize(x),
      Rowv = row_dend,
      Colv = col_dend
    )
    

    【讨论】:

      猜你喜欢
      • 2018-02-03
      • 2021-02-16
      • 1970-01-01
      • 2021-03-30
      • 1970-01-01
      • 2020-02-28
      • 1970-01-01
      • 2019-02-25
      • 2020-05-18
      相关资源
      最近更新 更多