Changes

From Biolecture.org

PERL

3,866 bytes added, 18:07, 17 June 2016
no edit summary
<hr />
<p><strong>Translate combinations of triple bases into amino acids</strong></p>
 
<p>&nbsp;</p>
 
<pre>
<strong>$text = &quot;aaatgaccgatcagctacgatcagctataaaaaccccggagctacgatcatcg&quot;;</strong>
 
%convertor = (
&#39;TCA&#39; =&gt; &#39;S&#39;, # Serine
&#39;TCC&#39; =&gt; &#39;S&#39;, # Serine
&#39;TCG&#39; =&gt; &#39;S&#39;, # Serine
&#39;TCT&#39; =&gt; &#39;S&#39;, # Serine
&#39;TTC&#39; =&gt; &#39;F&#39;, # Phenylalanine
&#39;TTT&#39; =&gt; &#39;F&#39;, # Phenylalanine
&#39;TTA&#39; =&gt; &#39;L&#39;, # Leucine
&#39;TTG&#39; =&gt; &#39;L&#39;, # Leucine
&#39;TAC&#39; =&gt; &#39;Y&#39;, # Tyrosine
&#39;TAT&#39; =&gt; &#39;Y&#39;, # Tyrosine
&#39;TAA&#39; =&gt; &#39;_&#39;, # Stop
&#39;TAG&#39; =&gt; &#39;_&#39;, # Stop
&#39;TGC&#39; =&gt; &#39;C&#39;, # Cysteine
&#39;TGT&#39; =&gt; &#39;C&#39;, # Cysteine
&#39;TGA&#39; =&gt; &#39;_&#39;, # Stop
&#39;TGG&#39; =&gt; &#39;W&#39;, # Tryptophan
&#39;CTA&#39; =&gt; &#39;L&#39;, # Leucine
&#39;CTC&#39; =&gt; &#39;L&#39;, # Leucine
&#39;CTG&#39; =&gt; &#39;L&#39;, # Leucine
&#39;CTT&#39; =&gt; &#39;L&#39;, # Leucine
&#39;CCA&#39; =&gt; &#39;P&#39;, # Proline
&#39;CCC&#39; =&gt; &#39;P&#39;, # Proline
&#39;CCG&#39; =&gt; &#39;P&#39;, # Proline
&#39;CCT&#39; =&gt; &#39;P&#39;, # Proline
&#39;CAC&#39; =&gt; &#39;H&#39;, # Histidine
&#39;CAT&#39; =&gt; &#39;H&#39;, # Histidine
&#39;CAA&#39; =&gt; &#39;Q&#39;, # Glutamine
&#39;CAG&#39; =&gt; &#39;Q&#39;, # Glutamine
&#39;CGA&#39; =&gt; &#39;R&#39;, # Arginine
&#39;CGC&#39; =&gt; &#39;R&#39;, # Arginine
&#39;CGG&#39; =&gt; &#39;R&#39;, # Arginine
&#39;CGT&#39; =&gt; &#39;R&#39;, # Arginine
&#39;ATA&#39; =&gt; &#39;I&#39;, # Isoleucine
&#39;ATC&#39; =&gt; &#39;I&#39;, # Isoleucine
&#39;ATT&#39; =&gt; &#39;I&#39;, # Isoleucine
&#39;ATG&#39; =&gt; &#39;M&#39;, # Methionine
&#39;ACA&#39; =&gt; &#39;T&#39;, # Threonine
&#39;ACC&#39; =&gt; &#39;T&#39;, # Threonine
&#39;ACG&#39; =&gt; &#39;T&#39;, # Threonine
&#39;ACT&#39; =&gt; &#39;T&#39;, # Threonine
&#39;AAC&#39; =&gt; &#39;N&#39;, # Asparagine
&#39;AAT&#39; =&gt; &#39;N&#39;, # Asparagine
&#39;AAA&#39; =&gt; &#39;K&#39;, # Lysine
&#39;AAG&#39; =&gt; &#39;K&#39;, # Lysine
&#39;AGC&#39; =&gt; &#39;S&#39;, # Serine
&#39;AGT&#39; =&gt; &#39;S&#39;, # Serine
&#39;AGA&#39; =&gt; &#39;R&#39;, # Arginine
&#39;AGG&#39; =&gt; &#39;R&#39;, # Arginine
&#39;GTA&#39; =&gt; &#39;V&#39;, # Valine
&#39;GTC&#39; =&gt; &#39;V&#39;, # Valine
&#39;GTG&#39; =&gt; &#39;V&#39;, # Valine
&#39;GTT&#39; =&gt; &#39;V&#39;, # Valine
&#39;GCA&#39; =&gt; &#39;A&#39;, # Alanine
&#39;GCC&#39; =&gt; &#39;A&#39;, # Alanine
&#39;GCG&#39; =&gt; &#39;A&#39;, # Alanine
&#39;GCT&#39; =&gt; &#39;A&#39;, # Alanine
&#39;GAC&#39; =&gt; &#39;D&#39;, # Aspartic Acid
&#39;GAT&#39; =&gt; &#39;D&#39;, # Aspartic Acid
&#39;GAA&#39; =&gt; &#39;E&#39;, # Glutamic Acid
&#39;GAG&#39; =&gt; &#39;E&#39;, # Glutamic Acid
&#39;GGA&#39; =&gt; &#39;G&#39;, # Glycine
&#39;GGC&#39; =&gt; &#39;G&#39;, # Glycine
&#39;GGG&#39; =&gt; &#39;G&#39;, # Glycine
&#39;GGT&#39; =&gt; &#39;G&#39;, # Glycine
);
 
 
for ($s=0; $s&lt;3; $s++) {
$scrap = substr($text,0,$s);
$main = substr($text,$s);
$main =~ s/(...)/&quot;$convertor{uc $1}&quot; || &quot;?&quot;/eg;
print &quot;$scrap$main\n&quot;;
}
 
</pre>
 
<p>&nbsp;</p>
 
<pre>
%convertor = ( ~~~ );
 
= used for giving information for translation (codon into amino acids)
 
for ($s=0; $s&lt;3; $s++)</pre>
 
<p>=&nbsp;</p>

Navigation menu