[Biopython] Bio.Phylo: midpoint root?
Brandon Invergo
b.invergo at gmail.com
Thu May 31 13:31:21 UTC 2012
On Thu, 2012-05-31 at 00:36 -0400, Eric Talevich wrote:
> On Wed, May 30, 2012 at 10:55 AM, Eric Talevich <eric.talevich at gmail.com>wrote:
> I implemented this in an intuitive but very inefficient way, calculating
> the pairwise distances between all tips of the tree. You can try it from
> git:
> https://github.com/biopython/biopython/commit/94c128bd428cc5d53b50edd1d2e4730ee212f530
>
> It would still be nice to see a better algorithm, if anyone has one on hand.
>
> -E
I sped it up a little bit by getting rid of those nested for loops:
https://github.com/brandoninvergo/biopython/commit/102189cd49d448423ee160a0a0ad891b58f56c26
According to a naive benchmark of comparing execution times for the unit
test, this version is about 40% faster (0.901s vs 0.524s on my
computer). I'll do a pull request...
As for the problem of accumulating floating point rounding errors,
perhaps you can do the root operations on copies of the tree instead...
-brandon
More information about the Biopython
mailing list