[Biopython-dev] [Bug 1999] new frame translation method

bugzilla-daemon at portal.open-bio.org bugzilla-daemon at portal.open-bio.org
Thu Feb 4 15:20:51 UTC 2010


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





------- Comment #4 from biopython-bugzilla at maubp.freeserve.co.uk  2010-02-04 10:20 EST -------
(In reply to comment #3)
> Can we split this into two functions? I tried this function today, hoping it
> would help me get a list of ORFs from a big contig -- but both
> frameTranslations and six_frame_translation do two things without stopping in
> between:
> 
> 1. Translate the DNA or RNA sequence to amino acids in all six frames

I'd wondered about this - possibly as a generator/iterator which always gives
back exactly six sequences - but don't really see much point. There is also
going to be some debate about how frames are labelled (especially the minus
frames).

> 2. Pretty-print the six-frame translation

Personally I don't see this as being very useful, but someone must like it.
I lean to just deprecating and removing this code.

> So, how about factoring out just this piece (or similar):
> 
> def translate_six_frames(seq, genetic_code=1):
>     """Dictionary of 6-frame translations."""
>     anti = seq.reverse_complement()
>     frames = {}
>     for i in range(0,3):
>         frames[i+1]  = seq[i:].translate(genetic_code)
>         frames[-i-1] = SeqUtils.reverse(anti[i:].translate(genetic_code))
>     return frames

You should be taking the reverse complement, not just the reverse. This
would just be seq[i:].reverse_complement() or seq.reverse_complenent()[i:]
depending on how you label the reverse frames. 

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