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