Open main menu

Biolecture.org β

Changes

Perl Homework

3,790 bytes added, 16:36, 11 June 2016
Created page with "<p><perl HW2></p> <p>code:</p> <p>#!/usr/bin/perl<br /> use strict;<br /> use warnings;</p> <p>my @codon = ("A","T","C","G");<br ..."
<p>&lt;perl HW2&gt;</p>

<p>code:</p>

<p>#!/usr/bin/perl<br />
use strict;<br />
use warnings;</p>

<p>my @codon = (&quot;A&quot;,&quot;T&quot;,&quot;C&quot;,&quot;G&quot;);<br />
my %triplets = ( &quot;TTT&quot;, &quot;F&quot;, &quot;TTC&quot;, &quot;F&quot;, &quot;TTA&quot;, &quot;L&quot;, &quot;TTG&quot;, &quot;L&quot;,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;TCT&quot;, &quot;S&quot;, &quot;TCC&quot;, &quot;S&quot;, &quot;TCA&quot;, &quot;S&quot;, &quot;TCG&quot;, &quot;S&quot;,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;TAT&quot;, &quot;Y&quot;, &quot;TAC&quot;, &quot;Y&quot;, &quot;TAA&quot;, &quot;*&quot;, &quot;TAG&quot;, &quot;*&quot;,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;TGT&quot;, &quot;C&quot;, &quot;TGC&quot;, &quot;C&quot;, &quot;TGA&quot;, &quot;*&quot;,&quot;TGG&quot;, &quot;W&quot;,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;CTT&quot;, &quot;L&quot;, &quot;CTC&quot;, &quot;L&quot;, &quot;CTA&quot;, &quot;L&quot;,&quot;CTG&quot;, &quot;L&quot;,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;CCT&quot;, &quot;P&quot;, &quot;CCC&quot;, &quot;P&quot;, &quot;CCA&quot;, &quot;P&quot;,&quot;CCG&quot;, &quot;P&quot;,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;CAT&quot;, &quot;H&quot;, &quot;CAC&quot;, &quot;H&quot;, &quot;CAA&quot;, &quot;Q&quot;,&quot;CAG&quot;, &quot;Q&quot;,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;CGT&quot;, &quot;R&quot;, &quot;CGC&quot;, &quot;R&quot;, &quot;CGA&quot;, &quot;R&quot;,&quot;CGG&quot;, &quot;R&quot;,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;ATT&quot;, &quot;I&quot;, &quot;ATC&quot;, &quot;I&quot;, &quot;ATA&quot;, &quot;I&quot;,&quot;ATG&quot;, &quot;M&quot;,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;ACT&quot;, &quot;T&quot;, &quot;ACC&quot;, &quot;T&quot;, &quot;ACA&quot;, &quot;T&quot;,&quot;ACG&quot;, &quot;T&quot;,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;AAT&quot;, &quot;N&quot;, &quot;AAC&quot;, &quot;N&quot;, &quot;AAA&quot;, &quot;K&quot;,&quot;AAG&quot;, &quot;K&quot;,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;AGT&quot;, &quot;S&quot;, &quot;AGC&quot;, &quot;S&quot;, &quot;AGA&quot;, &quot;R&quot;,&quot;AGG&quot;, &quot;R&quot;,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;GTT&quot;, &quot;V&quot;, &quot;GTC&quot;, &quot;V&quot;, &quot;GTA&quot;, &quot;V&quot;,&quot;GTG&quot;, &quot;V&quot;,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;GCT&quot;, &quot;A&quot;, &quot;GCC&quot;, &quot;A&quot;, &quot;GCA&quot;, &quot;A&quot;,&quot;GCG&quot;, &quot;A&quot;,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;GAT&quot;, &quot;D&quot;, &quot;GAC&quot;, &quot;D&quot;, &quot;GAA&quot;, &quot;E&quot;,&quot;GAG&quot;, &quot;E&quot;,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;GGT&quot;, &quot;G&quot;, &quot;GGC&quot;, &quot;G&quot;, &quot;GGA&quot;, &quot;G&quot;,&quot;GGG&quot;, &quot;G&quot;);<br />
foreach my $first (@codon){<br />
&nbsp; &nbsp; &nbsp; &nbsp; foreach my $second (@codon){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; foreach my $third (@codon){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; my $check = $first . $second . $third;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; print &quot;$check : \t&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; print &quot;$triplets{$check}\t&quot;;<br />
}}}<br />
&nbsp;</p>

<p>output&gt;</p>

<p>&nbsp;</p>
Anonymous user