[Biopython] Phylo: rerooting a tree with a terminal node

Eric Talevich eric.talevich at gmail.com
Thu Jan 13 01:55:23 UTC 2011


Hi Rob,

This was an outright bug in Bio.Phylo, so thanks again for reporting it.
I've pushed a fix to GitHub:
https://github.com/biopython/biopython/commit/1a8a39b6d24a9a4b9088255327b0f2fd12c19a09

For your own work, you can get this fix by either:
(a) checking out a development copy of Biopython from GitHub (the master
branch is fairly safe) and reinstalling, or
(b) applying just this fix to your copy of Bio.Phylo in-place -- i.e.
editing your existing Biopython installation. You can replace the file
Bio/Phylo/BaseTree.py with the one from GitHub without any ill effects.

Cheers,
Eric

On Wed, Jan 12, 2011 at 1:46 PM, Robert Beiko <beiko at cs.dal.ca> wrote:

>  Hi Eric,
>
> Thank you very much for your quick reply.
>
> Indeed the full script is doing something much more interesting (rolling up
> in-paralogs with attempts at alternative rootings), but this is my attempt
> to cut out all of the other things I might have done wrong :^>
>
> The loop is crashing the first time I try it. Indeed, the following
> variation fails as well:
>
>
> import io
> import sys
> from Bio import Phylo
>
> infile = 'Example1.tre'
> trees = Phylo.parse(infile,'newick')
>
> for tree in trees:
>     leafList = tree.get_terminals()
>     tree.root_with_outgroup(leafList[0])
>
> ----
>
> again, the same code with internals rather than terminals works fine.
>
> Best wishes,
> Rob
>
>



More information about the Biopython mailing list