Perl- from triplet code to amino acids residue-OG

From Biolecture.org
Revision as of 14:04, 19 June 2016 by imported>Gun Oh
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

#!/usr/bin/perl

use strict;

use warnings;

 

 

my $a;

my $b;

my $c;

my $final;

my $dna;

my @base= ("A" , "T" , "C" , "G" );

my %trans = ( "TTT" => "F", "TTC" => "F", "TTA"=> "L", "TTG"=> "L",

                "TCT"=> "S", "TCC"=> "S", "TCA"=> "S", "TCG"=> "S",

                "TAT"=> "Y", "TAC"=> "Y", "TAA"=> "N/A ", "TAG"=> "N/A ",

                "TGT"=> "C", "TGC"=>"C", "TGA"=> "N/A","TGG"=> "W",

                "CTT"=> "L", "CTC"=> "L", "CTA"=> "L","CTG"=> "L",

                "CCT"=> "P", "CCC"=> "P", "CCA"=> "P","CCG"=> "P",

                "CAT"=> "H", "CAC"=> "H", "CAA"=> "Q","CAG"=> "Q",

                "CGT"=> "R", "CGC"=> "R", "CGA"=> "R","CGG"=> "R",

                "ATT"=> "I", "ATC"=> "I", "ATA"=> "I","ATG"=> "M",

                "ACT"=> "T", "ACC"=> "T", "ACA"=> "T","ACG"=> "T",

                "AAT"=> "N", "AAC"=> "N", "AAA"=> "K","AAG"=> "K",

                "AGT"=> "S", "AGC"=> "S", "AGA"=> "R","AGG"=> "R",

                "GTT"=> "V", "GTC"=>"V", "GTA"=> "V","GTG"=> "V",

                "GCT"=> "A", "GCC"=> "A", "GCA"=> "A","GCG"=> "A",

                "GAT"=> "D", "GAC"=> "D", "GAA"=> "E","GAG"=>"E",

                "GGT"=> "G", "GGC"=> "G", "GGA"=>"G","GGG"=> "G");

 

foreach  $a(@base){

     foreach $b(@base){

          foreach $c(@base){

            $final = "$a$b$c";

            print $final,  "="  ,  $trans{$final},"\t";

}}}