EnsEMBL/RepeatFeature.pm untested

filter: Statementstmt 0.0% 0 / 62 Branchbran 0.0% 0 / 14 Conditioncond 0.0% 0 / 6 Subroutinesub 0.0% 0 / 13 Podpod 0.0% 0 / 8 totaltotal 0.0% 0 / 103 CC 8 SCAR 19.7
CC
8
Cov
0%
repeat_consensus
20.0
hstart
6.0
score
6.0
CRAP 7.2
1 =head1 LICENSE
2  
3 See the NOTICE file distributed with this work for additional information
4 regarding copyright ownership.
5  
6 Licensed under the Apache License, Version 2.0 (the "License");
7 you may not use this file except in compliance with the License.
8 You may obtain a copy of the License at
9  
10 http://www.apache.org/licenses/LICENSE-2.0
11  
12 Unless required by applicable law or agreed to in writing, software
13 distributed under the License is distributed on an "AS IS" BASIS,
14 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 See the License for the specific language governing permissions and
16 limitations under the License.
17  
18 =cut
19  
20  
21 =head1 CONTACT
22  
23 Please email comments or questions to the public Ensembl
24 developers list at <http://lists.ensembl.org/mailman/listinfo/dev>.
25  
26 Questions may also be sent to the Ensembl help desk at
27 <http://www.ensembl.org/Help/Contact>.
28  
29 =cut
30  
31 =head1 NAME
32  
33 Bio::EnsEMBL::RepeatFeature - A feature representing a repeat on a piece of
34 sequence.
35  
36 =head1 SYNOPSIS
37  
38 my $rf = new Bio::EnsEMBL::Feature(
39 -start => 100,
40 -end => 220,
41 -strand => -1,
42 -slice => $slice,
43 -analysis => $analysis,
44 -repeat_consensus => $rc,
45 -hstart => 10,
46 -hend => 100,
47 -hstrand => 1,
48 -score => 83.2
49 );
50  
51 my $hstart = $feat->hstart;
52 my $hend = $feat->hend;
53  
54 # move the feature to the chromosomal coordinate system
55 $feature = $feature->transform('chromosome');
56  
57 # move the feature to a different slice
58 # (possibly on another coord system)
59 $feature = $feature->transfer($new_slice);
60  
61 # project the feature onto another coordinate system possibly across
62 # boundaries:
63 @projection = @{ $feature->project('contig') };
64  
65 # change the start, end, and strand of the feature in place
66 $feature->move( $new_start, $new_end, $new_strand );
67  
68 =head1 DESCRIPTION
69  
70 This a feature representing a repeat region on a sequence
71  
72 =head1 METHODS
73  
74 =cut
75  
76 package Bio::EnsEMBL::RepeatFeature;
77 $Bio::EnsEMBL::RepeatFeature::VERSION = '114.0.0_50'; # TRIAL
78 $Bio::EnsEMBL::RepeatFeature::VERSION = '114.0.050';
79 use strict;
80  
81 use Bio::EnsEMBL::Utils::Exception qw(throw);
82 use Bio::EnsEMBL::Utils::Argument qw(rearrange);
83  
84 use base qw/Bio::EnsEMBL::Feature/;
85  
86 use constant SEQUENCE_ONTOLOGY => {
87 acc => 'SO:0000657',
88 term => 'repeat_region',
89 };
90  
91 =head2 new
92  
93 Arg [REPEAT_CONSENSUS] : Bio::EnsEMBL::RepeatConsensus (optional)
94 The repeat consensus for this repeat feature
95 Arg [HSTART] : int (optional)
96 The hit start on the consensus sequence
97 Arg [HEND] : int (optional)
98 The hit end on the consensus sequence
99 Arg [SCORE] : float (optional)
100 The score
101 Arg [...] : Named arguments to superclass constructor
102 (see Bio::EnsEMBL::Feaure)
103 Example : $rf = Bio::EnsEMBL::RepeatFeature->new(-REPEAT_CONSENSUS => $rc,
104 -HSTART => 10,
105 -HEND => 100,
106 -SCORE => 58.0,
107 -START => 1_000_100,
108 -END => 1_000_190,
109 -STRAND => 1,
110 -ANALYSIS => $an,
111 -SLICE => $chr_slice);
112 Description: Creates a new Bio::EnsEMBL::RepeatFeature object
113 Returntype : Bio::EnsEMBL::RepeatFeature
114 Exceptions : none
115 Caller : RepeatFeatureAdaptors
116 Status : Stable
117  
118 =cut
119  
120 sub new {
121 my $caller = shift;
122  
123 my $class = ref($caller) || $caller;
124  
125 my $self = $class->SUPER::new(@_);
126  
127 my ($repeat_consensus, $hstart, $hend, $score) =
128 rearrange(['REPEAT_CONSENSUS','HSTART','HEND','SCORE'], @_);
129  
130 $self->repeat_consensus($repeat_consensus);
131 $self->{'hstart'} = $hstart;
132 $self->{'hend'} = $hend;
133 $self->{'score'} = $score;
134  
135 return $self;
136 }
137  
138  
139 =head2 repeat_consensus
140  
141 Arg [1] : (optional) Bio::EnsEMBL::RepeatConsensus
142 Example : $repeat_consensus = $repeat->repeat_consensus;
143 Description: Getter/Setter for the repeat consensus of this repeat
144 Returntype : Bio::EnsEMBL::RepeatConsensus
145 Exceptions : none
146 Caller : general
147 Status : Stable
148  
149 =cut
150  
151 sub repeat_consensus {
152 my $self = shift;
153  
154 if(@_) {
155 my $rc = shift;
156 if(defined($rc)) {
157 if(!ref($rc) || !$rc->isa('Bio::EnsEMBL::RepeatConsensus')) {
158 throw('RepeatConsensus arg must be a Bio::EnsEMBL::RepeatConsensus');
159 }
160 }
161 $self->{'repeat_consensus'} = $rc;
162 }
163  
164 return $self->{'repeat_consensus'};
165 }
166  
167  
168  
169 =head2 hstart
170  
171 Arg [1] : (optional) int $hstart
172 Example : $hit_start = $repeat->hstart;
173 Description: Getter/Setter for the start bp of this repeat match on the
174 consensus sequence.
175 Returntype : int
176 Exceptions : none
177 Caller : general
178 Status : Stable
179  
180 =cut
181  
182 sub hstart {
183 my $self = shift;
184 $self->{'hstart'} = shift if(@_);
185 return $self->{'hstart'};
186 }
187  
188  
189 =head2 score
190  
191 Arg [1] : (optional) float $score
192 Example : $score = $repeat->score();
193 Description: Getter/Setter for the score of this repeat feature
194 Returntype : int
195 Exceptions : none
196 Caller : general
197 Status : Stable
198  
199 =cut
200  
201 sub score {
202 my $self = shift;
203 $self->{'score'} = shift if(@_);
204 return $self->{'score'};
205 }
206  
207  
208  
209 =head2 hend
210  
211 Arg [1] : (optional) int $hend
212 Example : $hit_end = $repeat->hend;
213 Description: Getter/Setter for the end bp of this repeat match on the
214 consensus sequence.
215 Returntype : int
216 Exceptions : none
217 Caller : general
218 Status : Stable
219  
220 =cut
221  
222 sub hend {
223 my $self = shift;
224 $self->{'hend'} = shift if(@_);
225 return $self->{'hend'};
226 }
227  
228  
229  
230 =head2 hstrand
231  
232 Arg [1] : none
233 Example : none
234 Description: always returns 1. method exists for consistancy with other
235 features.
236 Returntype : int
237 Exceptions : none
238 Caller : general
239 Status : Stable
240  
241 =cut
242  
243 sub hstrand {
244 return 1;
245 }
246  
247  
248 =head2 display_id
249  
250 Arg [1] : none
251 Example : print $rf->display_id();
252 Description: This method returns a string that is considered to be
253 the 'display' identifier. For repeat_features this is the
254 name of the repeat consensus if it is available otherwise it is
255 an empty string.
256 Returntype : string
257 Exceptions : none
258 Caller : web drawing code
259 Status : Stable
260  
261 =cut
262  
263 sub display_id {
264 my $self = shift;
265  
266 my $id = '';
267  
268 my $rc = $self->{'repeat_consensus'};
269 if($rc) {
270 $id = $rc->name();
271 }
272  
273 return $id;
274 }
275  
276  
277 =head2 summary_as_hash
278  
279 Example : $repeat_feature_summary = $protein_feature->summary_as_hash();
280 Description : Retrieves a textual summary of this Repeat feature.
281 Not inherited from Feature.
282 Returns : hashref of arrays of descriptive strings
283 Status : Intended for internal use
284 =cut
285  
286 sub summary_as_hash {
287 my $self = shift;
288 my %summary;
289 $summary{'start'} = $self->seq_region_start;
290 $summary{'end'} = $self->seq_region_end;
291 $summary{'strand'} = $self->strand;
292 $summary{'seq_region_name'} = $self->seq_region_name;
293 $summary{'description'} = $self->display_id;
294 $summary{'assembly_name'} = $self->slice->coord_system->version();
295 return \%summary;
296 }
297  
298  
299  
300 1;
301  
302 __END__