def get_clusters(x_original, axis='row'):
 x = x_original.copy()
 if (axis == 'column'):
  x = x.T
 nr = x.shape[0]
 row_dissims = pw_distances(x, ids=map(str, range(nr)), metric='euclidean')
 linkage_matrix = linkage(row_dissims.condensed_form(), method='average')
 tree = TreeNode.from_linkage_matrix(linkage_matrix, row_dissims.ids)
 return [int(tip.name) for tip in tree.tips()]

def get_clusters ( x_original , axis = 'row' ) : x = x_original . copy ( ) if ( axis == 'column' ) : x = x . T nr = x . shape [ 0 ] row_dissims = pw_distances ( x , ids = map ( str , range ( nr ) ) , metric = 'euclidean' ) linkage_matrix = linkage ( row_dissims . condensed_form ( ) , method = 'average' ) tree = TreeNode . from_linkage_matrix ( linkage_matrix , row_dissims . ids ) return [ int ( tip . name ) for tip in tree . tips ( ) ]
performs upgma clustering using euclidean distances .