Difference between revisions of "Perl code-CSH"

From Biolecture.org
imported>Chaeshinhyeok
(Created page with "<p>#!/usr/bin/perl<br /> use strict;<br /> use warnings;<br /> my @Base = ("T","C","A","G");<br /> my @Prot = ("F","F"...")
 
imported>Chaeshinhyeok
Line 29: Line 29:
 
<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=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 />
&nbsp;</p>
+
<img alt="" src="/ckfinder/userfiles/images/triplet.PNG" style="height:137px; width:854px" /></p>

Revision as of 01:12, 7 June 2016

#!/usr/bin/perl
use strict;
use warnings;
my @Base = ("T","C","A","G");
my @Prot = ("F","F","L","L","L","L","L","L",
                "I","I","I","M","V","V","V","V",
                "S","S","S","S","P","P","P","P",
                "T","T","T","T","A","A","A","A",
                "Y","Y","*","*","H","H","Q","Q",
                "N","N","K","K","D","D","E","E",
                "C","C","*","W","R","R","R","R",
                "S","S","R","R","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=L   TCC=L   TCA=L   TCG=L   TAT=I   TAC=I   TAA=I   TAG=M   TGT=V   TGC=V   TGA=V   TGG=V   CTT=S   CTC=S   CTA=S   CTG=S   CCT=P   CCC=P   CCA=P   CCG=P  CAT=T  CAC=T  CAA=T   CAG=T  CGT=A  CGC=A  CGA=A  CGG=A  ATT=Y  ATC=Y  ATA=*    ATG=*   ACT=H   ACC=H   ACA=Q  ACG=Q  AAT=N  AAC=N  AAA=K  AAG=K   AGT=D  AGC=D   AGA=E   AGG=E GTT=C  GTC=C  GTA=*   GTG=W  GCT=R  GCC=R  GCA=R  GCG=R GAT=S  GAC=S   GAA=R  GAG=R  GGT=G   GGC=G   GGA=G  GGG=G