I am interested to correlate 2 variables like gene expression (gene symbols and fold change) and protein expression (gene symbols and fold change) using Spearman correlation coefficient analysis as depicted in Fig. A ( Int. J. Mol. Sci. 2018, 19 (12), 3836; https://doi.org/10.3390/ijms19123836 ). I searched on the net to see the code for correlation but these codes give the heatmaps with Spearman correlation with same X and Y axis variables as can be seen in Fig. B. ( ggplot2: Quick correlation matrix heatmap - R software and data visualization - Easy Guides - Wiki - STHDA. I need a heatmap showing variables from gene expression data on 1 axis (var 1) and protein expression on other axis (var 2). Thanks in advance:! Image link: https://community.rstudio.com/t/heatmap-with-correlation-coefficient/100543
Would this work for you? The example is taken from Introduction to the hearmaply package.
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
)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.