ensembl-hive  2.7.0
IndelCoordinate.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 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 
50 
51 use vars qw(@ISA);
52 use strict;
53 
55 
56 
57 =head2 new
58 
59  Arg [1] : Bio::EnsEMBL::Mapper::Gap $gap
60  Arg [2] : Bio::EnsEMBL::Mapper::Coordinate $coordinate
61  Example : $indelCoord = Bio::EnsEMBL::Mapper::IndelCoordinate($gap, $coordinate);
62  Description: Creates a new IndelCoordinate object.
64  Exceptions : none
65  Caller : Bio::EnsEMBL::Mapper
66 
67 =cut
68 
69 sub new {
70  my ( $proto, $gap, $coordinate ) = @_;
71 
72  my $class = ref($proto) || $proto;
73 
74  return
75  bless( { 'start' => $coordinate->start(),
76  'end' => $coordinate->end(),
77  'strand' => $coordinate->strand(),
78  'id' => $coordinate->id(),
79  'coord_system' => $coordinate->coord_system(),
80  'gap_start' => $gap->start(),
81  'gap_end' => $gap->end()
82  },
83  $class );
84 }
85 
86 =head2 gap_start
87 
88  Arg[1] : (optional) int $gap_start
89  Example : $gap_start = $ic->gap_start()
90  Description : Getter/Setter for the start of the Gap region
91  ReturnType : int
92  Exceptions : none
93  Caller : general
94 
95 =cut
96 
97 sub gap_start {
98  my ( $self, $value ) = @_;
99 
100  if ( defined($value) ) {
101  $self->{'gap_start'} = $value;
102  }
103 
104  return $self->{'gap_start'};
105 }
106 
107 =head2 gap_end
108 
109  Arg[1] : (optional) int $gap_end
110  Example : $gap_end = $ic->gap_end()
111  Description : Getter/Setter for the end of the Gap region
112  ReturnType : int
113  Exceptions : none
114  Caller : general
115 
116 =cut
117 
118 sub gap_end {
119  my ( $self, $value ) = @_;
120 
121  if ( defined($value) ) {
122  $self->{'gap_end'} = $value;
123  }
124 
125  return $self->{'gap_end'};
126 }
127 
128 =head2 gap_length
129 
130  Args : None
131  Example : $gap_length = $ic->gap_length()
132  Description : Getter for the length of the Gap region
133  ReturnType : int
134  Exceptions : none
135  Caller : general
136 
137 =cut
138 
139 sub gap_length {
140  my ($self) = @_;
141 
142  return $self->{'gap_end'} - $self->{'gap_start'} + 1;
143 }
144 
145 1;
Bio::EnsEMBL::Mapper::IndelCoordinate
Definition: IndelCoordinate.pm:16
Bio::EnsEMBL::Mapper::Coordinate
Definition: Coordinate.pm:14
Bio::EnsEMBL::Mapper
Definition: Mapper.pm:117
Bio::EnsEMBL::Mapper::Gap
Definition: Gap.pm:14
Bio::EnsEMBL::Mapper
Definition: Coordinate.pm:3