Skip to content

Commit

Permalink
Fix the --hclust option. As is, scipy was trying to calculate the euc…
Browse files Browse the repository at this point in the history
…lidean distance of an array of euclidean distances!
  • Loading branch information
dpryan79 committed Feb 19, 2016
1 parent dcc5a87 commit 86217a2
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions deeptools/heatmapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -1077,14 +1077,10 @@ def hmcluster(self, k, method='kmeans'):

if method == 'hierarchical':
# normally too slow for large data sets
from scipy.cluster.hierarchy import fclusterdata
from scipy.spatial.distance import pdist
print(("the type is ", type(matrix)))
print(("original ndim is ", np.asarray(matrix).ndim))
foo = pdist(np.asarray(matrix, order='c', dtype=np.double), metric='euclidean')
print(("the pdist ndim is ", foo.ndim))
del foo
cluster_labels = fclusterdata(matrix, k, criterion='maxclust', metric='euclidean', depth=2, method='ward')
from scipy.cluster.hierarchy import fcluster, linkage
Z = linkage(matrix, method='ward', metric='euclidean')
cluster_labels = fcluster(Z, k, criterion='maxclust')

# create groups using the clustering
self.group_labels = []
self.group_boundaries = [0]
Expand Down

0 comments on commit 86217a2

Please sign in to comment.