[SciPy-User] Doubled distances on UPGMA trees?

Lawrence David ldavid at fas.harvard.edu
Fri Apr 29 12:31:52 EDT 2011


Hi everyone,

	I'm trying to build UPGMA trees using scipy.cluster, but I'm running into a problem where my branch lengths appear to be doubled in length.  

	As a test case, I'd like to build the tree from the following tutorial: http://www.nmsr.org/upgma.htm.

>>> import scipy.cluster.hierarchy as sch
>>> import scipy.spatial.distance as ssd
>>> d_M = array([[0,19,27,8,33,18,13],[19,0,31,18,36,1,13],[27,31,0,26,41,32,29],[8,18,26,0,31,17,14],[33,36,41,31,0,35,28],[18,1,32,17,35,0,12],[13,13,29,14,28,12,0]])
>>> Y = ssd.squareform(d_M)
>>> Z = sch.linkage(Y,method='average')
>>> sch.dendrogram(Z)

	The outputted tree has branch lengths that are roughly double the ones expected according to the UPGMA guide.  

	Can anyone please explain to me how I might want to go about recovering the desired tree?  Is dendrogram the wrong plotting function to use?

Many thanks!
- Lawrence




More information about the SciPy-User mailing list