Mercurial > repos > mahtabm > ensembl
comparison variant_effect_predictor/Bio/EnsEMBL/Mapper/Gap.pm @ 0:1f6dce3d34e0
Uploaded
author | mahtabm |
---|---|
date | Thu, 11 Apr 2013 02:01:53 -0400 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:1f6dce3d34e0 |
---|---|
1 =head1 LICENSE | |
2 | |
3 Copyright (c) 1999-2012 The European Bioinformatics Institute and | |
4 Genome Research Limited. All rights reserved. | |
5 | |
6 This software is distributed under a modified Apache license. | |
7 For license details, please see | |
8 | |
9 http://www.ensembl.org/info/about/code_licence.html | |
10 | |
11 =head1 CONTACT | |
12 | |
13 Please email comments or questions to the public Ensembl | |
14 developers list at <dev@ensembl.org>. | |
15 | |
16 Questions may also be sent to the Ensembl help desk at | |
17 <helpdesk@ensembl.org>. | |
18 | |
19 =cut | |
20 | |
21 =head1 NAME | |
22 | |
23 Bio::EnsEMBL::Mapper::Gap | |
24 | |
25 =head1 SYNOPSIS | |
26 | |
27 =head1 DESCRIPTION | |
28 | |
29 Representation of a gap in a sequence; returned from Mapper.pm when the | |
30 target region is in a gap. | |
31 | |
32 =head1 METHODS | |
33 | |
34 =cut | |
35 | |
36 package Bio::EnsEMBL::Mapper::Gap; | |
37 | |
38 use strict; | |
39 | |
40 =head2 new | |
41 | |
42 Arg [1] : int $start | |
43 Arg [2] : int $end | |
44 Example : $gap = Bio::EnsEMBL::Mapper::Gap($start, $end); | |
45 Description: Creates a new Gap object. | |
46 Returntype : Bio::EnsEMBL::Mapper::Gap | |
47 Exceptions : none | |
48 Caller : Bio::EnsEMBL::Mapper | |
49 Status : Stable | |
50 | |
51 =cut | |
52 | |
53 sub new { | |
54 my ( $proto, $start, $end, $rank ) = @_; | |
55 | |
56 my $class = ref($proto) || $proto; | |
57 | |
58 return bless( { 'start' => $start, 'end' => $end, 'rank' => $rank || 0 }, $class ); | |
59 } | |
60 | |
61 =head2 start | |
62 | |
63 Arg [1] : (optional) int $start | |
64 start coordinate of gap region | |
65 Example : $start = $gap->start(); | |
66 Description: Getter/Setter for the start attribute | |
67 Returntype : int | |
68 Exceptions : none | |
69 Caller : general | |
70 Status : Stable | |
71 | |
72 =cut | |
73 | |
74 sub start { | |
75 my ( $self, $value ) = @_; | |
76 | |
77 if ( defined($value) ) { | |
78 $self->{'start'} = $value; | |
79 } | |
80 | |
81 return $self->{'start'}; | |
82 } | |
83 | |
84 =head2 end | |
85 | |
86 Arg [1] : (optional) int $newval | |
87 The new value to set the end coordinate to | |
88 Example : $end = $gap->end() | |
89 Description: Getter/Setter for the end coordinate of the gap region | |
90 Returntype : string | |
91 Exceptions : none | |
92 Caller : general | |
93 Status : Stable | |
94 | |
95 =cut | |
96 | |
97 sub end { | |
98 my ( $self, $value ) = @_; | |
99 | |
100 if ( defined($value) ) { | |
101 $self->{'end'} = $value; | |
102 } | |
103 | |
104 return $self->{'end'}; | |
105 } | |
106 | |
107 =head2 length | |
108 | |
109 Arg [1] : none | |
110 Example : $len = $gap->length(); | |
111 Description: Getter for the length of this gap region | |
112 Returntype : int | |
113 Exceptions : none | |
114 Caller : general | |
115 Status : Stable | |
116 | |
117 =cut | |
118 | |
119 sub length { | |
120 my ($self) = @_; | |
121 | |
122 return $self->{'end'} - $self->{'start'} + 1; | |
123 } | |
124 | |
125 sub rank { | |
126 my ( $self, $value ) = @_; | |
127 | |
128 if ( defined($value) ) { | |
129 $self->{'rank'} = $value; | |
130 } | |
131 | |
132 return $self->{'rank'}; | |
133 } | |
134 | |
135 1; |