[Biopython-dev] [Biopython - Bug #3374] (New) Newick.Tree.randomized not working

redmine at redmine.open-bio.org redmine at redmine.open-bio.org
Wed Jul 18 14:52:24 UTC 2012

Issue #3374 has been reported by Aleksey Kladov.

Bug #3374: Newick.Tree.randomized not working

Author: Aleksey Kladov
Status: New
Priority: Normal
Target version: 

My code is

from Bio.Phylo import BaseTree, Newick

t = Newick.Tree.randomized(5)

It throws Exeption:

Traceback (most recent call last):
  File "/home/kladov/ab_lab/Rosalind/rosalind-problems/rosalind_problems/phyltree/__init__.py", line 55, in <module>
    t = Newick.Tree.randomized(5)
  File "/usr/local/lib/python2.7/dist-packages/Bio/Phylo/BaseTree.py", line 725, in randomized
TypeError: 'NoneType' object is not iterable

It looks like the problem is here(file BaseTree.py):

newsplit = random.choice(terminals)
newterms = newsplit.split(branch_length=branch_length) #problem: split returns None...
if branch_stdev:
    # Add some noise to the branch lengths
    for nt in newterms:
    nt.branch_length = max(0,
        random.gauss(branch_length, branch_stdev))
terminals.extend(newterms) # and now we try to extend with None =(

I suppose that split not only should do actual split of a clade, but also return a list of two new clades.

You have received this notification because this email was added to the New Issue Alert plugin

You have received this notification because you have either subscribed to it, or are involved in it.
To change your notification preferences, please click here and login: http://redmine.open-bio.org

More information about the Biopython-dev mailing list