line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
=head1 NAME |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
Bio::Polloc::Locus::repeat - A repetitive locus |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
=head1 DESCRIPTION |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
A repeatitive locus. Implements L<Bio::Polloc::LocusI>. |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=head1 AUTHOR - Luis M. Rodriguez-R |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
Email lmrodriguezr at gmail dot com |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
=cut |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
package Bio::Polloc::Locus::repeat; |
16
|
2
|
|
|
2
|
|
10
|
use base qw(Bio::Polloc::LocusI); |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
170
|
|
17
|
2
|
|
|
2
|
|
9
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
1739
|
|
18
|
|
|
|
|
|
|
our $VERSION = 1.0503; # [a-version] from Bio::Polloc::Polloc::Version |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
=head1 APPENDIX |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
Methods provided by the package |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=head2 new |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
Creates a B<Bio::Polloc::Locus::repeat> object. |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=head3 Arguments |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=over |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=item -period I<float> |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
The period of the repeat (units length). |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=item -exponent I<float> |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
The exponent (No of units). |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=item -error I<float> |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
Mismatches percentage. |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=item -repeats I<str> |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
Repetitive sequences, repeats space-separated. |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=item -consensus I<str> |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
Repeats consensus. |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=back |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=head3 Returns |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
A L<Bio::Polloc::Locus::repeat> object. |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=cut |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
sub new { |
62
|
0
|
|
|
0
|
1
|
0
|
my($caller,@args) = @_; |
63
|
0
|
|
|
|
|
0
|
my $self = $caller->SUPER::new(@args); |
64
|
0
|
|
|
|
|
0
|
$self->_initialize(@args); |
65
|
0
|
|
|
|
|
0
|
return $self; |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=head2 period |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
Gets/sets the period of the repeat. I<I.e.>, the size of each repeat. |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=head3 Arguments |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
The period (int, optional). |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=head3 Returns |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
The period (int or undef) |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=cut |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
sub period { |
84
|
159
|
|
|
159
|
1
|
176
|
my($self,$value) = @_; |
85
|
159
|
100
|
|
|
|
287
|
$self->{'_period'} = $value+0 if defined $value; |
86
|
159
|
|
|
|
|
281
|
return $self->{'_period'}; |
87
|
|
|
|
|
|
|
} |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=head2 exponent |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
Gets/sets the exponent of the repeat. I<I.e.>, the number of times the repeat |
93
|
|
|
|
|
|
|
is repeated. |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=head3 Arguments |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
The exponent (int, optional). |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=head3 Returns |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
The exponent (int or undef). |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=cut |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
sub exponent { |
106
|
159
|
|
|
159
|
1
|
178
|
my($self,$value) = @_; |
107
|
159
|
100
|
|
|
|
286
|
$self->{'_exponent'} = $value if defined $value; |
108
|
159
|
|
|
|
|
269
|
return $self->{'_exponent'}; |
109
|
|
|
|
|
|
|
} |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=head2 repeats |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
Sets/gets the repetitive sequence (each repeat separated by spaces). |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=head3 Arguments |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
The repetitive sequence (str, optional). |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
=head3 Returns |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
The repetitive sequence (str or undef). |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
=cut |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
sub repeats { |
127
|
53
|
|
|
53
|
1
|
54
|
my($self,$value) = @_; |
128
|
53
|
50
|
|
|
|
89
|
$self->{'_repeats'} = $value if defined $value; |
129
|
53
|
|
|
|
|
77
|
return $self->{'_repeats'}; |
130
|
|
|
|
|
|
|
} |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
=head2 consensus |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
Sets/gets the consensus repeat. |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
=head3 Arguments |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
The consensus sequence (str, optional). |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
=head3 Returns |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
The consensus sequence (str or undef). |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
=cut |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
sub consensus { |
148
|
53
|
|
|
53
|
1
|
52
|
my($self,$value) = @_; |
149
|
53
|
50
|
|
|
|
84
|
$self->{'_consensus'} = $value if defined $value; |
150
|
53
|
|
|
|
|
190
|
return $self->{'_consensus'}; |
151
|
|
|
|
|
|
|
} |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
=head2 error |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
Gets/sets the error rate of the repeat. I<I.e.>, the percentage of mismatches. |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
=head3 Arguments |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
The error (float). |
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
=head3 Returns |
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
The error (float or undef). |
164
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
=cut |
166
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
sub error { |
168
|
153
|
|
|
153
|
1
|
1179
|
my($self,$value) = @_; |
169
|
153
|
100
|
|
|
|
277
|
$self->{'_error'} = $value+0 if defined $value; |
170
|
153
|
|
|
|
|
275
|
return $self->{'_error'}; |
171
|
|
|
|
|
|
|
} |
172
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
=head2 score |
175
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
Gets/sets the score |
177
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
=head3 Arguments |
179
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
The score (float, optional). |
181
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
=head3 Returns |
183
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
The score (float or undef). |
185
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
=cut |
187
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
sub score { |
189
|
221
|
|
|
221
|
1
|
269
|
my($self,$value) = @_; |
190
|
221
|
100
|
|
|
|
419
|
$self->{'_score'} = $value+0 if defined $value; |
191
|
221
|
|
|
|
|
526
|
return $self->{'_score'}; |
192
|
|
|
|
|
|
|
} |
193
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
=head2 distance |
195
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
Returns the difference in length with the given locus. |
197
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
=head3 Arguments |
199
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
=over |
201
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
=item -locus I<Bio::Polloc::LocusI object> |
203
|
|
|
|
|
|
|
|
204
|
|
|
|
|
|
|
The locus to compare with. |
205
|
|
|
|
|
|
|
|
206
|
|
|
|
|
|
|
=item -locusref I<Bio::Polloc::LocusI object> |
207
|
|
|
|
|
|
|
|
208
|
|
|
|
|
|
|
The reference locus. If set, replaces the current loaded object. |
209
|
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
=item -units I<bool (int)> |
211
|
|
|
|
|
|
|
|
212
|
|
|
|
|
|
|
If true, returns the difference in the number of repeat units, not |
213
|
|
|
|
|
|
|
in base pairs. This flag requires the loci to be |
214
|
|
|
|
|
|
|
L<Bio::Polloc::Locus::repeat> objects. |
215
|
|
|
|
|
|
|
|
216
|
|
|
|
|
|
|
=back |
217
|
|
|
|
|
|
|
|
218
|
|
|
|
|
|
|
=head3 Returns |
219
|
|
|
|
|
|
|
|
220
|
|
|
|
|
|
|
Float, the difference in length. |
221
|
|
|
|
|
|
|
|
222
|
|
|
|
|
|
|
=head3 Throws |
223
|
|
|
|
|
|
|
|
224
|
|
|
|
|
|
|
L<Bio::Polloc::Polloc::Error> if no locus or the loci are not of the |
225
|
|
|
|
|
|
|
proper type. |
226
|
|
|
|
|
|
|
|
227
|
|
|
|
|
|
|
=cut |
228
|
|
|
|
|
|
|
|
229
|
|
|
|
|
|
|
sub distance { |
230
|
0
|
|
|
0
|
1
|
0
|
my($self, @args) = @_; |
231
|
0
|
|
|
|
|
0
|
my($locus,$locusref,$units) = $self->_rearrange([qw(LOCUS LOCUSREF UNITS)], @args); |
232
|
0
|
0
|
|
|
|
0
|
$locusref = $self unless defined $locusref; |
233
|
|
|
|
|
|
|
|
234
|
|
|
|
|
|
|
# Check input |
235
|
0
|
0
|
|
|
|
0
|
$self->throw('You must set the target locus') unless defined $locus; |
236
|
0
|
0
|
|
|
|
0
|
$self->throw('Target locus must be an object', $locus) unless UNIVERSAL::can($locus, 'isa'); |
237
|
0
|
0
|
|
|
|
0
|
$self->throw('Target locus must be Bio::Polloc::LocusI', $locus) unless $locus->isa('Bio::Polloc::LocusI'); |
238
|
0
|
0
|
|
|
|
0
|
$self->throw('Reference locus must be an object', $locusref) unless UNIVERSAL::can($locusref, 'isa'); |
239
|
0
|
0
|
|
|
|
0
|
$self->throw('Reference locus must be Bio::Polloc::LocusI', $locusref) unless $locusref->isa('Bio::Polloc::LocusI'); |
240
|
|
|
|
|
|
|
|
241
|
0
|
|
|
|
|
0
|
my $dist = 0; |
242
|
0
|
0
|
|
|
|
0
|
if($units){ |
243
|
0
|
0
|
0
|
|
|
0
|
$self->throw('Unable to get the target exponent', $locus) |
244
|
|
|
|
|
|
|
unless $locus->can('exponent') and defined $locus->exponent; |
245
|
0
|
0
|
0
|
|
|
0
|
$self->throw('Unable to get the reference exponent', $locusref) |
246
|
|
|
|
|
|
|
unless $locusref->can('exponent') and defined $locusref->exponent; |
247
|
0
|
|
|
|
|
0
|
$dist = abs $locus->exponent - $locusref->exponent; |
248
|
|
|
|
|
|
|
}else{ |
249
|
0
|
0
|
0
|
|
|
0
|
$self->throw('Unable to get the target coordinates', $locus) |
250
|
|
|
|
|
|
|
unless defined $locus->from and defined $locus->to; |
251
|
0
|
0
|
0
|
|
|
0
|
$self->throw('Unable to get the reference coordinates', $locusref) |
252
|
|
|
|
|
|
|
unless defined $locusref->from and defined $locusref->to; |
253
|
0
|
|
|
|
|
0
|
$dist = abs( abs($locus->to - $locus->from) - abs($locusref->to - $locusref->from) ); |
254
|
|
|
|
|
|
|
} |
255
|
0
|
|
|
|
|
0
|
$self->debug("Distance: $dist"); |
256
|
0
|
|
|
|
|
0
|
return $dist; |
257
|
|
|
|
|
|
|
} |
258
|
|
|
|
|
|
|
|
259
|
|
|
|
|
|
|
=head1 INTERNAL METHODS |
260
|
|
|
|
|
|
|
|
261
|
|
|
|
|
|
|
Methods intended to be used only within the scope of Bio::Polloc::* |
262
|
|
|
|
|
|
|
|
263
|
|
|
|
|
|
|
=head2 _initialize |
264
|
|
|
|
|
|
|
|
265
|
|
|
|
|
|
|
=cut |
266
|
|
|
|
|
|
|
|
267
|
|
|
|
|
|
|
sub _initialize { |
268
|
53
|
|
|
53
|
|
225
|
my($self,@args) = @_; |
269
|
53
|
|
|
|
|
227
|
my($period,$exponent,$score,$error,$repeats,$consensus) = $self->_rearrange( |
270
|
|
|
|
|
|
|
[qw(PERIOD EXPONENT SCORE ERROR REPEATS CONSENSUS)], @args); |
271
|
53
|
|
|
|
|
207
|
$self->type('repeat'); |
272
|
53
|
|
|
|
|
94
|
$self->period($period); |
273
|
53
|
50
|
|
|
|
79
|
$self->comments("Period=" . $self->period) if defined $self->period; |
274
|
53
|
|
|
|
|
87
|
$self->exponent($exponent); |
275
|
53
|
50
|
|
|
|
72
|
$self->comments("Exponent=" . $self->exponent) if defined $self->exponent; |
276
|
53
|
|
|
|
|
82
|
$self->score($score); |
277
|
53
|
50
|
|
|
|
72
|
$self->comments("Score=" . $self->score) if defined $self->score; |
278
|
53
|
|
|
|
|
111
|
$self->error($error); |
279
|
53
|
50
|
|
|
|
71
|
$self->comments("Error=" . $self->error) if defined $self->error; |
280
|
53
|
|
|
|
|
78
|
$self->repeats($repeats); |
281
|
53
|
|
|
|
|
85
|
$self->consensus($consensus); |
282
|
|
|
|
|
|
|
} |
283
|
|
|
|
|
|
|
|
284
|
|
|
|
|
|
|
1; |