Thread View: comp.lang.python
2 messages
2 total messages
Started by Alex
Sat, 02 Sep 2000 02:46
Python module for DNA to amino acid and reverse complement translation.
Author: Alex
Date: Sat, 02 Sep 2000 02:46
Date: Sat, 02 Sep 2000 02:46
45 lines
3028 bytes
3028 bytes
Hi. Here is a python wrapper around some simple C functions that
translate DNA sequences into amino acid residues and give their reverse
complements. I guess it's something like 10 times faster than the pure
python versions, but I haven't done any benchmarking.
No doubt there is already a module out there that does these things.
Apologies to whoever's work I'm duplicating.
Use this any way you see fit. Let me know if you have any problems with
it, but of course there's no warranty.
You can get it at
http://puffin.lcs.mit.edu:8080/sequences.tgz
You need Distutils to install it, at the moment. You can get that at
http://www.python.org/sigs/distutils-sig/download.html
...or just be an instance of whichever gender identity you atavistically
associate with intelligence and courage, and upgrade to the latest
version of python2.0.
Once you have a python with Distutils in it and have downloaded
sequences.tgz, untar it and cd into the sequencees directory. Then run
the command python setup.py install, and you should be all set. Then
you can do things like
Python 2.0b1 (#98, Aug 30 2000, 19:11:17) <snip>
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
Copyright 1995-2000 Corporation for National Research Initiatives (CNRI)
>>> import sequences
>>> sequences.translate('ATATGTACTCCCATGGGGACAAATATCCTTCTGAGGGGCCACAGTCATCAC')
'ICTPMGTNILLRGHSHH'
>>> sequences.reverse_complement('ATATGTACTCCCATGGGGACAAATATCCTTCTGA')
'TCAGAAGGATATTTGTCCCCATGGGAGTACATAT'
>>>
Alex.
--
The chain of destiny can only be grasped one link at a time.
-- Sir Winston Churchill
Re: Python module for DNA to amino acid and reverse complement translation.
Author: David Mathog
Date: Wed, 06 Sep 2000 03:39
Date: Wed, 06 Sep 2000 03:39
48 lines
3246 bytes
3246 bytes
In article <etdd7ioult0.fsf@w20-575-31.mit.edu>, Alex <cut_me_out@hotmail.com> writes:
>
>
>
>
>Hi. Here is a python wrapper around some simple C functions that
>translate DNA sequences into amino acid residues and give their reverse
>complements. I guess it's something like 10 times faster than the pure
>python versions, but I haven't done any benchmarking.
>
>
>No doubt there is already a module out there that does these things.
>Apologies to whoever's work I'm duplicating.
>
Just for kicks you might want to compare this one with yours (for
speed):
http://seqaxp.bio.caltech.edu/pub/SOFTWARE/FASTTRANS.C
I use this to translate genpept or nr on the fly into either full
translated frames or the set of ORF's greater than (for instance) 75 AA.)
It will handle a single DBA sequence entry up to 1 MB (use another program
in the pipe to fragment larger sequences if you expect to encounter them.)
$ fasttrans
usage (UNIX): fasttrans 123456 [minAA] <in.nfa >out.pfa
usage (OpenVMS): pipe fasttrans 123456 [minAA] <in.nfa >out.pfa
input is a fasta dna sequence via stdin
output is the translated protein sequence via stdout
Specify the set of frames to translate on command line
1,2,3 are the 3 forward frames
4,5,6 are the 3 reverse frames
minAA is an optional value. If present and greater than zero
it emits each ORF that has at least that many AA residues
in it as a separate fasta fragment. If not present or set to zero
or less the entire translated frame is emitted
This is ANSII C code and compiles cleanly on VMS and Linux (and probably
everywhere else.)
Regards,
David Mathog
mathog@seqaxp.bio.caltech.edu
Manager, sequence analysis facility, biology division, Caltech
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads