Difference between revisions of "Perl code-CSH"

From Biolecture.org
imported>Chaeshinhyeok
imported>Chaeshinhyeok
 
Line 3: Line 3:
 
use warnings;<br />
 
use warnings;<br />
 
my @Base = (&quot;T&quot;,&quot;C&quot;,&quot;A&quot;,&quot;G&quot;);<br />
 
my @Base = (&quot;T&quot;,&quot;C&quot;,&quot;A&quot;,&quot;G&quot;);<br />
my @Prot = (&quot;F&quot;,&quot;F&quot;,&quot;L&quot;,&quot;L&quot;,&quot;L&quot;,&quot;L&quot;,&quot;L&quot;,&quot;L&quot;,<br />
+
my @Prot = ( &nbsp; &nbsp;&quot;F&quot;,&quot;F&quot;,&quot;L&quot;,&quot;L&quot;,&quot;S&quot;,&quot;S&quot;,&quot;S&quot;,&quot;S&quot;,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;I&quot;,&quot;I&quot;,&quot;I&quot;,&quot;M&quot;,&quot;V&quot;,&quot;V&quot;,&quot;V&quot;,&quot;V&quot;,<br />
+
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;Y&quot;,&quot;Y&quot;,&quot;*&quot;,&quot;*&quot;,&quot;C&quot;,&quot;C&quot;,&quot;*&quot;,&quot;W&quot;,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;S&quot;,&quot;S&quot;,&quot;S&quot;,&quot;S&quot;,&quot;P&quot;,&quot;P&quot;,&quot;P&quot;,&quot;P&quot;,<br />
+
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;L&quot;,&quot;L&quot;,&quot;L&quot;,&quot;L&quot;,&quot;P&quot;,&quot;P&quot;,&quot;P&quot;,&quot;P&quot;,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;T&quot;,&quot;T&quot;,&quot;T&quot;,&quot;T&quot;,&quot;A&quot;,&quot;A&quot;,&quot;A&quot;,&quot;A&quot;,<br />
+
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;H&quot;,&quot;H&quot;,&quot;Q&quot;,&quot;Q&quot;,&quot;R&quot;,&quot;R&quot;,&quot;R&quot;,&quot;R&quot;,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;Y&quot;,&quot;Y&quot;,&quot;*&quot;,&quot;*&quot;,&quot;H&quot;,&quot;H&quot;,&quot;Q&quot;,&quot;Q&quot;,<br />
+
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;I&quot;,&quot;I&quot;,&quot;I&quot;,&quot;M&quot;,&quot;T&quot;,&quot;T&quot;,&quot;T&quot;,&quot;T&quot;,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;N&quot;,&quot;N&quot;,&quot;K&quot;,&quot;K&quot;,&quot;D&quot;,&quot;D&quot;,&quot;E&quot;,&quot;E&quot;,<br />
+
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;N&quot;,&quot;N&quot;,&quot;K&quot;,&quot;K&quot;,&quot;S&quot;,&quot;S&quot;,&quot;R&quot;,&quot;R&quot;,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;C&quot;,&quot;C&quot;,&quot;*&quot;,&quot;W&quot;,&quot;R&quot;,&quot;R&quot;,&quot;R&quot;,&quot;R&quot;,<br />
+
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;V&quot;,&quot;V&quot;,&quot;V&quot;,&quot;V&quot;,&quot;A&quot;,&quot;A&quot;,&quot;A&quot;,&quot;A&quot;,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;S&quot;,&quot;S&quot;,&quot;R&quot;,&quot;R&quot;,&quot;G&quot;,&quot;G&quot;,&quot;G&quot;,&quot;G&quot;);</p>
+
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;D&quot;,&quot;D&quot;,&quot;E&quot;,&quot;E&quot;,&quot;G&quot;,&quot;G&quot;,&quot;G&quot;,&quot;G&quot;);</p>
  
 
<p>for (my $A = 0; $A &lt;=3; $A++){<br />
 
<p>for (my $A = 0; $A &lt;=3; $A++){<br />
Line 28: Line 28:
  
 
<p>$ perl triplet_code.pl<br />
 
<p>$ perl triplet_code.pl<br />
TTT=F &nbsp; TTC=F &nbsp; TTA=L &nbsp; TTG=L &nbsp; TCT=L &nbsp; TCC=L &nbsp; TCA=L &nbsp; TCG=L &nbsp; TAT=I &nbsp; TAC=I &nbsp; TAA=I &nbsp; TAG=M &nbsp; TGT=V &nbsp; TGC=V &nbsp; TGA=V &nbsp; TGG=V &nbsp; CTT=S &nbsp; CTC=S &nbsp; CTA=S &nbsp; CTG=S &nbsp; CCT=P &nbsp; CCC=P &nbsp; CCA=P &nbsp; CCG=P &nbsp;CAT=T &nbsp;CAC=T &nbsp;CAA=T &nbsp; CAG=T &nbsp;CGT=A &nbsp;CGC=A &nbsp;CGA=A &nbsp;CGG=A &nbsp;ATT=Y &nbsp;ATC=Y &nbsp;ATA=* &nbsp; &nbsp;ATG=* &nbsp; ACT=H &nbsp; ACC=H &nbsp; ACA=Q &nbsp;ACG=Q &nbsp;AAT=N &nbsp;AAC=N &nbsp;AAA=K &nbsp;AAG=K &nbsp; AGT=D &nbsp;AGC=D &nbsp; AGA=E &nbsp;&nbsp;AGG=E GTT=C &nbsp;GTC=C &nbsp;GTA=* &nbsp; GTG=W &nbsp;GCT=R &nbsp;GCC=R &nbsp;GCA=R &nbsp;GCG=R GAT=S &nbsp;GAC=S &nbsp; GAA=R &nbsp;GAG=R &nbsp;GGT=G &nbsp; GGC=G &nbsp; GGA=G &nbsp;GGG=G<br />
+
TTT=F &nbsp; TTC=F &nbsp; TTA=L &nbsp; TTG=L &nbsp; TCT=S &nbsp; TCC=S &nbsp; TCA=S &nbsp; TCG=S &nbsp; TAT=Y &nbsp; TAC=YTAA=* &nbsp; TAG=* &nbsp; TGT=C &nbsp; TGC=C &nbsp; TGA=* &nbsp; TGG=W &nbsp; CTT=L &nbsp; CTC=L &nbsp; CTA=L &nbsp; CTG=LCCT=P &nbsp; CCC=P &nbsp; CCA=P &nbsp; CCG=P &nbsp; CAT=H &nbsp; CAC=H &nbsp; CAA=Q &nbsp; CAG=Q &nbsp; CGT=R &nbsp; CGC=RCGA=R &nbsp; CGG=R &nbsp; ATT=I &nbsp; ATC=I &nbsp; ATA=I &nbsp; ATG=M &nbsp; ACT=T &nbsp; ACC=T &nbsp; ACA=T &nbsp; ACG=TAAT=N &nbsp; AAC=N &nbsp; AAA=K &nbsp; AAG=K &nbsp; AGT=S &nbsp; AGC=S &nbsp; AGA=R &nbsp; AGG=R &nbsp; GTT=V &nbsp; GTC=VGTA=V &nbsp; GTG=V &nbsp; GCT=A &nbsp; GCC=A &nbsp; GCA=A &nbsp; GCG=A &nbsp; GAT=D &nbsp; GAC=D &nbsp; GAA=E &nbsp; GAG=EGGT=G &nbsp; GGC=G &nbsp; GGA=G &nbsp; GGG=G<br />
<img alt="" src="/ckfinder/userfiles/images/triplet.PNG" style="height:137px; width:854px" /></p>
+
<img alt="" src="/ckfinder/userfiles/images/%EC%BA%A1%EC%B2%98(3).PNG" style="height:158px; width:775px" /></p>

Latest revision as of 22:11, 16 June 2016

#!/usr/bin/perl
use strict;
use warnings;
my @Base = ("T","C","A","G");
my @Prot = (    "F","F","L","L","S","S","S","S",
                "Y","Y","*","*","C","C","*","W",
                "L","L","L","L","P","P","P","P",
                "H","H","Q","Q","R","R","R","R",
                "I","I","I","M","T","T","T","T",
                "N","N","K","K","S","S","R","R",
                "V","V","V","V","A","A","A","A",
                "D","D","E","E","G","G","G","G");

for (my $A = 0; $A <=3; $A++){
for (my $B = 0; $B <=3; $B++){
for (my $C = 0; $C <=3; $C++){
        print("$Base[$A]","$Base[$B]","$Base[$C]","=",$Prot[16*$A+4*$B+$C],"\t");
}}}
print("\n");

 

 

 

 

$ perl triplet_code.pl
TTT=F   TTC=F   TTA=L   TTG=L   TCT=S   TCC=S   TCA=S   TCG=S   TAT=Y   TAC=YTAA=*   TAG=*   TGT=C   TGC=C   TGA=*   TGG=W   CTT=L   CTC=L   CTA=L   CTG=LCCT=P   CCC=P   CCA=P   CCG=P   CAT=H   CAC=H   CAA=Q   CAG=Q   CGT=R   CGC=RCGA=R   CGG=R   ATT=I   ATC=I   ATA=I   ATG=M   ACT=T   ACC=T   ACA=T   ACG=TAAT=N   AAC=N   AAA=K   AAG=K   AGT=S   AGC=S   AGA=R   AGG=R   GTT=V   GTC=VGTA=V   GTG=V   GCT=A   GCC=A   GCA=A   GCG=A   GAT=D   GAC=D   GAA=E   GAG=EGGT=G   GGC=G   GGA=G   GGG=G