How to use the fastcluster.weighted function in fastcluster

To help you get started, we’ve selected a few fastcluster examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github thiesgehrmann / proteny / cluster.py View on Github external
def calc_dendrograms(HC, D, linkage_type='single'):
  linkage_types = { 'single'   : fc.single,
                    'complete' : fc.complete,
                    'average'  : fc.average,
                    'weighted' : fc.weighted,
                    'centroid' : fc.centroid,
                    'median'   : fc.median,
                    'ward'     : fc.ward };
  T = {};
  print "Calculating linkages. This will take a while!";
  nk = len(D.keys());
  for (i, dk) in enumerate(D.keys()):
    print "\r%d/%d" % (i+1, nk),
    sys.stdout.flush();
    L = linkage_types[linkage_type](D[dk]);
    T[dk] = construct_dendrogram(L, HC[dk]);
  #efor

  return T;