# This is my first post starting with very basic code...
print “Enter the RNA sequence: “;
$rna = <>;
chomp($rna);
$rna =~s/[^acgu]//ig;
my $rna = uc($rna);
my(%genetic_code) = (
‘GGA’ => ‘G’, ‘GGC’ => ‘G’, ‘GGG’ => ‘G’, ‘GGU’ => ‘G’, # Glycine
‘GCA’ => ‘A’, ‘GCC’ => ‘A’, ‘GCG’ => ‘A’, ‘GCU’ => ‘A’, # Alanine
‘GUA’ => ‘V’, ‘GUC’ => ‘V’, ‘GUG’ => ‘V’, ‘GUU’ => ‘V’, # Valine
‘CCA’ => ‘P’, ‘CCC’ => ‘P’, ‘CCG’ => ‘P’, ‘CCU’ => ‘P’, # Proline
‘UCA’ => ‘S’, ‘UCC’ => ‘S’, ‘UCG’ => ‘S’, ‘UCU’ => ‘S’, # Serine
‘CUA’ => ‘L’, ‘CUC’ => ‘L’, ‘CUG’ => ‘L’, ‘CUU’ => ‘L’, # Leucine
‘CGA’ => ‘R’, ‘CGC’ => ‘R’, ‘CGG’ => ‘R’, ‘CGU’ => ‘R’, # Arginine
‘ACA’ => ‘T’, ‘ACC’ => ‘T’, ‘ACG’ => ‘T’, ‘ACU’ => ‘T’, # Threonine
‘AUA’ => ‘I’, ‘AUC’ => ‘I’, ‘AUU’ => ‘I’, # Isoleucine
‘UAA’ => ‘_’, ‘UAG’ => ‘_’, ‘UGA’ => ‘_’, # Stop
‘AAA’ => ‘K’, ‘AAG’ => ‘K’, # Lysine
‘AGC’ => ‘S’, ‘AGU’ => ‘S’, # Serine
‘UUA’ => ‘L’, ‘UUG’ => ‘L’, # Leucine
‘AGA’ => ‘R’, ‘AGG’ => ‘R’, # Arginine
‘UAC’ => ‘Y’, ‘UAU’ => ‘Y’, # Tyrosine
‘UGC’ => ‘C’, ‘UGU’ => ‘C’, # Cysteine
‘CAA’ => ‘Q’, ‘CAG’ => ‘Q’, # Glutamine
‘AAC’ => ‘N’, ‘AAU’ => ‘N’, # Asparagine
‘UUC’ => ‘F’, ‘UUU’ => ‘F’, # Phenylalanine
‘GAC’ => ‘D’, ‘GAU’ => ‘D’, # Aspartic Acid
‘GAA’ => ‘E’, ‘GAG’ => ‘E’, # Glutamic Acid
‘UGG’ => ‘W’, # Tryptophan
‘CAC’ => ‘H’, # Histidine
‘AUG’ => ‘M’, # Methionine
‘CAU’ => ‘H’, # Histidine
);
my ($protein) = “”;
for(my $i=0;$i<length($rna)-2;$i+=3)
{
$codon = substr($rna,$i,3);
$protein .= $genetic_code{$codon};
}
print “Translated protein sequence is $protein”;
#This program can also used for six reading frame, by changing the three
#character shift in forward and reverse of the RNA sequence.
No comments:
Post a Comment