- or download this
my $seq = shift;
my $amino_acid;
...
$amino_acid .= $genetic_code{$codon};
}
return $amino_acid;
- or download this
print OneFrameTranslation('ATGCCCGTAC'),"\n";
print OneFrameTranslation('GCTTCCCAGCGC'),"\n";
__END__
MPV
ASQR
- or download this
my $amino_acid;
while ($seq=~/\G(...)/sg) {
$amino_acid .= $genetic_code{$1};
}
return $amino_acid;
- or download this
# build the regex, this only needs to be done once
my ($genetic_regex) = map qr/$_/, join '|', keys %genetic_code;
# apply the regex
(my $amino_acid = $seq) =~ s/($genetic_regex)/$genetic_code{$1}/g;
return $amino_acid;