[Biopython-dev] [Bug 2381] translate and transcibe methods for the Seq object (in Bio.Seq)

bugzilla-daemon at portal.open-bio.org bugzilla-daemon at portal.open-bio.org
Thu Nov 6 18:20:20 UTC 2008


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





------- Comment #49 from biopython-bugzilla at maubp.freeserve.co.uk  2008-11-06 13:20 EST -------
OK - thank you all for your input thus far.  Unfortunately it is clear that we
haven't reached a consensus about translating sequences which begin with the
start codon (or the more special case of translating a CDS sequence).

However, I hope we are all happy with how things look in CVS right now, which
offers a blind translation continuing over any stop codon, and the "to_stop"
option which will terminate translation at the first in frame stop codon:

See
http://cvs.biopython.org/cgi-bin/viewcvs/viewcvs.cgi/biopython/Bio/Seq.py?cvsroot=biopython
for the full code, but in summary:

class Seq(object):
    ...
    def translate(self, table="Standard", stop_symbol="*", to_stop=False):
        """Turns a nucleotide sequence into a protein sequence. New Seq object.

        Trying to back-transcribe a protein sequence raises an exception.
        This method will translate DNA or RNA sequences.

        Trying to translate a protein sequence raises an exception.

        table - Which codon table to use?  This can be either a name
                (string) or an NCBI identifier (integer).  This defaults
                to the "Standard" table.
        stop_symbol - Single character string, what to use for terminators.
                This defaults to the asterisk, "*".
        to_stop - Boolean, defaults to False meaning do a full translation
                continuing on past any stop codons (translated as the
                specified stop_symbol).  If True, translation is terminated
                at the first in frame stop codon (and the stop_symbol is
                not appended to the returned protein sequence).
        ...

With the module level function taking the same arguments:

def translate(sequence, table="Standard", stop_symbol="*", to_stop=False):
    """Translate a nucleotide sequence into amino acids.

    If given a string, returns a new string object.
    Given a Seq or MutableSeq, returns a Seq object with a protein
    alphabet.
    ...

I think everyone is content with the naming of the "to_stop" argument.

I'm planning to prepare the Biopython 1.49 beta release tomorrow, so I'm
proposing we leave translation like this for Biopython 1.49 (and close this
bug), and revisit translation after that is done (hopefully in less than two
weeks time).  The code in CVS is still a big improvement in terms of writing
object orientated code.

Peter


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