def get_pairwise_distances(con_tree):

    taxons = con_tree.taxon_set
    pdm = PatristicDistanceMatrix(con_tree)
    pdm.calc()
    dmat = {}
    for p1, p2 in combinations(taxons, 2):
        d = pdm(p1, p2)
        dmat[(p1.label, p2.label)] = d
        dmat[(p2.label, p1.label)] = d

    return dmat
예제 #2
0
def get_pairwise_distances(tree):
    """Returns a dict of pairwise distances."""

    taxons = tree.taxon_set
    pdm = PatristicDistanceMatrix(tree)
    pdm.calc()
    dmat = {}
    for p1, p2 in combinations(taxons, 2):
        d = pdm(p1, p2)
        dmat[(p1.label, p2.label)] = d
        dmat[(p2.label, p1.label)] = d

    return dmat