1

I'm trying to create an heatmap on the base of spearman correlation and with dendrogramm corresponding to spearman correlation values. My input file is composed as follow:

 > data[1:6,1:6]
         group EG   PN        C0      C10     C10.1
    1 Patients 24  729 352.66598 43.80707  75.16226
    2 Patients 24  729 195.48486 17.15763  33.60365
    3 Patients 24  729 106.85937 15.13400  34.47340
    4 Patients 27 1060  76.70645 14.98315  22.09885
    5 Patients 27 1060 354.07169 50.61995  98.36765
    6 Patients 27 1060 331.84956 92.00343 125.46658
> data[150:160,1:6]
       group EG   PN        C0       C10     C10.1
150 Controls 27 1011  99.94756  9.018773 20.207498
151 Controls 30  616 300.20203 25.667548 37.363280
152 Controls 30  616 190.38030 18.811198 46.417332
153 Controls 26  930  79.44666  7.801935  4.569444
154 Controls 24  724 381.74026 39.842241 42.144842
155 Controls 24  724 191.39962 19.008729 31.064398

I'm able to made up a simple correlation plot but i would like to create an unique heatmap with both protein and subjects dendrogram on the base on spearman correlation. Does anyone know how to do? thanks in advance

Dr.PhilCol
  • 21
  • 5

1 Answers1

1

The following code displays an interactive heatmap using Spearman's rank correlation to cluster both rows and columns (in this case for the mtcars dataset).

heatmaply(mtcars, 
    distfun = function(x) as.dist(1 - cor(t(x), method="spearman")))
alan ocallaghan
  • 3,116
  • 17
  • 37
  • Thank a lot aocall but in this way I obtain a very strange result, infact on my heatmap i dont have values from -1 to 1 as normally but from 0 to 10000 .... why it happens? – Dr.PhilCol Oct 27 '17 at 08:39
  • @Dr.PhilCol we need an example with reproducible code to see what you issue is and how to fix it. Please take the example from aocall and adjust it to your scenario to see if you can reproduce the problem. – Tal Galili Oct 28 '17 at 08:27
  • It sounds like you simply want to plot a correlation heatmap. In that case, the command would be `heatmaply_cor(cor(mtcars, method="spearman"))`. As Tal suggested, a detailed example will help to make it clear what you want to accomplish. – alan ocallaghan Oct 30 '17 at 10:49