0
|
1 =head1 LICENSE
|
|
2
|
|
3 Copyright (c) 1999-2012 The European Bioinformatics Institute and
|
|
4 Genome Research Limited. All rights reserved.
|
|
5
|
|
6 This software is distributed under a modified Apache license.
|
|
7 For license details, please see
|
|
8
|
|
9 http://www.ensembl.org/info/about/code_licence.html
|
|
10
|
|
11 =head1 CONTACT
|
|
12
|
|
13 Please email comments or questions to the public Ensembl
|
|
14 developers list at <dev@ensembl.org>.
|
|
15
|
|
16 Questions may also be sent to the Ensembl help desk at
|
|
17 <helpdesk@ensembl.org>.
|
|
18
|
|
19 =head1 NAME
|
|
20
|
|
21 Bio::EnsEMBL::Compara::DnaFragRegion - dnafrag region on one species
|
|
22
|
|
23 =head1 SYNOPSIS
|
|
24
|
|
25 my $slice = $dnafrag_region->slice;
|
|
26 my $dnafrag = $dnafrag_region->dnafrag;
|
|
27 my $genome_db = $dnafrag_region->genome_db;
|
|
28 my $dnafrag_start = $dnafrag_region->dnafrag_start;
|
|
29 my $dnafrag_end = $dnafrag_region->dnafrag_end;
|
|
30 my $dnafrag_strand = $dnafrag_region->dnafrag_strand;
|
|
31 my $length = $dnafrag_region->length;
|
|
32
|
|
33 =head1 DESCRIPTION
|
|
34
|
|
35 DnaFragRegion are the objects underlying the SyntenyRegion objects. Each synteny is
|
|
36 represented as a Bio::EnsEMBL::Compara::SyntenyRegion object. Each of these objects
|
|
37 contain one Bio::EnsEMBL::Compara::DnaFragRegion object per region which defines the
|
|
38 synteny. For instance, for a syntenic region between human and mouse, there will be
|
|
39 one DnaFragRegion object for the human region and another one for the mouse one.
|
|
40
|
|
41 =head1 OBJECT ATTRIBUTES
|
|
42
|
|
43 =over
|
|
44
|
|
45 =item adaptor
|
|
46
|
|
47 Bio::EnsEMBL::Compara::DBSQL::DnaFragRegionAdaptor object to access DB
|
|
48
|
|
49 =item synteny_region_id
|
|
50
|
|
51 corresponds to dnafrag.synteny_region_id (external ref.)
|
|
52
|
|
53 =item dnafrag_id
|
|
54
|
|
55 corresponds to dnafrag.dnafrag_id (external ref.)
|
|
56
|
|
57 =item dnafrag
|
|
58
|
|
59 Bio::EnsEMBL::Compara::DnaFrag object corresponding to dnafrag_id
|
|
60
|
|
61 =item dnafrag_start
|
|
62
|
|
63 corresponds to dnafrag_region.dnafrag_start
|
|
64
|
|
65 =item dnafrag_end
|
|
66
|
|
67 corresponds to dnafrag_region.dnafrag_end
|
|
68
|
|
69 =item dnafrag_strand
|
|
70
|
|
71 corresponds to dnafrag_region.dnafrag_strand
|
|
72
|
|
73 =back
|
|
74
|
|
75 =head1 APPENDIX
|
|
76
|
|
77 The rest of the documentation details each of the object methods. Internal methods are usually preceded with a _
|
|
78
|
|
79 =cut
|
|
80
|
|
81
|
|
82 package Bio::EnsEMBL::Compara::DnaFragRegion;
|
|
83
|
|
84 use strict;
|
|
85 use Bio::EnsEMBL::Utils::Argument;
|
|
86 use Bio::EnsEMBL::Utils::Exception;
|
|
87
|
|
88 #use Bio::EnsEMBL::Compara::NestedSet;
|
|
89 #our @ISA = qw(Bio::EnsEMBL::Compara::NestedSet);
|
|
90
|
|
91
|
|
92 =head2 new_fast
|
|
93
|
|
94 Arg : possible keys: ADAPTOR, SYNTENY_REGION_ID, DNAFRAG_ID,
|
|
95 DNAFRAG_START, DNAFRAG_END, DNAFRAG_STRAND
|
|
96 See also parent object: Bio::EnsEMBL::Compara::NestedSet
|
|
97 Example : none
|
|
98 Description : Object constructor.
|
|
99 Returntype : Bio::EnsEMBL::Compara::DnaFragRegion object
|
|
100 Exceptions : none
|
|
101 Caller : general
|
|
102
|
|
103 =cut
|
|
104
|
|
105 sub new {
|
|
106 my ($class, @args) = @_;
|
|
107 # my $self = $class->SUPER::new(@args);
|
|
108 my $self = bless {}, $class;
|
|
109
|
|
110 if (scalar @args) {
|
|
111 #do this explicitly.
|
|
112 my ($adaptor, $synteny_region_id, $dnafrag_id, $dnafrag_start, $dnafrag_end, $dnafrag_strand) = rearrange([qw(ADAPTOR SYNTENY_REGION_ID DNAFRAG_ID DNAFRAG_START DNAFRAG_END DNAFRAG_STRAND)], @args);
|
|
113
|
|
114 $adaptor && $self->adaptor($adaptor);
|
|
115 $synteny_region_id && $self->synteny_region_id($synteny_region_id);
|
|
116 $dnafrag_id && $self->dnafrag_id($dnafrag_id);
|
|
117 $dnafrag_start && $self->dnafrag_start($dnafrag_start);
|
|
118 $dnafrag_end && $self->dnafrag_end($dnafrag_end);
|
|
119 $dnafrag_strand && $self->dnafrag_strand($dnafrag_strand);
|
|
120 }
|
|
121
|
|
122 return $self;
|
|
123 }
|
|
124
|
|
125
|
|
126 =head2 new_fast
|
|
127
|
|
128 Arg 1 : hash reference $hashref
|
|
129 Example : none
|
|
130 Description : This is an ultra fast constructor which requires knowledge of
|
|
131 the objects internals to be used.
|
|
132 Returntype : Bio::EnsEMBL::Compara::DnaFragRegion object
|
|
133 Exceptions : none
|
|
134 Caller : general
|
|
135
|
|
136 =cut
|
|
137
|
|
138 sub new_fast {
|
|
139 my ($class, $hashref) = @_;
|
|
140
|
|
141 return bless $hashref, $class;
|
|
142 }
|
|
143
|
|
144
|
|
145 =head2 synteny_region_id
|
|
146
|
|
147 Arg 1 : (optional) integer $synteny_region_id
|
|
148 Example : my $synteny_region_id = $dnafrag->synteny_region_id;
|
|
149 Description : Getter/setter for the synteny_region_id attribute
|
|
150 Returntype : integer
|
|
151 Exceptions : none
|
|
152 Caller : general
|
|
153
|
|
154 =cut
|
|
155
|
|
156 sub synteny_region_id {
|
|
157 my $obj = shift;
|
|
158
|
|
159 if (@_) {
|
|
160 my $value = shift;
|
|
161 $obj->{'synteny_region_id'} = $value;
|
|
162 }
|
|
163
|
|
164 return $obj->{'synteny_region_id'};
|
|
165 }
|
|
166
|
|
167
|
|
168 =head2 dnafrag_id
|
|
169
|
|
170 Arg 1 : (optional) integer $dnafrag_id
|
|
171 Example : my $dnafrag_id = $dnafrag->dnafrag_id;
|
|
172 Description : Getter/setter for the dnafrag_id attribute
|
|
173 Returntype : integer
|
|
174 Exceptions : none
|
|
175 Caller : general
|
|
176
|
|
177 =cut
|
|
178
|
|
179 sub dnafrag_id {
|
|
180 my $obj = shift;
|
|
181
|
|
182 if (@_) {
|
|
183 my $value = shift;
|
|
184 $obj->{'dnafrag_id'} = $value;
|
|
185 }
|
|
186
|
|
187 return $obj->{'dnafrag_id'};
|
|
188 }
|
|
189
|
|
190
|
|
191 =head2 dnafrag_start
|
|
192
|
|
193 Arg 1 : (optional) integer $dnafrag_start
|
|
194 Example : my $dnafrag_start = $dnafrag->dnafrag_start;
|
|
195 Description : Getter/setter for the dnafrag_start attribute
|
|
196 Returntype : integer
|
|
197 Exceptions : none
|
|
198 Caller : general
|
|
199
|
|
200 =cut
|
|
201
|
|
202 sub dnafrag_start {
|
|
203 my $obj = shift;
|
|
204
|
|
205 if (@_) {
|
|
206 my $value = shift;
|
|
207 $obj->{'dnafrag_start'} = $value;
|
|
208 }
|
|
209
|
|
210 return $obj->{'dnafrag_start'};
|
|
211 }
|
|
212
|
|
213
|
|
214 =head2 dnafrag_end
|
|
215
|
|
216 Arg 1 : (optional) integer $dnafrag_end
|
|
217 Example : my $dnafrag_end = $dnafrag->dnafrag_end;
|
|
218 Description : Getter/setter for the dnafrag_end attribute
|
|
219 Returntype : integer
|
|
220 Exceptions : none
|
|
221 Caller : general
|
|
222
|
|
223 =cut
|
|
224
|
|
225 sub dnafrag_end {
|
|
226 my $obj = shift;
|
|
227
|
|
228 if (@_) {
|
|
229 my $value = shift;
|
|
230 $obj->{'dnafrag_end'} = $value;
|
|
231 }
|
|
232
|
|
233 return $obj->{'dnafrag_end'};
|
|
234 }
|
|
235
|
|
236
|
|
237 =head2 dnafrag_strand
|
|
238
|
|
239 Arg 1 : (optional) integer $dnafrag_strand
|
|
240 Example : my $dnafrag_strand = $dnafrag->dnafrag_strand;
|
|
241 Description : Getter/setter for the dnafrag_strand attribute
|
|
242 Returntype : integer (1 or -1)
|
|
243 Exceptions : none
|
|
244 Caller : general
|
|
245
|
|
246 =cut
|
|
247
|
|
248 sub dnafrag_strand {
|
|
249 my $obj = shift;
|
|
250
|
|
251 if (@_) {
|
|
252 my $value = shift;
|
|
253 $obj->{'dnafrag_strand'} = $value;
|
|
254 }
|
|
255
|
|
256 return $obj->{'dnafrag_strand'};
|
|
257 }
|
|
258
|
|
259
|
|
260 =head2 adaptor
|
|
261
|
|
262 Arg 1 : (optional) Bio::EnsEMBL::Compara::DBSQL::DnaFragRegioAdaptor $adaptor
|
|
263 Example : my $adaptor = $dnafrag->adaptor;
|
|
264 Description : Getter/setter for the corresponding
|
|
265 Bio::EnsEMBL::Compara::DBSQL::DnaFragRegioAdaptor object
|
|
266 Returntype : Bio::EnsEMBL::Compara::DBSQL::DnaFragRegioAdaptor object
|
|
267 Exceptions : none
|
|
268 Caller : general
|
|
269
|
|
270 =cut
|
|
271
|
|
272 sub adaptor {
|
|
273 my $obj = shift;
|
|
274
|
|
275 if (@_) {
|
|
276 my $value = shift;
|
|
277 $obj->{'adaptor'} = $value;
|
|
278 }
|
|
279
|
|
280 return $obj->{'adaptor'};
|
|
281 }
|
|
282
|
|
283
|
|
284 =head2 dnafrag
|
|
285
|
|
286 Arg 1 : (optional) Bio::EnsEMBL::Compara::DnaFrag object
|
|
287 Example : $dnafrag = $dnafragregion->dnafrag;
|
|
288 Description : Getter/setter for the Bio::EnsEMBL::Compara::DnaFrag object corresponding to this
|
|
289 Bio::EnsEMBL::Compara::DnaFragRegion object.
|
|
290 Returntype : Bio::EnsEMBL::Compara::Dnafrag object
|
|
291 Exceptions : warns when the corresponding Bio::EnsEMBL::Compara::GenomeDB,
|
|
292 coord_system_name, name or Bio::EnsEMBL::DBSQL::DBAdaptor
|
|
293 cannot be retrieved and returns undef.
|
|
294 Caller : $object->methodname
|
|
295
|
|
296 =cut
|
|
297
|
|
298 sub dnafrag {
|
|
299 my ($self) = shift @_;
|
|
300
|
|
301 if (@_) {
|
|
302 $self->{'_dnafrag'} = shift @_;
|
|
303 } elsif (!defined $self->{'_dnafrag'}) {
|
|
304 if (!defined($self->dnafrag_id)) {
|
|
305 warn "Cannot get the Bio::EnsEMBL::Compara::DnaFrag object without dbID";
|
|
306 return undef;
|
|
307 }
|
|
308 my $dfa = $self->adaptor->db->get_DnaFragAdaptor;
|
|
309 if (!defined($dfa)) {
|
|
310 warn "Cannot get the Bio::EnsEMBL::Compara::DBSQL::DnaFragAdaptor";
|
|
311 return undef;
|
|
312 }
|
|
313 $self->{'_dnafrag'} = $dfa->fetch_by_dbID($self->dnafrag_id);
|
|
314 }
|
|
315 return $self->{'_dnafrag'};
|
|
316 }
|
|
317
|
|
318
|
|
319 =head2 slice
|
|
320
|
|
321 Arg 1 : -none-
|
|
322 Example : $slice = $dnafragregion->slice;
|
|
323 Description : Returns the Bio::EnsEMBL::Slice object corresponding to this
|
|
324 Bio::EnsEMBL::Compara::DnaFrag object.
|
|
325 Returntype : Bio::EnsEMBL::Slice object
|
|
326 Exceptions : warns when the corresponding Bio::EnsEMBL::Compara::GenomeDB,
|
|
327 coord_system_name, name or Bio::EnsEMBL::DBSQL::DBAdaptor
|
|
328 cannot be retrieved and returns undef.
|
|
329 Caller : $object->methodname
|
|
330
|
|
331 =cut
|
|
332
|
|
333 sub slice {
|
|
334 my ($self) = @_;
|
|
335
|
|
336 unless (defined $self->{'_slice'}) {
|
|
337 if (!defined($self->dnafrag->genome_db)) {
|
|
338 warn "Cannot get the Bio::EnsEMBL::Compara::GenomeDB object corresponding to [".$self."]";
|
|
339 return undef;
|
|
340 }
|
|
341 if (!defined($self->dnafrag->coord_system_name)) {
|
|
342 warn "Cannot get the coord_system_name corresponding to [".$self."]";
|
|
343 return undef;
|
|
344 }
|
|
345 if (!defined($self->dnafrag->name)) {
|
|
346 warn "Cannot get the name corresponding to [".$self."]";
|
|
347 return undef;
|
|
348 }
|
|
349 my $dba = $self->dnafrag->genome_db->db_adaptor;
|
|
350 if (!defined($dba)) {
|
|
351 warn "Cannot get the Bio::EnsEMBL::DBSQL::DBAdaptor corresponding to [".$self->dnafrag->genome_db."]";
|
|
352 return undef;
|
|
353 }
|
|
354 $self->{'_slice'} = $dba->get_SliceAdaptor->fetch_by_region($self->dnafrag->coord_system_name, $self->dnafrag->name,$self->dnafrag_start, $self->dnafrag_end, $self->dnafrag_strand);
|
|
355 }
|
|
356
|
|
357 return $self->{'_slice'};
|
|
358 }
|
|
359
|
|
360
|
|
361 =head2 genome_db
|
|
362
|
|
363 Arg 1 : -none-
|
|
364 Example : $genome_db = $dnafragregion->genome_db;
|
|
365 Description : Returns the Bio::EnsEMBL::Compara::GenomeDB object corresponding to this
|
|
366 Bio::EnsEMBL::Compara::DnaFragRegion object. This method is a shortcut
|
|
367 for $dnafragregion->dnafrag->genome_db
|
|
368 Returntype : Bio::EnsEMBL::Compara::GenomeDB object
|
|
369 Exceptions : return undef if no dnafrag can be found for this DnaFragRegion object.
|
|
370 See dnafrag method elsewhere in this document.
|
|
371 Caller : $object->methodname
|
|
372
|
|
373 =cut
|
|
374
|
|
375 sub genome_db {
|
|
376 my ($self) = @_;
|
|
377
|
|
378 if ($self->dnafrag) {
|
|
379 return $self->dnafrag->genome_db;
|
|
380 }
|
|
381
|
|
382 return undef;
|
|
383 }
|
|
384
|
|
385
|
|
386 =head2 length
|
|
387
|
|
388 Arg 1 : -none-
|
|
389 Example : $length = $dnafragregion->length;
|
|
390 Description : Returns the lenght of this DnaFragRegion
|
|
391 Returntype : integer
|
|
392 Exceptions :
|
|
393 Caller : $object->methodname
|
|
394
|
|
395 =cut
|
|
396
|
|
397 sub length {
|
|
398 my ($self) = @_;
|
|
399
|
|
400 return $self->dnafrag_end - $self->dnafrag_start + 1;
|
|
401 }
|
|
402
|
|
403 1;
|