Translating a given sequence into a protein sequence

Source: Internet
Author: User

Dictionary can be used to translate a given cDNA sequence into a protein sequence

1 #!/bin/python2 #Dictionary Protein Translation3 4My_dna = open ("/home/maque/my_dna.txt"). Read (). replace ('\ n',"')#use Str.replace () method to remove ' \ n ' so that My_dna is a single string5 6Condon_table = {"TTT":"F","TTC":"F","TTA":"L","TTG":"L",7                 "TCT":"S","TCC":"S","TCA":"S","TCG":"S",8                 "TAT":"Y","TAC":"Y","TAA":"*","TAG":"*",9                 "TGT":"C","TGC":"C","TGA":"*","TGG":"W",Ten                 "CTT":"L","CTC":"L","CTA":"L","CTG":"L", One                 "CCT":"P","CCC":"P","CCA":"P","CCG":"P", A                 "CAT":"H","CAC":"H","CAA":"Q","CAG":"Q", -                 "CGT":"R","CGC":"R","CGA":"R","CGG":"R", -                 "ATT":"I","ATC":"I","ATA":"I","ATG":"M", the                 "ACT":"T","ACC":"T","ACA":"T","ACG":"T", -                 "AAT":"N","AAC":"N","AAA":"K","AAG":"K", -                 "AGT":"S","AGC":"S","AGA":"R","AGG":"R", -                 "GTT":"V","GTC":"V","GTA":"V","GTG":"V", +                 "GCT":"A","GCC":"A","GCA":"A","GCG":"A", -                 "GAT":"D","GAC":"D","GAA":"E","GAG":"E", +                 "GGT":"G","GGC":"G","GGA":"G","GGG":"G"}#Create a dictionary contains the codon table A  atCodon_range = Range (0, Len (My_dna), 3)#Vary clever step -Protein ="" -  -  forSiteinchCodon_range: -codon = my_dna[site:site+3] -Amino_acid = Condon_table[codon]#codon is a ' key ' ina dictionary inProtein = protein +Amino_acid -  to Print(protein)

Translating a given sequence into a protein sequence

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.