Changes
From Biolecture.org
Created page with "<p>#!/usr/bin/perl<br /> # Translate DNA into protein</p> <p>my $dna = 'ATGGCAGTGCCCTTTGTGGAAGACTGGGACTTGGTGCAAACCCTGGGAGAAGGTGCCTATGGAGAAGTTCAACTTGCTGTGAATAGAGTAACTGAAGAAGC..."
<p>#!/usr/bin/perl<br />
# Translate DNA into protein</p>
<p>my $dna = 'ATGGCAGTGCCCTTTGTGGAAGACTGGGACTTGGTGCAAACCCTGGGAGAAGGTGCCTATGGAGAAGTTCAACTTGCTGTGAATAGAGTAACTGAAGAAGCAGTCGCAGTGAAGATTGTAGATATGAAGCGTGCCGTAGACTGTCCAGAAAATATTAAGAAAGAGATCTGTATCAATAAAATGCTAAATCATGAAAATGTAGTAAAATTCTATGGTCACAGGAGAGAAGGCAATATCCAATATTTATTTCTGGAGTACTGTAGTGGAGGAGAGCTTTTTGACAGAATAGAGCCAGACATAGGCATGCCTGAACCAGATGCTCAGAGATTCTTCCATCAACTCATGGCAGGGGTGGTTTATCTGCATGGTATTGGAATAACTCACAGGGATATTAAACCAGAAAATCTTCTGTTGGATGAAAGGGATAACCTCAAAATCTCAGACTTTGGCTTGGCAACAGTATTTCGGTATAATAATCGTGAGCGTTTGTTGAACAAGATGTGTGGTACTTTACCATATGTTGCTCCAGAACTTCTGAAGAGAAGAGAATTTCATGCAGAACCAGTTGATGTTTGGTCCTGTGGAATAGTACTTACTGCAATGCTCGCTGGAGAATTGCCATGGGACCAACCCAGTGACAGCTGTCAGGAGTATTCTGACTGGAAAGAAAAAAAAACATACCTCAACCCTTGGAAAAAAATCGATTCTGCTCCTCTAGCTCTGCTGCATAAAATCTTAGTTGAGAATCCATCAGCAAGAATTACCATTCCAGACATCAAAAAAGATAGATGGTACAACAAACCCCTCAAGAAAGGGGCAAAAAGGCCCCGAGTCACTTCAGGTGGTGTGTCAGAGTCTCCCAGTGGATTTTCTAAGCACATTCAATCCAATTTGGACTTCTCTCCAGTAAACAGTGCTTCTAGTGAAGAAAATGTGAAGTACTCCAGTTCTCAGCCAGAACCCCGCACAGGTCTTTCCTTATGGGATACCAGCCCCTCATACATTGATAAATTGGTACAAGGGATCAGCTTTTCCCAGCCCACATGTCCTGATCATATGCTTTTGAATAGTCAGTTACTTGGCACCCCAGGATCCTCACAGAACCCCTGGCAGCGGTTGGTCAAAAGAATGACACGATTCTTTACCAAATTGGATGCAGACAAATCTTATCAATGCCTGAAAGAGACTTGTGAGAAGTTGGGCTATCAATGGAAGAAAAGTTGTATGAATCAGGTTACTATATCAACAACTGATAGGAGAAACAATAAACTCATTTTCAAAGTGAATTTGTTAGAAATGGATGATAAAATATTGGTTGACTTCCGGCTTTCTAAGGGTGATGGATTGGAGTTCAAGAGACACTTCCTGAAGATTAAAGGGAAGCTGATTGATATTGTGAGCAGCCAGAAGGTTTGGCTTCCTGCCACATGA';<br />
my $protein = '';<br />
my $codon;</p>
<p> sub Codon_table {<br />
my($codon) = @_;<br />
if( $codon =~ /TCA/i ){ return 'S' }<br />
elsif( $codon =~ /TCC/i ){ return 'S' }<br />
elsif( $codon =~ /TCG/i ){ return 'S' }<br />
elsif( $codon =~ /TCT/i ){ return 'S' }<br />
elsif( $codon =~ /TTC/i ){ return 'F' }<br />
elsif( $codon =~ /TTT/i ){ return 'F' }<br />
elsif( $codon =~ /TTA/i ){ return 'L' }<br />
elsif( $codon =~ /TTG/i ){ return 'L' }<br />
elsif( $codon =~ /TAC/i ){ return 'Y' }<br />
elsif( $codon =~ /TAT/i ){ return 'Y' }<br />
elsif( $codon =~ /TAA/i ){ return '*' }<br />
elsif( $codon =~ /TAG/i ){ return '*' }<br />
elsif( $codon =~ /TGC/i ){ return 'C' }<br />
elsif( $codon =~ /TGT/i ){ return 'C' }<br />
elsif( $codon =~ /TGA/i ){ return '*' }<br />
elsif( $codon =~ /TGG/i ){ return 'W' }<br />
elsif( $codon =~ /CTA/i ){ return 'L' }<br />
elsif( $codon =~ /CTC/i ){ return 'L' }<br />
elsif( $codon =~ /CTG/i ){ return 'L' }<br />
elsif( $codon =~ /CTT/i ){ return 'L' }<br />
elsif( $codon =~ /CCA/i ){ return 'P' }<br />
elsif( $codon =~ /CCC/i ){ return 'P' }<br />
elsif( $codon =~ /CCG/i ){ return 'P' }<br />
elsif( $codon =~ /CCT/i ){ return 'P' }<br />
elsif( $codon =~ /CAC/i ){ return 'H' }<br />
elsif( $codon =~ /CAT/i ){ return 'H' }<br />
elsif( $codon =~ /CAA/i ){ return 'Q' }<br />
elsif( $codon =~ /CAG/i ){ return 'Q' }<br />
elsif( $codon =~ /CGA/i ){ return 'R' }<br />
elsif( $codon =~ /CGC/i ){ return 'R' }<br />
elsif( $codon =~ /CGG/i ){ return 'R' }<br />
elsif( $codon =~ /CGT/i ){ return 'R' }<br />
elsif( $codon =~ /ATA/i ){ return 'I' }<br />
elsif( $codon =~ /ATC/i ){ return 'I' }<br />
elsif( $codon =~ /ATT/i ){ return 'I' }<br />
elsif( $codon =~ /ATG/i ){ return 'M' }<br />
elsif( $codon =~ /ACA/i ){ return 'T' }<br />
elsif( $codon =~ /ACC/i ){ return 'T' }<br />
elsif( $codon =~ /ACG/i ){ return 'T' }<br />
elsif( $codon =~ /ACT/i ){ return 'T' }<br />
elsif( $codon =~ /AAC/i ){ return 'N' }<br />
elsif( $codon =~ /AAT/i ){ return 'N' }<br />
elsif( $codon =~ /AAA/i ){ return 'K' }<br />
elsif( $codon =~ /AAG/i ){ return 'K' }<br />
elsif( $codon =~ /AGC/i ){ return 'S' }<br />
elsif( $codon =~ /AGT/i ){ return 'S' }<br />
elsif( $codon =~ /AGA/i ){ return 'R' }<br />
elsif( $codon =~ /AGG/i ){ return 'R' }<br />
elsif( $codon =~ /GTA/i ){ return 'V' }<br />
elsif( $codon =~ /GTC/i ){ return 'V' }<br />
elsif( $codon =~ /GTG/i ){ return 'V' }<br />
elsif( $codon =~ /GTT/i ){ return 'V' }<br />
elsif( $codon =~ /GCA/i ){ return 'A' }<br />
elsif( $codon =~ /GCC/i ){ return 'A' }<br />
elsif( $codon =~ /GCG/i ){ return 'A' }<br />
elsif( $codon =~ /GCT/i ){ return 'A' }<br />
elsif( $codon =~ /GAC/i ){ return 'D' }<br />
elsif( $codon =~ /GAT/i ){ return 'D' }<br />
elsif( $codon =~ /GAA/i ){ return 'E' }<br />
elsif( $codon =~ /GAG/i ){ return 'E' }<br />
elsif( $codon =~ /GGA/i ){ return 'G' }<br />
elsif( $codon =~ /GGC/i ){ return 'G' }<br />
elsif( $codon =~ /GGG/i ){ return 'G' }<br />
elsif( $codon =~ /GGT/i ){ return 'G' }<br />
else{print STDERR "Wrong!!\nPlease check your sequence\n\n";<br />
exit;}<br />
}</p>
<p>for(my $i=0; $i < (length($dna) - 2) ; $i += 3) {<br />
$codon = substr($dna,$i,3);<br />
$protein .= Codon_table($codon);<br />
}</p>
<p>print "\n <DNA>\n\n$dna\n\n <Protein>\n\n$protein\n\n";</p>
<p>exit;</p>
# Translate DNA into protein</p>
<p>my $dna = 'ATGGCAGTGCCCTTTGTGGAAGACTGGGACTTGGTGCAAACCCTGGGAGAAGGTGCCTATGGAGAAGTTCAACTTGCTGTGAATAGAGTAACTGAAGAAGCAGTCGCAGTGAAGATTGTAGATATGAAGCGTGCCGTAGACTGTCCAGAAAATATTAAGAAAGAGATCTGTATCAATAAAATGCTAAATCATGAAAATGTAGTAAAATTCTATGGTCACAGGAGAGAAGGCAATATCCAATATTTATTTCTGGAGTACTGTAGTGGAGGAGAGCTTTTTGACAGAATAGAGCCAGACATAGGCATGCCTGAACCAGATGCTCAGAGATTCTTCCATCAACTCATGGCAGGGGTGGTTTATCTGCATGGTATTGGAATAACTCACAGGGATATTAAACCAGAAAATCTTCTGTTGGATGAAAGGGATAACCTCAAAATCTCAGACTTTGGCTTGGCAACAGTATTTCGGTATAATAATCGTGAGCGTTTGTTGAACAAGATGTGTGGTACTTTACCATATGTTGCTCCAGAACTTCTGAAGAGAAGAGAATTTCATGCAGAACCAGTTGATGTTTGGTCCTGTGGAATAGTACTTACTGCAATGCTCGCTGGAGAATTGCCATGGGACCAACCCAGTGACAGCTGTCAGGAGTATTCTGACTGGAAAGAAAAAAAAACATACCTCAACCCTTGGAAAAAAATCGATTCTGCTCCTCTAGCTCTGCTGCATAAAATCTTAGTTGAGAATCCATCAGCAAGAATTACCATTCCAGACATCAAAAAAGATAGATGGTACAACAAACCCCTCAAGAAAGGGGCAAAAAGGCCCCGAGTCACTTCAGGTGGTGTGTCAGAGTCTCCCAGTGGATTTTCTAAGCACATTCAATCCAATTTGGACTTCTCTCCAGTAAACAGTGCTTCTAGTGAAGAAAATGTGAAGTACTCCAGTTCTCAGCCAGAACCCCGCACAGGTCTTTCCTTATGGGATACCAGCCCCTCATACATTGATAAATTGGTACAAGGGATCAGCTTTTCCCAGCCCACATGTCCTGATCATATGCTTTTGAATAGTCAGTTACTTGGCACCCCAGGATCCTCACAGAACCCCTGGCAGCGGTTGGTCAAAAGAATGACACGATTCTTTACCAAATTGGATGCAGACAAATCTTATCAATGCCTGAAAGAGACTTGTGAGAAGTTGGGCTATCAATGGAAGAAAAGTTGTATGAATCAGGTTACTATATCAACAACTGATAGGAGAAACAATAAACTCATTTTCAAAGTGAATTTGTTAGAAATGGATGATAAAATATTGGTTGACTTCCGGCTTTCTAAGGGTGATGGATTGGAGTTCAAGAGACACTTCCTGAAGATTAAAGGGAAGCTGATTGATATTGTGAGCAGCCAGAAGGTTTGGCTTCCTGCCACATGA';<br />
my $protein = '';<br />
my $codon;</p>
<p> sub Codon_table {<br />
my($codon) = @_;<br />
if( $codon =~ /TCA/i ){ return 'S' }<br />
elsif( $codon =~ /TCC/i ){ return 'S' }<br />
elsif( $codon =~ /TCG/i ){ return 'S' }<br />
elsif( $codon =~ /TCT/i ){ return 'S' }<br />
elsif( $codon =~ /TTC/i ){ return 'F' }<br />
elsif( $codon =~ /TTT/i ){ return 'F' }<br />
elsif( $codon =~ /TTA/i ){ return 'L' }<br />
elsif( $codon =~ /TTG/i ){ return 'L' }<br />
elsif( $codon =~ /TAC/i ){ return 'Y' }<br />
elsif( $codon =~ /TAT/i ){ return 'Y' }<br />
elsif( $codon =~ /TAA/i ){ return '*' }<br />
elsif( $codon =~ /TAG/i ){ return '*' }<br />
elsif( $codon =~ /TGC/i ){ return 'C' }<br />
elsif( $codon =~ /TGT/i ){ return 'C' }<br />
elsif( $codon =~ /TGA/i ){ return '*' }<br />
elsif( $codon =~ /TGG/i ){ return 'W' }<br />
elsif( $codon =~ /CTA/i ){ return 'L' }<br />
elsif( $codon =~ /CTC/i ){ return 'L' }<br />
elsif( $codon =~ /CTG/i ){ return 'L' }<br />
elsif( $codon =~ /CTT/i ){ return 'L' }<br />
elsif( $codon =~ /CCA/i ){ return 'P' }<br />
elsif( $codon =~ /CCC/i ){ return 'P' }<br />
elsif( $codon =~ /CCG/i ){ return 'P' }<br />
elsif( $codon =~ /CCT/i ){ return 'P' }<br />
elsif( $codon =~ /CAC/i ){ return 'H' }<br />
elsif( $codon =~ /CAT/i ){ return 'H' }<br />
elsif( $codon =~ /CAA/i ){ return 'Q' }<br />
elsif( $codon =~ /CAG/i ){ return 'Q' }<br />
elsif( $codon =~ /CGA/i ){ return 'R' }<br />
elsif( $codon =~ /CGC/i ){ return 'R' }<br />
elsif( $codon =~ /CGG/i ){ return 'R' }<br />
elsif( $codon =~ /CGT/i ){ return 'R' }<br />
elsif( $codon =~ /ATA/i ){ return 'I' }<br />
elsif( $codon =~ /ATC/i ){ return 'I' }<br />
elsif( $codon =~ /ATT/i ){ return 'I' }<br />
elsif( $codon =~ /ATG/i ){ return 'M' }<br />
elsif( $codon =~ /ACA/i ){ return 'T' }<br />
elsif( $codon =~ /ACC/i ){ return 'T' }<br />
elsif( $codon =~ /ACG/i ){ return 'T' }<br />
elsif( $codon =~ /ACT/i ){ return 'T' }<br />
elsif( $codon =~ /AAC/i ){ return 'N' }<br />
elsif( $codon =~ /AAT/i ){ return 'N' }<br />
elsif( $codon =~ /AAA/i ){ return 'K' }<br />
elsif( $codon =~ /AAG/i ){ return 'K' }<br />
elsif( $codon =~ /AGC/i ){ return 'S' }<br />
elsif( $codon =~ /AGT/i ){ return 'S' }<br />
elsif( $codon =~ /AGA/i ){ return 'R' }<br />
elsif( $codon =~ /AGG/i ){ return 'R' }<br />
elsif( $codon =~ /GTA/i ){ return 'V' }<br />
elsif( $codon =~ /GTC/i ){ return 'V' }<br />
elsif( $codon =~ /GTG/i ){ return 'V' }<br />
elsif( $codon =~ /GTT/i ){ return 'V' }<br />
elsif( $codon =~ /GCA/i ){ return 'A' }<br />
elsif( $codon =~ /GCC/i ){ return 'A' }<br />
elsif( $codon =~ /GCG/i ){ return 'A' }<br />
elsif( $codon =~ /GCT/i ){ return 'A' }<br />
elsif( $codon =~ /GAC/i ){ return 'D' }<br />
elsif( $codon =~ /GAT/i ){ return 'D' }<br />
elsif( $codon =~ /GAA/i ){ return 'E' }<br />
elsif( $codon =~ /GAG/i ){ return 'E' }<br />
elsif( $codon =~ /GGA/i ){ return 'G' }<br />
elsif( $codon =~ /GGC/i ){ return 'G' }<br />
elsif( $codon =~ /GGG/i ){ return 'G' }<br />
elsif( $codon =~ /GGT/i ){ return 'G' }<br />
else{print STDERR "Wrong!!\nPlease check your sequence\n\n";<br />
exit;}<br />
}</p>
<p>for(my $i=0; $i < (length($dna) - 2) ; $i += 3) {<br />
$codon = substr($dna,$i,3);<br />
$protein .= Codon_table($codon);<br />
}</p>
<p>print "\n <DNA>\n\n$dna\n\n <Protein>\n\n$protein\n\n";</p>
<p>exit;</p>