Hi
I'm struggling with something that is probably trivially taken care of by the math community, but I don't know where to start!
Given a symmetric matrix, namely a correlation matrix but any would do. I am looking for an algorithm to cluster the elements of the matrix just with permutations, while keeping the symmetry of the matrix.
What I mean by "clustering the elements of the matrix" is moving the higher number of the matrix close together and do the same with the lower numbers.
Regarding the use of "permutations respecting the matrix symmetry", I mean that if you exchange column i (resp. row i) with column j (row j), you have to permute row i (resp. column i) with row j (column j) so that the symmetry of the matrix is respected.
The reason behind this problem is a bit superficial actually. When you get a correlation matrix you obviously look for the the highest (in absolute value) coefficients and a good way to do it is to "heat map" the matrix. And what you get is a patchwork of various colours scattered on your map! What I would like is to "get the colours together" to make the map much more readable without losing the symmetry of the map - it needs to stay a correlation matrix after all.
Thanks

Hello,
I'm not sure it is possible to have all the high value in a corner, and then remaining low correlation.
For example in this picture: http://tinyurl.com/bmnkbaw on the right it is clear that there are clusters of highly correlated properties, but it is not possible to have all the red at the same place.
However you may be able to cluster the data and then display the matrix in cluster of colors.
For example, the protocol Calculate correlation matrix displays this
It is possible to cluster a bit the data from the correlation factor and have something like this:
with data correlated to each other a bit more together.
Would this fit your purpose?
Cheers,
Jérémy
Indeed, that's exactly what I am looking for !
How do you go from the first heat map to the other?
Thanks
Guilhem
Hi Guilhem
Attached is the protocol.
It is using R cluster Agnes (I took form the example protocol, so no particular reason to use this method compared to another). Then changed the R script to get the dendogram order of the properties, so I can get in which order the tree is built, and properties similar are next to each other. There are some scripts to use after because the R output is not what I wanted: doesn't output in order, just gives me that property 6 is number 2 in the tree. So some custom manipulator + sort are there to know which property is which.
Then reorder everything again to have a proper matrix. Heat map is then for display.
As some other of my R code, it is messy as I'm not sure how to get the data in the format I want, so lots of work is done in PP script. That makes it less flexible, so here the property containing the names after the correlation matrix need to be called Property (default). See notes for details.
Hope that works for you.
Cheers,
Jérémy
Brilliant! Thanks!
An alternative Jérémy's R-based solution, if you happen to have MATLAB, is provided by the prototype protocol named "MATLAB Concordance Correlation Example". The example computes the "concordance correlation" coefficient and then outputs a correlation-ordered heat map of the results, which effectively clusters variables with similar correlations. The MATLAB script for doing the correlation-ordering appears in the Script parameter of the MATLAB (on Server) component.
Thanks Dana,
We're considering to get Matlab but it's still not available yet. I'll check your solution when it's there.
I also did something similar to this recently for non-symmetric matrices - in that example it was the results of using the PharmaDB to profile a ligand library. Using the fitvalue as distance metric.
If anyone is interested drop me a line and I'll send the protocol over.
Noj
Hi Noj, I guess that'd be useful and appreciated, indeed!
Thanks,
Pierre
Hi Pierre,
Here it is, somewhat hardwired for this dataset at the moment. But hopefully you can see the idea.
In essence there are a couple of hierarchical clusterings going on (though using the standard PP clusterer instaead of one from R, as I intended this to be used by Discovery Studio users, who may not have R available). First of the compounds, wrt their fit to a set of pharmacophore models.Then after pivoting of the models wrt their fit to the compounds.
If you are using the PharmaDB from Discover Studio 3.5 let me know I have a version of this that compares the above clustering to family relationships amongst the pharmacophore models.
Noj