| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
=head1 NAME |
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
Bio::GeneDesign::CodonJuggle |
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
=head1 VERSION |
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
Version 5.56 |
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
Codon Juggle a sequence using rscu data to determine replacement likelihood |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
=head1 AUTHOR |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
Sarah Richardson . |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=cut |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
package Bio::GeneDesign::CodonJuggle; |
|
20
|
|
|
|
|
|
|
require Exporter; |
|
21
|
|
|
|
|
|
|
|
|
22
|
11
|
|
|
11
|
|
4083
|
use Bio::GeneDesign::Random qw(_random_index _weighted_rand); |
|
|
11
|
|
|
|
|
31
|
|
|
|
11
|
|
|
|
|
631
|
|
|
23
|
11
|
|
|
11
|
|
65
|
use Bio::GeneDesign::Basic qw(_compare_sequences); |
|
|
11
|
|
|
|
|
22
|
|
|
|
11
|
|
|
|
|
411
|
|
|
24
|
11
|
|
|
11
|
|
56
|
use Carp; |
|
|
11
|
|
|
|
|
21
|
|
|
|
11
|
|
|
|
|
443
|
|
|
25
|
|
|
|
|
|
|
|
|
26
|
11
|
|
|
11
|
|
56
|
use strict; |
|
|
11
|
|
|
|
|
18
|
|
|
|
11
|
|
|
|
|
196
|
|
|
27
|
11
|
|
|
11
|
|
52
|
use warnings; |
|
|
11
|
|
|
|
|
16
|
|
|
|
11
|
|
|
|
|
375
|
|
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
our $VERSION = 5.56; |
|
30
|
|
|
|
|
|
|
|
|
31
|
11
|
|
|
11
|
|
82
|
use base qw(Exporter); |
|
|
11
|
|
|
|
|
17
|
|
|
|
11
|
|
|
|
|
10942
|
|
|
32
|
|
|
|
|
|
|
our @EXPORT_OK = qw( |
|
33
|
|
|
|
|
|
|
_list_algorithms |
|
34
|
|
|
|
|
|
|
_codonJuggle_balanced |
|
35
|
|
|
|
|
|
|
_codonJuggle_high |
|
36
|
|
|
|
|
|
|
_codonJuggle_least_different_rscu |
|
37
|
|
|
|
|
|
|
_codonJuggle_most_different_sequence |
|
38
|
|
|
|
|
|
|
_codonJuggle_random |
|
39
|
|
|
|
|
|
|
); |
|
40
|
|
|
|
|
|
|
our %EXPORT_TAGS = (GD => \@EXPORT_OK); |
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=head2 _list_algorithms |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=cut |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub _list_algorithms |
|
47
|
|
|
|
|
|
|
{ |
|
48
|
0
|
|
|
0
|
|
0
|
my %hsh = |
|
49
|
|
|
|
|
|
|
( |
|
50
|
|
|
|
|
|
|
balanced => 'weighted averages', |
|
51
|
|
|
|
|
|
|
high => 'uniformly most used', |
|
52
|
|
|
|
|
|
|
least_different_RSCU => 'least different by RSCU value', |
|
53
|
|
|
|
|
|
|
most_different_sequence => 'most different by sequence identity', |
|
54
|
|
|
|
|
|
|
random => 'random', |
|
55
|
|
|
|
|
|
|
); |
|
56
|
0
|
|
|
|
|
0
|
return \%hsh; |
|
57
|
|
|
|
|
|
|
} |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=head2 _codonJuggle_balanced |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=cut |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
sub _codonJuggle_balanced |
|
64
|
|
|
|
|
|
|
{ |
|
65
|
10000
|
|
|
10000
|
|
16285
|
my ($codon_table, $reverse_codon_table, $rscu_table, $nucseq) = @_; |
|
66
|
10000
|
|
|
|
|
13498
|
$nucseq = uc $nucseq; |
|
67
|
10000
|
|
|
|
|
13465
|
my %changehsh = (); |
|
68
|
10000
|
|
|
|
|
33641
|
foreach my $aa (keys %$reverse_codon_table) |
|
69
|
|
|
|
|
|
|
{ |
|
70
|
210000
|
|
|
|
|
260747
|
$changehsh{$aa} = {}; |
|
71
|
210000
|
|
|
|
|
224472
|
my @codons = @{$reverse_codon_table->{$aa}}; |
|
|
210000
|
|
|
|
|
323636
|
|
|
72
|
210000
|
|
|
|
|
244973
|
my $count = scalar(@codons); |
|
73
|
210000
|
|
|
|
|
219862
|
my $checksum = 0; |
|
74
|
210000
|
|
|
|
|
243428
|
foreach my $coda (@codons) |
|
75
|
|
|
|
|
|
|
{ |
|
76
|
640000
|
|
|
|
|
722994
|
my $likely = ($rscu_table->{$coda}) / $count; |
|
77
|
640000
|
|
|
|
|
774688
|
$changehsh{$aa}->{$coda} = $likely; |
|
78
|
640000
|
|
|
|
|
749442
|
$checksum += $likely; |
|
79
|
|
|
|
|
|
|
} |
|
80
|
210000
|
50
|
|
|
|
353752
|
if ($checksum == 0) |
|
81
|
|
|
|
|
|
|
{ |
|
82
|
0
|
|
|
|
|
0
|
croak "This RSCU table has no positive values for $aa\n"; |
|
83
|
|
|
|
|
|
|
} |
|
84
|
|
|
|
|
|
|
} |
|
85
|
10000
|
|
|
|
|
21541
|
my $offset = 0; |
|
86
|
10000
|
|
|
|
|
12127
|
my $newseq = q{}; |
|
87
|
10000
|
|
|
|
|
15231
|
while ($offset < length($nucseq)) |
|
88
|
|
|
|
|
|
|
{ |
|
89
|
50000
|
|
|
|
|
65459
|
my $curcod = substr($nucseq, $offset, 3); |
|
90
|
50000
|
|
|
|
|
65295
|
my $aa = $codon_table->{$curcod}; |
|
91
|
50000
|
|
|
|
|
81649
|
my $newcod = _weighted_rand($changehsh{$aa}); |
|
92
|
50000
|
|
|
|
|
68727
|
$newseq .= $newcod; |
|
93
|
50000
|
|
|
|
|
77701
|
$offset += 3; |
|
94
|
|
|
|
|
|
|
} |
|
95
|
10000
|
|
|
|
|
70857
|
return $newseq; |
|
96
|
|
|
|
|
|
|
} |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=head2 _codonJuggle_high |
|
99
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=cut |
|
102
|
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
sub _codonJuggle_high |
|
104
|
|
|
|
|
|
|
{ |
|
105
|
1
|
|
|
1
|
|
4
|
my ($codon_table, $reverse_codon_table, $rscu_table, $nucseq) = @_; |
|
106
|
1
|
|
|
|
|
2
|
my $cod_highs = {}; |
|
107
|
1
|
|
|
|
|
2
|
foreach my $aa (keys %{$reverse_codon_table}) |
|
|
1
|
|
|
|
|
7
|
|
|
108
|
|
|
|
|
|
|
{ |
|
109
|
21
|
|
|
|
|
23
|
my $myrscu = -1; |
|
110
|
21
|
|
|
|
|
67
|
foreach my $codon (@{$reverse_codon_table->{$aa}}) |
|
|
21
|
|
|
|
|
32
|
|
|
111
|
|
|
|
|
|
|
{ |
|
112
|
64
|
100
|
|
|
|
138
|
if ($rscu_table->{$codon} > $myrscu) |
|
113
|
|
|
|
|
|
|
{ |
|
114
|
35
|
|
|
|
|
51
|
$cod_highs->{$aa} = $codon; |
|
115
|
35
|
|
|
|
|
45
|
$myrscu = $rscu_table->{$codon}; |
|
116
|
|
|
|
|
|
|
} |
|
117
|
|
|
|
|
|
|
} |
|
118
|
|
|
|
|
|
|
} |
|
119
|
1
|
|
|
|
|
2
|
my $offset = 0; |
|
120
|
1
|
|
|
|
|
2
|
my $newseq = q{}; |
|
121
|
1
|
|
|
|
|
3
|
while ($offset < length($nucseq)) |
|
122
|
|
|
|
|
|
|
{ |
|
123
|
200
|
|
|
|
|
224
|
my $curcod = substr($nucseq, $offset, 3); |
|
124
|
200
|
|
|
|
|
248
|
$newseq .= $cod_highs->{$codon_table->{$curcod}}; |
|
125
|
200
|
|
|
|
|
279
|
$offset += 3; |
|
126
|
|
|
|
|
|
|
} |
|
127
|
1
|
|
|
|
|
7
|
return $newseq; |
|
128
|
|
|
|
|
|
|
} |
|
129
|
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
=head2 _codonJuggle_least_different_rscu |
|
131
|
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
=cut |
|
133
|
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
sub _codonJuggle_least_different_rscu |
|
135
|
|
|
|
|
|
|
{ |
|
136
|
1
|
|
|
1
|
|
3
|
my ($codon_table, $reverse_codon_table, $rscu_table, $nucseq) = @_; |
|
137
|
1
|
|
|
|
|
4
|
my %changehsh = (); |
|
138
|
1
|
|
|
|
|
9
|
foreach my $aa (sort keys %$reverse_codon_table) |
|
139
|
|
|
|
|
|
|
{ |
|
140
|
21
|
|
|
|
|
28
|
foreach my $coda (@{$reverse_codon_table->{$aa}}) |
|
|
21
|
|
|
|
|
35
|
|
|
141
|
|
|
|
|
|
|
{ |
|
142
|
64
|
|
|
|
|
84
|
$changehsh{$coda} = $coda; |
|
143
|
|
|
|
|
|
|
my @posarr = sort {abs($rscu_table->{$a} - $rscu_table->{$coda}) |
|
144
|
69
|
|
|
|
|
131
|
<=> abs($rscu_table->{$b} - $rscu_table->{$coda})} |
|
145
|
180
|
|
|
|
|
317
|
grep {abs($rscu_table->{$_} - $rscu_table->{$coda}) <= 1} |
|
146
|
244
|
|
|
|
|
329
|
grep {$_ ne $coda} |
|
147
|
64
|
|
|
|
|
68
|
@{$reverse_codon_table->{$aa}}; |
|
|
64
|
|
|
|
|
88
|
|
|
148
|
64
|
100
|
|
|
|
379
|
$changehsh{$coda} = $posarr[0] if (scalar @posarr); |
|
149
|
|
|
|
|
|
|
} |
|
150
|
|
|
|
|
|
|
} |
|
151
|
|
|
|
|
|
|
|
|
152
|
1
|
|
|
|
|
4
|
my $offset = 0; |
|
153
|
1
|
|
|
|
|
2
|
my $newseq = q{}; |
|
154
|
1
|
|
|
|
|
6
|
while ($offset < length($nucseq)) |
|
155
|
|
|
|
|
|
|
{ |
|
156
|
200
|
|
|
|
|
226
|
my $curcod = substr($nucseq, $offset, 3); |
|
157
|
200
|
|
|
|
|
225
|
$newseq .= $changehsh{$curcod}; |
|
158
|
200
|
|
|
|
|
281
|
$offset += 3; |
|
159
|
|
|
|
|
|
|
} |
|
160
|
1
|
|
|
|
|
7
|
return $newseq; |
|
161
|
|
|
|
|
|
|
} |
|
162
|
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
=head2 _codonJuggle_most_different_sequence |
|
164
|
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
=cut |
|
166
|
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
sub _codonJuggle_most_different_sequence |
|
168
|
|
|
|
|
|
|
{ |
|
169
|
1
|
|
|
1
|
|
3
|
my ($codon_table, $reverse_codon_table, $rscu_table, $nucseq) = @_; |
|
170
|
1
|
|
|
|
|
2
|
my %changehsh = (); |
|
171
|
1
|
|
|
|
|
9
|
foreach my $aa (sort keys %$reverse_codon_table) |
|
172
|
|
|
|
|
|
|
{ |
|
173
|
21
|
|
|
|
|
28
|
foreach my $coda (@{$reverse_codon_table->{$aa}}) |
|
|
21
|
|
|
|
|
31
|
|
|
174
|
|
|
|
|
|
|
{ |
|
175
|
64
|
|
|
|
|
77
|
my %hsh; |
|
176
|
64
|
|
|
|
|
81
|
foreach my $codb (@{$reverse_codon_table->{$aa}}) |
|
|
64
|
|
|
|
|
102
|
|
|
177
|
|
|
|
|
|
|
{ |
|
178
|
244
|
|
|
|
|
378
|
$hsh{$codb} = _compare_sequences($coda, $codb); |
|
179
|
|
|
|
|
|
|
} |
|
180
|
64
|
|
|
|
|
159
|
my @mdcod = sort {$hsh{$b}->{D} <=> $hsh{$a}->{D} |
|
181
|
|
|
|
|
|
|
|| $hsh{$b}->{V} <=> $hsh{$a}->{V} |
|
182
|
|
|
|
|
|
|
|| abs($rscu_table->{$a} - $rscu_table->{$coda}) |
|
183
|
299
|
50
|
100
|
|
|
749
|
<=> abs($rscu_table->{$b} - $rscu_table->{$coda})} |
|
184
|
|
|
|
|
|
|
keys %hsh; |
|
185
|
64
|
100
|
|
|
|
127
|
if (scalar @mdcod > 1) |
|
186
|
|
|
|
|
|
|
{ |
|
187
|
62
|
50
|
|
|
|
103
|
shift @mdcod if ($mdcod[0] eq $coda); |
|
188
|
|
|
|
|
|
|
} |
|
189
|
64
|
|
|
|
|
250
|
$changehsh{$coda} = $mdcod[0]; |
|
190
|
|
|
|
|
|
|
} |
|
191
|
|
|
|
|
|
|
} |
|
192
|
|
|
|
|
|
|
|
|
193
|
1
|
|
|
|
|
3
|
my $offset = 0; |
|
194
|
1
|
|
|
|
|
3
|
my $newseq = q{}; |
|
195
|
1
|
|
|
|
|
4
|
while ($offset < length($nucseq)) |
|
196
|
|
|
|
|
|
|
{ |
|
197
|
200
|
|
|
|
|
223
|
my $curcod = substr($nucseq, $offset, 3); |
|
198
|
200
|
|
|
|
|
235
|
$newseq .= $changehsh{$curcod}; |
|
199
|
200
|
|
|
|
|
279
|
$offset += 3; |
|
200
|
|
|
|
|
|
|
} |
|
201
|
1
|
|
|
|
|
9
|
return $newseq; |
|
202
|
|
|
|
|
|
|
} |
|
203
|
|
|
|
|
|
|
|
|
204
|
|
|
|
|
|
|
|
|
205
|
|
|
|
|
|
|
=head2 _codonJuggle_random |
|
206
|
|
|
|
|
|
|
|
|
207
|
|
|
|
|
|
|
=cut |
|
208
|
|
|
|
|
|
|
|
|
209
|
|
|
|
|
|
|
sub _codonJuggle_random |
|
210
|
|
|
|
|
|
|
{ |
|
211
|
10000
|
|
|
10000
|
|
15937
|
my ($codon_table, $reverse_codon_table, $rscu_table, $nucseq) = @_; |
|
212
|
10000
|
|
|
|
|
12957
|
my $cod_highs = {}; |
|
213
|
10000
|
|
|
|
|
12495
|
foreach my $aa (keys %{$reverse_codon_table}) |
|
|
10000
|
|
|
|
|
32830
|
|
|
214
|
|
|
|
|
|
|
{ |
|
215
|
210000
|
|
|
|
|
272700
|
$cod_highs->{$aa} = []; |
|
216
|
210000
|
|
|
|
|
217393
|
foreach my $codon (@{$reverse_codon_table->{$aa}}) |
|
|
210000
|
|
|
|
|
267727
|
|
|
217
|
|
|
|
|
|
|
{ |
|
218
|
640000
|
|
|
|
|
643379
|
push @{$cod_highs->{$aa}}, $codon; |
|
|
640000
|
|
|
|
|
895194
|
|
|
219
|
|
|
|
|
|
|
} |
|
220
|
|
|
|
|
|
|
} |
|
221
|
10000
|
|
|
|
|
17945
|
my $offset = 0; |
|
222
|
10000
|
|
|
|
|
11610
|
my $newseq = q{}; |
|
223
|
10000
|
|
|
|
|
17189
|
while ($offset < length($nucseq)) |
|
224
|
|
|
|
|
|
|
{ |
|
225
|
50000
|
|
|
|
|
64897
|
my $curcod = substr($nucseq, $offset, 3); |
|
226
|
50000
|
|
|
|
|
63978
|
my $aa = $codon_table->{$curcod}; |
|
227
|
50000
|
|
|
|
|
51077
|
my $index = _random_index(scalar @{$cod_highs->{$aa}}); |
|
|
50000
|
|
|
|
|
88630
|
|
|
228
|
50000
|
|
|
|
|
80462
|
$newseq .= $cod_highs->{$aa}->[$index]; |
|
229
|
50000
|
|
|
|
|
80047
|
$offset += 3; |
|
230
|
|
|
|
|
|
|
} |
|
231
|
10000
|
|
|
|
|
58595
|
return $newseq; |
|
232
|
|
|
|
|
|
|
} |
|
233
|
|
|
|
|
|
|
|
|
234
|
|
|
|
|
|
|
1; |
|
235
|
|
|
|
|
|
|
|
|
236
|
|
|
|
|
|
|
__END__ |