3
|
1 #!/usr/bin/perl
|
|
2
|
|
3 my $DNA= $ARGV[0];
|
|
4
|
|
5 @dna = $DNA;
|
|
6 print "@dna[0]\t\t-> DNA\n";
|
|
7
|
|
8
|
|
9 for ($i = 0 ; $i < length(@dna[0]); $i++ ) {
|
|
10 @c[$i] = substr( @dna[0], $i, 1);
|
|
11 #print "@c[$i]";
|
|
12
|
|
13 if(@c[$i] eq 'A') {
|
|
14 $counterpart=$counterpart."T";
|
|
15 $rna=$rna."A";
|
|
16 }
|
|
17
|
|
18 elsif(@c[$i] eq 'T') {
|
|
19 $counterpart=$counterpart."A";
|
|
20 $rna=$rna."U";
|
|
21 }
|
|
22
|
|
23 elsif(@c[$i] eq 'C') {
|
|
24 $counterpart=$counterpart."G";
|
|
25 $rna=$rna."C";
|
|
26
|
|
27 }
|
|
28
|
|
29 elsif(@c[$i] eq 'G') {
|
|
30 $counterpart=$counterpart."C";
|
|
31 $rna=$rna."G";
|
|
32 }
|
|
33 }
|
|
34
|
|
35 print "$counterpart\t\t-> Counterpart of DNA\n";
|
|
36 print "$rna\t\t-> RNA\n";
|
|
37
|
|
38 my $j = 0;
|
|
39 for ($i = 0 ; $i < length ($rna); $i = $i+3) {
|
|
40 @codon[$j] = substr( $rna, $i, 3);
|
|
41 print "@codon[$j] ";
|
|
42 $j++;
|
|
43 }
|
|
44
|
|
45 print "-> Codon\n";
|
|
46
|
|
47 my(%genetic_code_table) = (
|
|
48
|
|
49 'UUU' => 'F',
|
|
50 'UUC' => 'F',
|
|
51 'UUA' => 'L',
|
|
52 'UUG' => 'L',
|
|
53 'CUU' => 'L',
|
|
54 'CUC' => 'L',
|
|
55 'CUA' => 'L',
|
|
56 'CUG' => 'L',
|
|
57 'AUU' => 'I',
|
|
58 'AUC' => 'I',
|
|
59 'AUA' => 'I',
|
|
60 'AUG' => 'M',
|
|
61 'GUU' => 'V',
|
|
62 'GUC' => 'V',
|
|
63 'GUA' => 'V',
|
|
64 'GUG' => 'V',
|
|
65 'UCU' => 'S',
|
|
66 'UCC' => 'S',
|
|
67 'UCA' => 'S',
|
|
68 'UCG' => 'S',
|
|
69 'CCU' => 'P',
|
|
70 'CCC' => 'P',
|
|
71 'CCA' => 'P',
|
|
72 'CCG' => 'P',
|
|
73 'ACU' => 'T',
|
|
74 'ACC' => 'T',
|
|
75 'ACA' => 'T',
|
|
76 'ACG' => 'T',
|
|
77 'GCU' => 'A',
|
|
78 'GCC' => 'A',
|
|
79 'GCA' => 'A',
|
|
80 'GCG' => 'A',
|
|
81 'UAU' => 'Y',
|
|
82 'UAC' => 'Y',
|
|
83 'UAA' => '.',
|
|
84 'UAG' => '.',
|
|
85 'CAU' => 'H',
|
|
86 'CAC' => 'H',
|
|
87 'CAA' => 'Q',
|
|
88 'CAG' => 'Q',
|
|
89 'AAU' => 'N',
|
|
90 'AAC' => 'N',
|
|
91 'AAA' => 'K',
|
|
92 'AAG' => 'K',
|
|
93 'GAU' => 'D',
|
|
94 'GAC' => 'D',
|
|
95 'GAA' => 'E',
|
|
96 'GAG' => 'E',
|
|
97 'UGU' => 'C',
|
|
98 'UGC' => 'C',
|
|
99 'UGA' => '.',
|
|
100 'UGG' => 'W',
|
|
101 'CGU' => 'R',
|
|
102 'CGC' => 'R',
|
|
103 'CGA' => 'R',
|
|
104 'CGG' => 'R',
|
|
105 'AGU' => 'S',
|
|
106 'AGC' => 'S',
|
|
107 'AGA' => 'R',
|
|
108 'AGG' => 'R',
|
|
109 'GGU' => 'G',
|
|
110 'GGC' => 'G',
|
|
111 'GGA' => 'G',
|
|
112 'GGG' => 'G',
|
|
113 );
|
|
114
|
|
115 for (my $j = 0 ; $j < length ($rna)/3; $j++) {
|
|
116
|
|
117 if( exists ($genetic_code_table{@codon[$j]}) ) {
|
|
118 @result[$j] = $genetic_code_table{@codon[$j]};
|
|
119 print "$genetic_code_table{@codon[$j]} ";
|
|
120 }
|
|
121 }
|
|
122
|
|
123 open(RESULT, "+>result.txt") or die "Couldn't open file result.txt, $!";
|
|
124
|
|
125 print RESULT @result;
|
|
126
|
|
127 close(RESULT) || die "Couldn't close file properly";
|
|
128 print "\n\n";
|