Permutation vectors from the CLUSTERGRAM object (MATLAB)

I'm using the CLUSTERGRAM object from the Bioinformatics Toolbox (ver 3.7). MATLAB version R2011a.

I'd like to get permutation vectors for row and columns for clustergram, as I can do with dendrogram function:

x = magic(10);
>> [~,~,permrows] = dendrogram(linkage(x,'average','euc'))
permrows =
     9    10     6     7     8     1     2     4     5     3
>> [~,~,permcols] = dendrogram(linkage(x','average','euc'))
permcols =
     6     7     8     9     2     1     3     4     5    10

I found that the clustering is not the same from clustergram and dendrogram, most probably due to optimal leaf ordering calculation (I don't want to disable it).

For example, for clustergram from:

clustergram(x)

('average' and 'eucledian' are default methods for clustergram)

the vectors (as on the figure attached) should be:

permrows = [1 2 4 5 3 10 9 6 7 8];
permcols = [1 2 8 9 6 7 10 5 4 3];

So, how to get those vectors programmatically? Anybody well familiar with this object?

Do anyone can suggest a good alternative? I know I can create a similar figure combining imagesc and dendrogram functions, but leaf ordering is much better (optimal) in clustergram, than in dendrogram.

Answers


From looking at the documentation, I guess that get(gco,'ColumnLabels') and get(gco,'RowLabels'), where gco is the clustergram object, should give you the reordered labels. Note that the corresponding set-methods take in the labels in original order and internally reorders them.

Consequently, if you have used custom labels (set(gco,'RowLabels',originalLabels))

[~,permrows] = ismember(get(gco,'RowLabels'),originalLabels)

should return the row permutation.


Need Your Help

Set UIBarStyle of UIImagePickerController

iphone ios uiimagepickercontroller

I would like to set the bar style of a UIImagePickerController as following, but the bar is still UIBarStyleBlackTranslucent. Is it possible to set the bar style of UIImagePickerController? Thanks in

Parallel construction of a distance matrix

python performance parallel-processing distance hierarchical-clustering

I work on hierarchical agglomerative clustering on large amounts of multidimensional vectors, and I noticed that the biggest bottleneck is the construction of the distance matrix. A naive implement...