[Biopython] Translation of partial codons

Peter Cock p.j.a.cock at googlemail.com
Thu Mar 28 15:09:31 UTC 2013


On Thu, Mar 28, 2013 at 2:55 PM, Ivan Gregoretti <ivangreg at gmail.com> wrote:
> Hello Peter,
>
> Given that CCC is one of the fourth codons for Proline:
>
> In [132]: Seq('CCC').translate(table=1)
> Out[132]: Seq('P', ExtendedIUPACProtein())
>
> Would you please tell us which of the next two cases will rise an
> exception in the future?
>
> In [133]: Seq('CC').translate(table=1)
> Out[133]: Seq('', ExtendedIUPACProtein())

Right now (with git code), a warning due to the partial codon,
in later releases this would probably become an exception.
You should get something like this:

    >>> from Bio.Seq import Seq
    >>> Seq('CC').translate(table=1)
    /Library/Python/2.7/site-packages/Bio/Seq.py:1964:
BiopythonWarning: Partial codon,
    len(sequence) not a multiple of three. Explicitly trim the
sequence or add trailing N
    before translation. This may become an error in future.
    Seq('', ExtendedIUPACProtein())

Clearer?

> In [134]: Seq('CCN').translate(table=1)
> Out[134]: Seq('P', ExtendedIUPACProtein())

No change, still gives 'P'.

>
> Thank you,
>
> Ivan
>

Peter



More information about the Biopython mailing list