Portable vectors of the CLUSTERGRAM object (MATLAB)

I am using CLUSTERGRAM from the Bioinformatics Toolbox (version 3.7). MATLAB R2011a version.

I would like to get permutation vectors for rows 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 clustering is not like a clustergram and a dendrogram, most likely due to the optimal calculation of leaf ordering (I don't want to turn it off).

For example, for clustergram from:

 clustergram(x) 

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

vectors (as in the attached figure) should be:

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

clustergram example

So how to programmatically get these vectors? Is anyone familiar with this subject?

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

+4
source share
1 answer

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

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

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

should return a permutation of lines.

+4
source

All Articles