acardona/CATMAID — pull request #551 by tomka (2013-09-26 14:42:11+00:00)
Title: Clustering for classification graphs

These commits add a clustering widget to the ontology based tools. It allows to calculate distances between different classification graphs and to build clusterings (represented by a dendrogram) from that. SciPy is used to do the actual math.

The branch has just been rebased on master by me and should merge cleanly. I tested the branch quite a bit and I'd like to merge it within the next days. So if you see any problems with this or want a certain feature added, please tell me. Two new migrations are part of this branch and therefore `manage.py migrate catmaid` needs to be executed besides `manage.py collectstatic -l`.

Multiple classification graphs can be compared if they instantiate the same ontology. The tool first asks the user on which ontology the classification graphs are based on (s)he wants to analyze. Next, all available graphs are shown that instantiate the selected ontology and the user has to select the ones that should be clustered. The third step is to select features that should be taken into account for comparison. Selectable are all paths and subpaths available in the ontology. However, the user can constrain the displayed options to only show features that are actually in use in one of the selected graphs. The last step is to select the metric (currently: Jaccard, Hamming, Chebychev) and the linkage (currently: single, complete, average, weighted, centroid, median, ward). The options of the last step can be easily extended to all what SciPy offers. The result is a binary matrix, a distance matrix and a dendrogram (see image below).

![classification-clustering](https://f.cloud.github.com/assets/112226/1218186/b68736ce-26b6-11e3-89e6-4f8440b22882.png)