[Biopython-dev] [biopython] Bugfix in test_Phylo; branch length formatter for Newick trees (#7)

Eric Talevich eric.talevich at gmail.com
Wed May 25 14:33:36 UTC 2011


Thanks for these patches, Aaron! And thanks for merging the first one, Peter.

The second set looks safe to me. A couple thoughts:

1. It might be more intuitive to accept a format string directly as
the format_branchlength argument, e.g.

Phylo.write(tree, outfile, 'newick', format_branchlength='%.0e')

Since the branch length is always supposed to be a numeric type or
None, format strings alone should be sufficient to do whatever the
user wants, right? Alternatively, the switch in _info_factory could
go:

if format_branchlength is None: fmt_bl = lambda bl: '%1.5f' % bl
elif isinstance(format_branchlength, basestring): fmt_bl = lambda bl:
format_branchlength % bl
elif callable(format_branchlength): fmt_bl = format_branchlength
else: raise WTF


2. Out of curiousity, is there a certain program out there that uses
branch length in a different format? I hadn't considered this before,
but I can see how scientific notation would be useful sometimes if the
target program can handle it.


I can merge this if we have agreement on these.

Cheers,
Eric


On Tue, May 24, 2011 at 4:20 PM, Peter Cock <p.j.a.cock at googlemail.com> wrote:
>
> Eric,
>
> Could you take a look at the second of these commits from Aaron please?
> https://github.com/habnabit/biopython/commit/533c5b0a8fd4656ef937e5e0816d2714f82ecf07
>
> I've already applied the first one with a cherry-pick,
> https://github.com/biopython/biopython/tree/7bec999af556be28d1a50dac9687d62f6c200b38
>
> Thanks,
>
> Peter
>
>
> ---------- Forwarded message ----------
> From: habnabit <reply+... at reply.github.com>
> Date: Tue, May 24, 2011 at 9:10 PM
> Subject: [biopython] Bugfix in test_Phylo; branch length formatter for
> Newick trees (#7)
> To: p.j.a.cock at googlemail.com
>
>
> Hi!
>
> This is a very small set of changes for biopython; it should be
> evident from the diff and commit message what the intent is.
>
> --
> Reply to this email directly or view it on GitHub:
> https://github.com/biopython/biopython/pull/7




More information about the Biopython-dev mailing list