[Biopython-dev] [Bug 1944] Align.Generic adding iterator and more

bugzilla-daemon at portal.open-bio.org bugzilla-daemon at portal.open-bio.org
Mon Jun 2 12:57:20 UTC 2008


http://bugzilla.open-bio.org/show_bug.cgi?id=1944





------- Comment #14 from biopython-bugzilla at maubp.freeserve.co.uk  2008-06-02 08:57 EST -------
I've added simple __str__ and __repr__ methods to the alignment class in
Bio/Align/Generic.py CVS revision 1.8, which give output like this:

str(a):
DNAAlphabet() alignment with 3 rows and 14 columns
ACGATCAGCTAGCT Alpha
CCGATCAGCTAGCT Beta
ACGATGAGCTAGCT Gamma

repr(a):
<__main__.Alignment instance (3 records of length 14, DNAAlphabet()) at
9e96c2c>

The string output gets truncated to show a maximum of 20 rows and 50 columns,
which allowing for typical identifiers will still display nicely on a default
terminal.

I now intend to update the tutorial, as being able to print an alignment should
make it much easier to explain and get to grips with.

Note that there is still some interesting code in both attachment 732 (the
__getitem__ method) and in attachment 770 (e.g. subclassing list and adding
__len__, __add__, __radd__ etc).


-- 
Configure bugmail: http://bugzilla.open-bio.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.



More information about the Biopython-dev mailing list