[BioPython] back-translation method for Seq object?

Bruce Southey bsouthey at gmail.com
Wed Oct 22 21:02:18 UTC 2008


Hi,
Some of the neat things about Python is how easy it is to modify your 
own code and adapt others code into yours.

So here is some code (under the BSD license)  that may be useful on 
this. This is a simple back or reverse translation code with many of the 
things that I have been 'talking' about. This should be self-contained 
and works on Linux system with Python2.3+. It is oriented around an 
peptide sequence 'AFLFQPQRFGR' but hopefully is more general (I have not 
tested that).

a) Convert an amino acid sequence into both a regular expression or DNA 
sequence involving ambiguous codes. There are functions to convert the 
regular expression or DNA sequence involving ambiguous codes back to a 
protein sequence since neither of these are standard.

b) Regular expression search on a list of sequences in fasta format.

c) Obtain all possible DNA sequences from an regular expression form of 
the amino acid sequence. Obviously this is very large as for the above 
sequence there are  442368 combinations (but Python is fairly quick... 
about 10 seconds on my opteron  270 system bogomips =3991.08)



Enjoy
Bruce
-------------- next part --------------
A non-text attachment was scrubbed...
Name: reverse_trans.py
Type: text/x-python
Size: 10661 bytes
Desc: not available
URL: <http://lists.open-bio.org/pipermail/biopython/attachments/20081022/248001f3/attachment-0002.py>


More information about the Biopython mailing list