Open main menu

Biolecture.org β

Perl code-CSH

Revision as of 01:12, 7 June 2016 by imported>Chaeshinhyeok

#!/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