0
|
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::Coordinate
|
|
24
|
|
25 =head1 SYNOPSIS
|
|
26
|
|
27 =head1 DESCRIPTION
|
|
28
|
|
29 Representation of a mapped region in a sequence; returned from Mapper.pm
|
|
30 when the target region maps on to valid sequence.
|
|
31
|
|
32 =head1 METHODS
|
|
33
|
|
34 =cut
|
|
35
|
|
36 package Bio::EnsEMBL::Mapper::Coordinate;
|
|
37
|
|
38 use strict;
|
|
39
|
|
40 =head2 new
|
|
41
|
|
42 Arg [1] char|int id of object in mapped region
|
|
43 Arg [2] int start of region
|
|
44 Arg [3] int end of region
|
|
45 Arg [4] int strand if region
|
|
46 Arg [5] Bio::EnsEMBL::CoordSystem coordsytem of the region
|
|
47 Function creates a new Coordinate object
|
|
48 Returntype Bio::EnsEMBL::Mapper::Coordinate
|
|
49 Exceptions none
|
|
50 Status Stable
|
|
51
|
|
52 =cut
|
|
53
|
|
54 sub new {
|
|
55 my ( $proto, $id, $start, $end, $strand, $coord_system, $rank ) = @_;
|
|
56
|
|
57 my $class = ref($proto) || $proto;
|
|
58
|
|
59 return
|
|
60 bless( { 'id' => $id,
|
|
61 'start' => $start,
|
|
62 'end' => $end,
|
|
63 'strand' => $strand,
|
|
64 'coord_system' => $coord_system,
|
|
65 'rank' => $rank || 0
|
|
66 },
|
|
67 $class );
|
|
68 }
|
|
69
|
|
70
|
|
71 =head2 start
|
|
72
|
|
73 Arg 1 int $start
|
|
74 start coordinate of object in mapped region
|
|
75 Function getter/setter method
|
|
76 Returntype int
|
|
77 Exceptions none
|
|
78 Caller Bio::EnsEMBL::Mapper::Coordinate
|
|
79 Status Stable
|
|
80
|
|
81 =cut
|
|
82
|
|
83 sub start {
|
|
84 my ( $self, $value ) = @_;
|
|
85
|
|
86 if ( defined($value) ) {
|
|
87 $self->{'start'} = $value;
|
|
88 }
|
|
89
|
|
90 return $self->{'start'};
|
|
91 }
|
|
92
|
|
93
|
|
94 =head2 end
|
|
95
|
|
96 Arg 1 int $end
|
|
97 end coordinate of object in mapped region
|
|
98 Function getter/setter method
|
|
99 Returntype int
|
|
100 Exceptions none
|
|
101 Caller Bio::EnsEMBL::Mapper::Coordinate
|
|
102 Status Stable
|
|
103
|
|
104 =cut
|
|
105
|
|
106 sub end {
|
|
107 my ( $self, $value ) = @_;
|
|
108
|
|
109 if ( defined($value) ) {
|
|
110 $self->{'end'} = $value;
|
|
111 }
|
|
112
|
|
113 return $self->{'end'};
|
|
114 }
|
|
115
|
|
116 =head2 strand
|
|
117
|
|
118 Arg 1 int $strand
|
|
119 strand of object in mapped region
|
|
120 Function getter/setter method
|
|
121 Returntype int
|
|
122 Exceptions none
|
|
123 Caller Bio::EnsEMBL::Mapper::Coordinate
|
|
124 Status Stable
|
|
125
|
|
126 =cut
|
|
127
|
|
128 sub strand {
|
|
129 my ( $self, $value ) = @_;
|
|
130
|
|
131 if ( defined($value) ) {
|
|
132 $self->{'strand'} = $value;
|
|
133 }
|
|
134
|
|
135 return $self->{'strand'};
|
|
136 }
|
|
137
|
|
138 =head2 id
|
|
139
|
|
140 Arg 1 char|int $id
|
|
141 id of object in mapped region
|
|
142 e.g. seq_region_id / seq_region_name
|
|
143 Function getter/setter method
|
|
144 Returntype char|int
|
|
145 Exceptions none
|
|
146 Caller Bio::EnsEMBL::Mapper::Coordinate
|
|
147 Status Stable
|
|
148
|
|
149 =cut
|
|
150
|
|
151 sub id {
|
|
152 my ( $self, $value ) = @_;
|
|
153
|
|
154 if ( defined($value) ) {
|
|
155 $self->{'id'} = $value;
|
|
156 }
|
|
157
|
|
158 return $self->{'id'};
|
|
159 }
|
|
160
|
|
161 =head2 coord_system
|
|
162
|
|
163 Arg 1 Bio::EnsEMBL::CoordSystem
|
|
164 Function getter/setter method
|
|
165 Returntype Bio::EnsEMBL::CoordSystem
|
|
166 Exceptions none
|
|
167 Caller Bio::EnsEMBL::Mapper::Coordinate
|
|
168 Status Stable
|
|
169
|
|
170 =cut
|
|
171
|
|
172 sub coord_system {
|
|
173 my ( $self, $value ) = @_;
|
|
174
|
|
175 if ( defined($value) ) {
|
|
176 $self->{'coord_system'} = $value;
|
|
177 }
|
|
178
|
|
179 return $self->{'coord_system'};
|
|
180 }
|
|
181
|
|
182 =head2 length
|
|
183
|
|
184 Function getter method
|
|
185 Returntype int
|
|
186 Exceptions none
|
|
187 Caller ?
|
|
188 Status Stable
|
|
189
|
|
190 =cut
|
|
191
|
|
192 sub length {
|
|
193 my ($self) = @_;
|
|
194
|
|
195 return $self->{'end'} - $self->{'start'} + 1;
|
|
196 }
|
|
197
|
|
198 sub rank {
|
|
199 my ( $self, $value ) = @_;
|
|
200
|
|
201 if ( defined($value) ) {
|
|
202 $self->{'rank'} = $value;
|
|
203 }
|
|
204
|
|
205 return $self->{'rank'};
|
|
206 }
|
|
207
|
|
208 1;
|