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