| 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::Gap | ||
| 34 | |||
| 35 | =head1 SYNOPSIS | ||
| 36 | |||
| 37 | =head1 DESCRIPTION | ||
| 38 | |||
| 39 | Representation of a gap in a sequence; returned from Mapper.pm when the | ||
| 40 | target region is in a gap. | ||
| 41 | |||
| 42 | =head1 METHODS | ||
| 43 | |||
| 44 | =cut | ||
| 45 | |||
| 46 | package Bio::EnsEMBL::Mapper::Gap; | ||
| 47 | $Bio::EnsEMBL::Mapper::Gap::VERSION = '114.0.0_50'; # TRIAL | ||
| 48 | $Bio::EnsEMBL::Mapper::Gap::VERSION = '114.0.050'; | ||
| 49 | use strict; | ||
| 50 | |||
| 51 | =head2 new | ||
| 52 | |||
| 53 | Arg [1] : int $start | ||
| 54 | Arg [2] : int $end | ||
| 55 | Example : $gap = Bio::EnsEMBL::Mapper::Gap($start, $end); | ||
| 56 | Description: Creates a new Gap object. | ||
| 57 | Returntype : Bio::EnsEMBL::Mapper::Gap | ||
| 58 | Exceptions : none | ||
| 59 | Caller : Bio::EnsEMBL::Mapper | ||
| 60 | Status : Stable | ||
| 61 | |||
| 62 | =cut | ||
| 63 | |||
| 64 | sub new { | ||
| 65 | my ( $proto, $start, $end, $rank ) = @_; | ||
| 66 | |||
| 67 | my $class = ref($proto) || $proto; | ||
| 68 | |||
| 69 | return bless( { 'start' => $start, 'end' => $end, 'rank' => $rank || 0 }, $class ); | ||
| 70 | } | ||
| 71 | |||
| 72 | =head2 start | ||
| 73 | |||
| 74 | Arg [1] : (optional) int $start | ||
| 75 | start coordinate of gap region | ||
| 76 | Example : $start = $gap->start(); | ||
| 77 | Description: Getter/Setter for the start attribute | ||
| 78 | Returntype : int | ||
| 79 | Exceptions : none | ||
| 80 | Caller : general | ||
| 81 | Status : Stable | ||
| 82 | |||
| 83 | =cut | ||
| 84 | |||
| 85 | sub start { | ||
| 86 | my ( $self, $value ) = @_; | ||
| 87 | |||
| 88 | if ( defined($value) ) { | ||
| 89 | $self->{'start'} = $value; | ||
| 90 | } | ||
| 91 | |||
| 92 | return $self->{'start'}; | ||
| 93 | } | ||
| 94 | |||
| 95 | =head2 end | ||
| 96 | |||
| 97 | Arg [1] : (optional) int $newval | ||
| 98 | The new value to set the end coordinate to | ||
| 99 | Example : $end = $gap->end() | ||
| 100 | Description: Getter/Setter for the end coordinate of the gap region | ||
| 101 | Returntype : string | ||
| 102 | Exceptions : none | ||
| 103 | Caller : general | ||
| 104 | Status : Stable | ||
| 105 | |||
| 106 | =cut | ||
| 107 | |||
| 108 | sub end { | ||
| 109 | my ( $self, $value ) = @_; | ||
| 110 | |||
| 111 | if ( defined($value) ) { | ||
| 112 | $self->{'end'} = $value; | ||
| 113 | } | ||
| 114 | |||
| 115 | return $self->{'end'}; | ||
| 116 | } | ||
| 117 | |||
| 118 | =head2 length | ||
| 119 | |||
| 120 | Arg [1] : none | ||
| 121 | Example : $len = $gap->length(); | ||
| 122 | Description: Getter for the length of this gap region | ||
| 123 | Returntype : int | ||
| 124 | Exceptions : none | ||
| 125 | Caller : general | ||
| 126 | Status : Stable | ||
| 127 | |||
| 128 | =cut | ||
| 129 | |||
| 130 | sub length { | ||
| 131 | my ($self) = @_; | ||
| 132 | |||
| 133 | return $self->{'end'} - $self->{'start'} + 1; | ||
| 134 | } | ||
| 135 | |||
| 136 | sub rank { | ||
| 137 | my ( $self, $value ) = @_; | ||
| 138 | |||
| 139 | if ( defined($value) ) { | ||
| 140 | $self->{'rank'} = $value; | ||
| 141 | } | ||
| 142 | |||
| 143 | return $self->{'rank'}; | ||
| 144 | } | ||
| 145 | |||
| 146 | 1; |