This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Open Reading Frame And Codons

How I can find the ORF in a sequence using Python? also I need find all codons.

Thanks.

orf sequence python codon

3 answers

List of all codons:

genome = 'ACGTACGT....'
print map(lambda x: ''.join(x), zip(genome[0:], genome[1:], genome[2:]))

Set of all codons:

genome = 'ACGTACGT....'
print set(map(lambda x: ''.join(x), zip(genome[0:], genome[1:], genome[2:])))

If your genome is large, use itertools.izip instead of zip:

import itertools
itertools.izip(genome[0:], genome[1:], genome[2:])

To find ORF it's better to use Biopython (see zev.kronenberg's link).

If you genomes are large, use itertools.izip instead of zip: import itertools; itertools.izip(genome[0:], genome[1:], genome[2:])

Googled:

http://biopython.org/DIST/docs/tutorial/Tutorial.html#htoc224

Thanks,

I worked with the fasta file NC_005816.fna following the steps indicated in (http://biopython.org/DIST/docs/tutorial/Tutorial.html#htoc224), but if I compare this ORF's with the obtained using toolbox WEB of NCBI http://www.ncbi.nlm.nih.gov/projects/gorf/orfig.cgi the results are differents, why?

I need to use python because the file of my sequence is 4GB. I can't use NBCI toolbox.

Thanks.

would be more appropriate as a comment. possible reason for difference: different genetic codes.

I think this website can help, can translate the DNA to protein, DNA to mRNA, mRNA to protein, and could show the reading frame : https://codontable.org/sequence-translator

Log in to answer this question.