[Biopython-dev] Rerooting a tree with Bio.Phylo

Peter biopython at maubp.freeserve.co.uk
Mon Mar 29 11:35:01 EDT 2010


On Mon, Mar 29, 2010 at 2:50 PM, Brad Chapman <chapmanb at 50mail.com> wrote:
> Eric, Peter and Cymon;
>
>> I've got a real example of a simple tree manipulation that I would
>> like to handle via your new module. I have a (small) unrooted tree from a
>> gene family in Newick format, which by construction includes an
>> out-group (the same gene but from a more distant organism). I would like to
>> reroot the tree so that this out-group is at the basal level.
>
> Really enjoying the discussion on this. It's a bit outside my area
> of expertise but I stumbled across DendroPy this weekend:
>
> http://packages.python.org/DendroPy/index.html
>
> which has a reroot_at function that might be worth looking into:
>
> http://github.com/jeetsukumaran/DendroPy/blob/master/dendropy/dataobject/tree.py
>
> Hope this helps,
> Brad

Hey Brad,

I also spotted DendroPy recently (via a blog post or something),
but hadn't yet looked to see how they handled this.

It looks like their reroot_at function takes an *internal* node as the
argument to specify the new root. This neatly avoids the problem
about having to introduce a new node when rerooting with a given
terminal node (taxon) as the out group.

Peter


More information about the Biopython-dev mailing list