[Biopython-dev] [Biopython - Feature #3342] (New) Phylo.root_with_outgroup: set the length of the outgroup branch

redmine at redmine.open-bio.org redmine at redmine.open-bio.org
Thu Apr 19 04:27:49 UTC 2012

Issue #3342 has been reported by Eric Talevich.

Feature #3342: Phylo.root_with_outgroup: set the length of the outgroup branch

Author: Eric Talevich
Status: New
Priority: Normal
Target version: 

Add an option to the root_with_outgroup method to specify the length of the branch leading from the new root to the outgroup. This should not change the total tree length, i.e. this length is subtracted from the branch on the other side of the root.

This option makes it possible to root the tree in other ways that split the outgroup branch, leaving a bifurcating rather than trifurcating root.

I've attached a patch that implements this feature, plus unit tests for it.


A sane API for this method would look like:

>>> tree.root_with_outgroup("apple", "orange", outgroup_branch_length=0.4)

The original function definition included *args for specifying the outgroup taxa in one shot (instead of requiring a separate call to common_ancestor). But while Python 3 permits keyword-only arguments (a defined keyword argument after *args or just *), Python 2 does not. So I made the function calling style shown above work in a very weird way: the function definition has **kwargs instead of outgroup_branch_length=None, and the necessary keyword argument is pulled out of kwargs inside the body of the function. The name of this argument is given in the docstring, so it's still partly discoverable.

Are we cool with this? Or, can anyone think of a better way to handle this?

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