ensembl-hive  2.7.0
Coordinate.pm
Go to the documentation of this file.
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 
34 
35 =head1 SYNOPSIS
36 
37 =head1 DESCRIPTION
38 
39 Representation of a mapped region in a sequence; returned from Mapper.pm
40 when the target region maps on to valid sequence.
41 
42 =head1 METHODS
43 
44 =cut
45 
46 package Bio::EnsEMBL::Mapper::Coordinate;
47 
48 use strict;
49 
50 =head2 new
51 
52  Arg [1] char|int id of object in mapped region
53  Arg [2] int start of region
54  Arg [3] int end of region
55  Arg [4] int strand if region
56  Arg [5] Bio::EnsEMBL::CoordSystem coordsytem of the region
57  Function creates a new Coordinate object
59  Exceptions none
60  Status Stable
61 
62 =cut
63 
64 sub new {
65  my ( $proto, $id, $start, $end, $strand, $coord_system, $rank ) = @_;
66 
67  my $class = ref($proto) || $proto;
68 
69  return
70  bless( { 'id' => $id,
71  'start' => $start,
72  'end' => $end,
73  'strand' => $strand,
74  'coord_system' => $coord_system,
75  'rank' => $rank || 0
76  },
77  $class );
78 }
79 
80 
81 =head2 start
82 
83  Arg 1 int $start
84  start coordinate of object in mapped region
85  Function getter/setter method
86  Returntype int
87  Exceptions none
89  Status Stable
90 
91 =cut
92 
93 sub start {
94  my ( $self, $value ) = @_;
95 
96  if ( defined($value) ) {
97  $self->{'start'} = $value;
98  }
99 
100  return $self->{'start'};
101 }
102 
103 
104 =head2 end
105 
106  Arg 1 int $end
107  end coordinate of object in mapped region
108  Function getter/setter method
109  Returntype int
110  Exceptions none
112  Status Stable
113 
114 =cut
115 
116 sub end {
117  my ( $self, $value ) = @_;
118 
119  if ( defined($value) ) {
120  $self->{'end'} = $value;
121  }
122 
123  return $self->{'end'};
124 }
125 
126 =head2 strand
127 
128  Arg 1 int $strand
129  strand of object in mapped region
130  Function getter/setter method
131  Returntype int
132  Exceptions none
134  Status Stable
135 
136 =cut
137 
138 sub strand {
139  my ( $self, $value ) = @_;
140 
141  if ( defined($value) ) {
142  $self->{'strand'} = $value;
143  }
144 
145  return $self->{'strand'};
146 }
147 
148 =head2 id
149 
150  Arg 1 char|int $id
151  id of object in mapped region
152  e.g. seq_region_id
153  Function getter/setter method
154  Returntype char|int
155  Exceptions none
157  Status Stable
158 
159 =cut
160 
161 sub id {
162  my ( $self, $value ) = @_;
163 
164  if ( defined($value) ) {
165  $self->{'id'} = $value;
166  }
167 
168  return $self->{'id'};
169 }
170 
171 =head2 name
172 
173  Arg 1 char name
174  name of object in mapped region
175  e.g. seq_region_name
176  Function getter/setter method
177  Returntype char
178  Exceptions none
180  Status Stable
181 
182 =cut
183 
184 sub name {
185  my ( $self, $value ) = @_;
186 
187  if ( defined($value) ) {
188  $self->{'name'} = $value;
189  }
190 
191  return $self->{'name'};
192 }
193 
194 =head2 coord_system
195 
197  Function getter/setter method
198  Returntype Bio::EnsEMBL::CoordSystem
199  Exceptions none
201  Status Stable
202 
203 =cut
204 
205 sub coord_system {
206  my ( $self, $value ) = @_;
207 
208  if ( defined($value) ) {
209  $self->{'coord_system'} = $value;
210  }
211 
212  return $self->{'coord_system'};
213 }
214 
215 =head2 length
216 
217  Function getter method
218  Returntype int
219  Exceptions none
220  Caller ?
221  Status Stable
222 
223 =cut
224 
225 sub length {
226  my ($self) = @_;
227 
228  return $self->{'end'} - $self->{'start'} + 1;
229 }
230 
231 sub rank {
232  my ( $self, $value ) = @_;
233 
234  if ( defined($value) ) {
235  $self->{'rank'} = $value;
236  }
237 
238  return $self->{'rank'};
239 }
240 
241 1;
Bio::EnsEMBL::Mapper::Coordinate
Definition: Coordinate.pm:14
Bio::EnsEMBL::Mapper
Definition: Mapper.pm:117
Bio::EnsEMBL::CoordSystem
Definition: CoordSystem.pm:40