LingPy

This documentation is for version 2.0.dev, which is not released yet.

lingpy.algorithm.cython._cluster.upgma

lingpy.algorithm.cython._cluster.upgma(matrix, taxa, distances=True)

Carry out a cluster analysis based on the UPGMA algorithm (Sokal1958).

Parameters :

matrix : or numpy.array

A two-dimensional containing the distances.

taxa : list

An containing the names of all taxa corresponding to the distances in the matrix.

distances : bool

If set to False, only the topology of the tree will be returned.

Returns :

newick : str

A string in newick-format which can be further used in biological software packages to view and plot the tree.

See also

lingpy.algorithm.cluster.neighbor, lingpy.algorithm.cluster.flat_upgma

Examples

Function is automatically imported when importing lingpy.

>>> from lingpy import *

Create an arbitrary of taxa.

>>> taxa = ['German','Swedish','Icelandic','English','Dutch']

Create an arbitrary matrix.

>>> matrix = squareform([0.5,0.67,0.8,0.2,0.4,0.7,0.6,0.8,0.8,0.3])

Carry out the cluster analysis.

>>> upgma(matrix,taxa,distances=False)
'((Swedish,Icelandic),(English,(German,Dutch)));'

This Page