[Biopython-dev] [Bug 2731] Adding .upper() and .lower() methods to the Seq object

bugzilla-daemon at portal.open-bio.org bugzilla-daemon at portal.open-bio.org
Tue Jan 13 00:21:42 UTC 2009


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


biopython-bugzilla at maubp.freeserve.co.uk changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
Attachment #1191 is|0                           |1
           obsolete|                            |




------- Comment #3 from biopython-bugzilla at maubp.freeserve.co.uk  2009-01-12 19:21 EST -------
(From update of attachment 1191)
There are a couple of "if" statements which should be "elif", but otherwise the
patch seems to cover the basics.

However, it does not cover the pathological/evil situation where a LETTER has
been used for a stop codon or gap character.  e.g. Something this should happen
(assuming Bug 2597 is implemented in order to trigger the exception shown):

>>> from Bio.Seq import Seq
>>> from Bio.Alphabet import IUPAC, Gapped
>>> my_dna = Seq("AGGGTXGTTGA",Gapped(IUPAC.IUPACUnambiguousDNA(), "x"))
Traceback (most recent call last):
...
ValueError: Letter 'X' not in Gapped(IUPACUnambiguousDNA(), 'x')
>>> my_dna = Seq("AGGGTxGTTGA",Gapped(IUPAC.IUPACUnambiguousDNA(), "x"))
>>> my_dna.lower()
Seq('agggtxgttga', Gapped(DNAAlphabet(), 'x'))
>>> my_dna.lower().upper()
Seq('AGGGTXGTTGA', Gapped(DNAAlphabet(), 'X'))

I think the most elegant way to deal with the AlphabetEncoders (stop and gaps)
is by adding (private) upper/lower methods to the Alphabet objects as I
outlined in comment 2. Patch taking this approach to follow...


-- 
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