line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# |
2
|
|
|
|
|
|
|
# BioPerl module for Bio::Location::NarrowestCoordPolicy |
3
|
|
|
|
|
|
|
# |
4
|
|
|
|
|
|
|
# Please direct questions and support issues to |
5
|
|
|
|
|
|
|
# |
6
|
|
|
|
|
|
|
# Cared for by Hilmar Lapp |
7
|
|
|
|
|
|
|
# and Jason Stajich |
8
|
|
|
|
|
|
|
# |
9
|
|
|
|
|
|
|
# Copyright Hilmar Lapp, Jason Stajich |
10
|
|
|
|
|
|
|
# |
11
|
|
|
|
|
|
|
# You may distribute this module under the same terms as perl itself |
12
|
|
|
|
|
|
|
# POD documentation - main docs before the code |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=head1 NAME |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
Bio::Location::NarrowestCoordPolicy - class implementing |
17
|
|
|
|
|
|
|
Bio::Location::CoordinatePolicy as the narrowest possible and reasonable range |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=head1 SYNOPSIS |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
See Bio::Location::CoordinatePolicyI |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=head1 DESCRIPTION |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
CoordinatePolicyI implementing objects are used by Bio::LocationI |
26
|
|
|
|
|
|
|
implementing objects to determine integer-valued coordinates when |
27
|
|
|
|
|
|
|
asked for it. |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
This class will compute the coordinates such that always the narrowest possible |
30
|
|
|
|
|
|
|
range is returned, but by using some common sense. This means that e.g. |
31
|
|
|
|
|
|
|
locations like "E5..100" (start before position 5) will return 5 as start |
32
|
|
|
|
|
|
|
(returned values have to be positive integers). |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=head1 FEEDBACK |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
User feedback is an integral part of the evolution of this and other |
37
|
|
|
|
|
|
|
Bioperl modules. Send your comments and suggestions preferably to one |
38
|
|
|
|
|
|
|
of the Bioperl mailing lists. Your participation is much appreciated. |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
bioperl-l@bioperl.org - General discussion |
41
|
|
|
|
|
|
|
http://bioperl.org/wiki/Mailing_lists - About the mailing lists |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=head2 Support |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
Please direct usage questions or support issues to the mailing list: |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
I |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
rather than to the module maintainer directly. Many experienced and |
50
|
|
|
|
|
|
|
reponsive experts will be able look at the problem and quickly |
51
|
|
|
|
|
|
|
address it. Please include a thorough description of the problem |
52
|
|
|
|
|
|
|
with code and data examples if at all possible. |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=head2 Reporting Bugs |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
Report bugs to the Bioperl bug tracking system to help us keep track |
57
|
|
|
|
|
|
|
the bugs and their resolution. Bug reports can be submitted via the |
58
|
|
|
|
|
|
|
web: |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
https://github.com/bioperl/bioperl-live/issues |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=head1 AUTHOR - Hilmar Lapp, Jason Stajich |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
Email Ehlapp-at-gmx.netE, Ejason@bioperl.orgE |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=head1 APPENDIX |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
The rest of the documentation details each of the object |
69
|
|
|
|
|
|
|
methods. Internal methods are usually preceded with a _ |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=cut |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
# Let the code begin... |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
package Bio::Location::NarrowestCoordPolicy; |
77
|
1
|
|
|
1
|
|
1323
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
36
|
|
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
|
80
|
1
|
|
|
1
|
|
4
|
use base qw(Bio::Root::Root Bio::Location::CoordinatePolicyI); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
218
|
|
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
sub new { |
83
|
1
|
|
|
1
|
1
|
3
|
my ($class, @args) = @_; |
84
|
1
|
|
|
|
|
7
|
my $self = $class->SUPER::new(@args); |
85
|
|
|
|
|
|
|
|
86
|
1
|
|
|
|
|
4
|
return $self; |
87
|
|
|
|
|
|
|
} |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=head2 start |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
Title : start |
93
|
|
|
|
|
|
|
Usage : $start = $policy->start($location); |
94
|
|
|
|
|
|
|
Function: Get the integer-valued start coordinate of the given location as |
95
|
|
|
|
|
|
|
computed by this computation policy. |
96
|
|
|
|
|
|
|
Returns : A positive integer number. |
97
|
|
|
|
|
|
|
Args : A Bio::LocationI implementing object. |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=cut |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
sub start { |
102
|
3
|
|
|
3
|
1
|
6
|
my ($self,$loc) = @_; |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
# For performance reasons we don't check that it's indeed a Bio::LocationI |
105
|
|
|
|
|
|
|
# object. Hopefully, Location-object programmers are smart enough. |
106
|
3
|
|
|
|
|
7
|
my $pos = $loc->max_start(); |
107
|
|
|
|
|
|
|
# if max is not defined or equals 0 we resort to min |
108
|
3
|
50
|
|
|
|
7
|
$pos = $loc->min_start() if(! $pos); |
109
|
3
|
|
|
|
|
12
|
return $pos; |
110
|
|
|
|
|
|
|
} |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=head2 end |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
Title : end |
115
|
|
|
|
|
|
|
Usage : $end = $policy->end($location); |
116
|
|
|
|
|
|
|
Function: Get the integer-valued end coordinate of the given location as |
117
|
|
|
|
|
|
|
computed by this computation policy. |
118
|
|
|
|
|
|
|
Returns : A positive integer number. |
119
|
|
|
|
|
|
|
Args : A Bio::LocationI implementing object. |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
=cut |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
sub end { |
124
|
3
|
|
|
3
|
1
|
6
|
my ($self,$loc) = @_; |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
# For performance reasons we don't check that it's indeed a Bio::LocationI |
127
|
|
|
|
|
|
|
# object. Hopefully, Location-object programmers are smart enough. |
128
|
3
|
|
|
|
|
6
|
my $pos = $loc->min_end(); |
129
|
|
|
|
|
|
|
# if min is not defined or equals 0 we resort to max |
130
|
3
|
50
|
|
|
|
7
|
$pos = $loc->max_end() if(! $pos); |
131
|
3
|
|
|
|
|
8
|
return $pos; |
132
|
|
|
|
|
|
|
} |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
1; |
135
|
|
|
|
|
|
|
|