[Biopython-dev] [Bug 2530] Bio.Seq.translate() treats invalid codons as stops

bugzilla-daemon at portal.open-bio.org bugzilla-daemon at portal.open-bio.org
Sat Jun 28 20:19:09 UTC 2008


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





------- Comment #1 from biopython-bugzilla at maubp.freeserve.co.uk  2008-06-28 16:19 EST -------
Created an attachment (id=953)
 --> (http://bugzilla.open-bio.org/attachment.cgi?id=953&action=view)
Patch to Bio/Seq.py Bio/Data/CodonTable.py and the test_seq.py unit test

The basic idea of this patch is to include the stop codons in the CodonTable's
forward table dictionary.  Currently, when doing the translation a stop codon
is inserted when the key is undefined (but this also happens for invalid
codons).

Instead, by including the stop codons in the forward table, we can do a single
mapping.  Any KeyError becomes a translation error.

However, this is a fiarly significant change to the existing CodonTable
objects.  The are a strange odd bunch of objects - with the ambiguous codon
tables being very odd.  I have replaced all of these with a single codon table
which includes all the DNA and RNA codons, including the ambiguous ones.  All
the existing variants of DNA/RNA/Generic and (un)ambiguous CodonTables are more
replaced with the single object.  We still have one per NCBI codon table.

I think that the CodonTable could be made simpler still, but I wanted to at
least try and remain API backwards compatible (bar the dictionary change).

Then, I tweaked the Bio.Seq translate method to take advantage of this.

NOTE - We don't have a unit test for Bio.Data.CodonTable or Bio.Translate, so
it would be wise to write one BEFORE commiting this patch.  If there are any
other bits of code using Bio.Data.CodonTable they could also be affected.


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