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