EnsEMBL/KaryotypeBand.pm untested

filter: Statementstmt 0.0% 0 / 46 Branchbran 0.0% 0 / 4 Conditioncond 0.0% 0 / 2 Subroutinesub 0.0% 0 / 13 Podpod 0.0% 0 / 7 totaltotal 0.0% 0 / 72 CC 3 SCAR 11.2
CC
3
Cov
0%
name
6.0
stain
6.0
new
2.0
CRAP 3.1
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::DBSQL::KaryotypeBand
34  
35 =head1 SYNOPSIS
36  
37 use Bio::EnsEMBL::KaryotypeBand;
38  
39 # Create and populate a karyotype band (normally done by adaptor)
40 $kb = Bio::EnsEMBL::KaryotyeBand(
41 -START => 1,
42 -END => 1_000_000,
43 -SLICE => $chrX_slice,
44 -NAME => 'q31',
45 -STAIN => 'gpos50',
46 -ADAPTOR => $db->get_KaryotypeBandAdaptor(),
47 -DBID => 10
48 );
49  
50 # Can tranform this band into other coord systems, just like other
51 # features
52 $kb = $kb->transform('supercontig');
53  
54 $start = $kb->start();
55 $end = $kb->end();
56 $seq_region = $kb->slice->seq_region_name();
57  
58 # Karyotypes have internal ids as well
59 $kary_id = $kb->dbID();
60  
61 =head1 DESCRIPTION
62  
63 KaryotypeBand objects encapsulate data pertaining to a
64 single karyotype band. Access these objects through a
65 Bio::EnsEMBL::DBSQL::KaryotypeBandAdaptor.
66  
67 KarytoypeBand inherits from Bio::EnsEMBL::Feature and can be used just
68 as any other feature can be.
69  
70 =head1 METHODS
71  
72 =cut
73  
74 package Bio::EnsEMBL::KaryotypeBand;
75 $Bio::EnsEMBL::KaryotypeBand::VERSION = '114.0.0_50'; # TRIAL
76 $Bio::EnsEMBL::KaryotypeBand::VERSION = '114.0.050';
77 use strict;
78 use vars qw(@ISA);
79  
80 use Bio::EnsEMBL::Feature;
81 use Bio::EnsEMBL::Utils::Argument qw(rearrange);
82 use Bio::EnsEMBL::Utils::Exception qw(warning);
83  
84 @ISA = qw(Bio::EnsEMBL::Feature);
85  
86 use constant SEQUENCE_ONTOLOGY => {
87 acc => 'SO:0000341',
88 term => 'chromosome_band',
89 };
90  
91 =head2 new
92  
93 Arg [NAME] : string (optional)
94 The name of this band
95 Arg [STAIN]: string (optional)
96 The stain of this band
97 Arg [...] : Arguments passed to superclass constructor.
98 See Bio::EnsEMBL::Feature
99 Example : $kb = Bio::EnsEMBL::KaryotypeBand->new(-START => $start,
100 -END => $end,
101 -SLICE => $slice,
102 -NAME => 'q11.21',
103 -STAIN => 'gneg');
104 Description: Constructor. Creates a new KaryotypeBand object, which can be
105 treated as any other feature object. Note that karyotypes
106 bands always have strand = 0.
107 Returntype : Bio::EnsEMBL::KarytotypeBand
108 Exceptions : none
109 Caller : Bio::EnsEMBL::KaryotypeBandAdaptor
110 Status : Stable
111  
112 =cut
113  
114 sub new {
115 my $class = shift;
116  
117 my $self = $class->SUPER::new(@_);
118  
119 my ($name, $stain) = rearrange(['NAME','STAIN'],@_);
120 $self->{'name'} = $name;
121 $self->{'stain'} = $stain;
122 $self->{'strand'} = 0;
123  
124 return $self;
125 }
126  
127  
128 =head2 name
129  
130 Arg [1] : (optional) string $value
131 Example : my $band_name = $band->name();
132 Description: Getter/Setter for the name of this band
133 Returntype : string
134 Exceptions : none
135 Caller : general
136 Status : Stable
137  
138 =cut
139  
140 sub name{
141 my $self = shift;
142 $self->{'name'} = shift if(@_);
143 return $self->{'name'};
144 }
145  
146  
147  
148 =head2 stain
149  
150 Arg [1] : (optional) string $value
151 Example : my $band_stain = $band->stain();
152 Description: get/set for the band stain (e.g. 'gpos50')
153 Returntype : string
154 Exceptions : none
155 Caller : general
156 Status : Stable
157  
158 =cut
159  
160 sub stain{
161 my $self = shift;
162 $self->{'stain'} = shift if(@_);
163 return $self->{'stain'};
164 }
165  
166  
167  
168 =head2 strand
169  
170 Arg [1] : none
171 Example : $strand = $karyotype_feat->strand();
172 Description: Overrides the Feature strand method to always return a
173 value of 0 for karyotype features (they are unstranded features)
174 Returntype : int (always 0)
175 Exceptions : none
176 Caller : general
177 Status : Stable
178  
179 =cut
180  
181 sub strand {
182 my $self = shift;
183 return 0;
184 }
185  
186  
187 =head2 move
188  
189 Arg [1] : $start - The new end of this band
190 Arg [2] : $end - The new start of this band
191 Arg [3] : $strand - ignored always set to 0
192 Example : $kb->move(1, 10_000);
193 Description: Overrides superclass move() method to ensure strand is always 0.
194 See Bio::EnsEMBL::Feature::move
195 Returntype : none
196 Exceptions : none
197 Caller : general
198 Status : Stable
199  
200 =cut
201  
202 sub move {
203 my ($self, $start, $end, $strand) = @_;
204  
205 #maintain a strandedness of 0
206 return $self->SUPER::move($start,$end,0);
207 }
208  
209  
210 =head2 display_id
211  
212 Arg [1] : none
213 Example : print $kb->display_id();
214 Description: This method returns a string that is considered to be
215 the 'display' identifier. For karyotype bands this is the
216 name of the karyotype band or '' if no name is defined.
217 Returntype : string
218 Exceptions : none
219 Caller : web drawing code
220 Status : Stable
221  
222 =cut
223  
224 sub display_id {
225 my $self = shift;
226 return $self->{'name'} || '';
227 }
228  
229  
230 =head2 summary_as_hash
231  
232 Example : $karyotype_band_summary = $band->summary_as_hash();
233 Description : Extends Feature::summary_as_hash
234 Retrieves a summary of this Karyotype object.
235
236 Returns : hashref of arrays of descriptive strings
237 Status : Intended for internal use
238 =cut
239  
240 sub summary_as_hash {
241 my $self = shift;
242 my $summary_ref = $self->SUPER::summary_as_hash;
243 $summary_ref->{'stain'} = $self->stain;
244
245 return $summary_ref;
246 }
247  
248  
249 1;