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

Peter biopython at maubp.freeserve.co.uk
Thu Mar 11 11:30:04 UTC 2010


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?

For people using IPython, the __pretty__ method looks related. I know
the Bio.Nexus tree has a "prity 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

Peter



More information about the Biopython-dev mailing list