Exemplo n.º 1
0
    def random_coal(self, nspecies=None, names=None):
        if names and nspecies:
            if not nspecies == len(names):
                nspecies = len(names)
        elif names and not nspecies:
            nspecies = len(names)
        elif not names:
            if not nspecies:
                nspecies = 16
            names = taxonnames.names[:nspecies]
            if nspecies > len(taxonnames.names):
                names.extend(['Sp{0}'.format(i) for i in
                             range(len(taxonnames.names) + 1, nspecies
                             + 1)])
                
        taxon_set = dpy.TaxonSet(names)
        tree = treesim.pure_kingman(taxon_set)

        newick = '[&R] ' + tree.as_newick_string()
        if not newick.endswith(';'):
            newick += ';'

        return Tree(newick)
Exemplo n.º 2
0
#! /usr/bin/env python

import dendropy
from dendropy import treesim

taxa = dendropy.TaxonSet(["z1", "z2", "z3", "z4", "z5", "z6", "z7", "z8"])
tree = treesim.pure_kingman(taxon_set=taxa,
        pop_size=10000)
print(tree.as_string("newick"))
print(tree.as_ascii_plot())
 def runTest(self):
     """PureCoalescentTreeTest -- tree generation without checking [TODO: checks]"""
     _RNG = RepeatedRandom()
     t = treesim.pure_kingman(dendropy.new_taxon_set(100), rng=_RNG)
     assert t._debug_tree_is_valid()
Exemplo n.º 4
0
def generate_trees_Kingman(Pop_size=49,rang=314):
    from dendropy import TaxonSet, TreeList, treesim
    taxa = TaxonSet()
    trees = TreeList()
    trees=[treesim.pure_kingman(taxon_set=taxa, pop_size=Pop_size) for x in range(rang)]
    return trees
Exemplo n.º 5
0
 def runTest(self):
     """PureCoalescentTreeTest -- tree generation without checking [TODO: checks]"""
     _RNG = RepeatedRandom()
     t = treesim.pure_kingman(dendropy.new_taxon_set(100), rng=_RNG)
     assert t._debug_tree_is_valid()