Perl change codon to AA
CODE
#!/usr/bin/perl
use strict;
use warnings;
my @bases=("u","c","a","g");
my @AA=("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");
my %codon;
my $var;
my %result;
for (my $i=0;$i<4;$i++) {
for (my $j=0;$j<4;$j++) {
for (my $k=0;$k<4;$k++) {
$var=$bases[$i]. $bases[$j]. $bases[$k];
$codon{$var} = $AA[16*($i)+4*($j)+($k)];
}}}
print %codon , "\n";
print $codon{"uuu"};
Result
gggGuucFgguGaugMccaPauuIaacNccuPggaGacuTucuSgcuAcuuLcguRuuuFguuVgccAcuaLaucIggcGgagE
aauNcugLgauDaccTaagKuga.cgaRgcgAuuaLuaa.acgTgugVcauHuguCgcaAgucVuccSuacYagcSuauYucaS
acaTuugLauaIccgPcacHgaaEgacDcagQcggRcccPaggRaguSuag.cgcRguaVuggWugcCucgSagaRcucLaaaKcaaQ
F