Hello,
I am doing a study looking at correlations between multiple cytokines. I found code to let me graph a heatmap of the correlation matrix, but I am having trouble making modifications to the heatmap.
1.) Specifically, I would like to be able to change the color, i.e. instead of white = -1 and dark blue = +1, I was hoping to use a different color for <1 values to make the correlation values more obvious.
2.) In addition, I was hoping to reorder the cytokines so that the strongest and weakest correlations are next to each other to make the data more interpretable.
3.) I also in a perfect world would be able to re-label the cytokine names so that show up prettier (e.g. with hyphens instead of underscores, etc).
Here is my code below. The last paragraph of code is what I was trying to use to modify the order of the cytokines (labeled/* load the module for single-link clustering */). I am also attaching images of what my heatmaps currently look like.
Any guidance would be greatly appreciated!
/*HEAT MAP CORRELATION MATRIX FOR ALL SAMPLES*/
TITLE "Correlation Matrix for All Samples";
proc iml;
/* create correlation matric for variables in alphabetical order */
varNames = {'IL_28A''IL_6''IL_8''IL_7''IFN_Beta''IL_10''CCL2''IL_1b''IFN_g''CCL3''CCL22''CCL4''IL_4'
/*'IL_17A' 'IL_2'*/ 'CXCL9' 'IL_5' 'TNFRI' 'IL12p70' 'CCL17' 'TNFa' 'IL_28B' 'CXCL10' /*'IL_23'*/};
/*Sample_cat = sample_cat;
Dz_severity_binary2 = Dz_severity_binary2;*/
use Gawlib.cytokine_80121 where (Dz_severity_binary2 >=0) ;
read all var varNames into Y where (sample_cat>=1) ;
read all var varNames into Y where (sample_cat>=1) ;
close;
corr = corr(Y, "Spearman");
call HeatmapCont(corr) xvalues=varNames yvalues=varNames
colorramp=colors range={-1.01 1.01}
title="Correlation Matrix: Cytokine levels for all samples";
/* load the module for single-link clustering */
load module=(SingleLinkCluster);
permutation = SingleLinkCluster( corr ); /* permutation of 1:p */
V = varNames[permutation]; /* new order for variables */
R = corr[permutation, permutation]; /* new order for matrix */
call HeatmapCont(R) xvalues=V yvalues=V
colorramp=colors range={-1.01 1.01}
title="Correlation: Variables in Clustered Order";