[Biopython-dev] Adding format method to phylo tree object?

Peter biopython at maubp.freeserve.co.uk
Thu Mar 11 23:23:54 UTC 2010


On Thu, Mar 11, 2010 at 10:54 PM, Eric Talevich wrote:
> On Thu, Mar 11, 2010 at 6:30 AM, Peter wrote:
>
>> Hi Eric (et al),
>>
>> Are you familiar with the format method of the SeqRecord and alignment
>> object (plus the __format__ method which does the same thing aiming to
>> work nicely with the Python 2.6 built in function format)? This allows
>> the user to turn their data into a string in a specified output
>> format. Internally the method calls Bio.SeqIO.write (or AlignIO) with
>> a StringIO handle.
>>
>> Do you think it would it make sense to have this for the tree objects
>> in Bio.Phylo, allowing easy access to the object as a Newick tree
>> format etc?
>>
>
> Sure, I could do that. It makes a lot of sense for Newick trees, and could
> be useful with the XML formats for debugging.
>

Great.

>> For people using IPython, the __pretty__ method looks related. I know
>> the Bio.Nexus tree has a "pretty print" method which might be exposed
>> like this. I wonder if this convention will become more widespread?
>>
>> http://ipython.scipy.org/doc/stable/html/api/generated/IPython.external.pretty.html
>>
>
> I didn't know about that.

I only read about it recently myself - it may not be worth doing.
(I'm not trying to invent work here *grin*, just looking for things
we can polish before your code gets its first proper release.)

Thanks,

Peter



More information about the Biopython-dev mailing list