Filename | /Users/ap13/perl5/lib/perl5/Bio/Location/WidestCoordPolicy.pm |
Statements | Executed 8 statements in 182µs |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
1 | 1 | 1 | 28µs | 42µs | new | Bio::Location::WidestCoordPolicy::
1 | 1 | 1 | 12µs | 23µs | BEGIN@77 | Bio::Location::WidestCoordPolicy::
1 | 1 | 1 | 8µs | 425µs | BEGIN@80 | Bio::Location::WidestCoordPolicy::
0 | 0 | 0 | 0s | 0s | end | Bio::Location::WidestCoordPolicy::
0 | 0 | 0 | 0s | 0s | start | Bio::Location::WidestCoordPolicy::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | # | ||||
2 | # BioPerl module for Bio::Location::WidestCoordPolicy | ||||
3 | # | ||||
4 | # Please direct questions and support issues to <bioperl-l@bioperl.org> | ||||
5 | # | ||||
6 | # Cared for by Hilmar Lapp <hlapp@gmx.net> | ||||
7 | # and Jason Stajich <jason@bioperl.org> | ||||
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::WidestCoordPolicy - class implementing | ||||
17 | Bio::Location::CoordinatePolicy as the widest 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 widest possible | ||||
30 | range is returned, but by using some common sense. This means that e.g. | ||||
31 | locations like "E<lt>5..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<bioperl-l@bioperl.org> | ||||
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 E<lt>hlapp-at-gmx-dot-netE<gt>, E<lt>jason-at-bioperl-dot-orgE<gt> | ||||
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::WidestCoordPolicy; | ||||
77 | 2 | 27µs | 2 | 34µs | # spent 23µs (12+11) within Bio::Location::WidestCoordPolicy::BEGIN@77 which was called:
# once (12µs+11µs) by Bio::Location::Atomic::BEGIN@79 at line 77 # spent 23µs making 1 call to Bio::Location::WidestCoordPolicy::BEGIN@77
# spent 11µs making 1 call to strict::import |
78 | |||||
79 | |||||
80 | 2 | 127µs | 2 | 425µs | # spent 425µs (8+418) within Bio::Location::WidestCoordPolicy::BEGIN@80 which was called:
# once (8µs+418µs) by Bio::Location::Atomic::BEGIN@79 at line 80 # spent 425µs making 1 call to Bio::Location::WidestCoordPolicy::BEGIN@80
# spent 418µs making 1 call to base::import, recursion: max depth 1, sum of overlapping time 418µs |
81 | |||||
82 | # spent 42µs (28+14) within Bio::Location::WidestCoordPolicy::new which was called:
# once (28µs+14µs) by base::import at line 83 of Bio/Location/Atomic.pm | ||||
83 | 1 | 2µs | my ($class, @args) = @_; | ||
84 | 1 | 20µs | 1 | 14µs | my $self = $class->SUPER::new(@args); # spent 14µs making 1 call to Bio::Root::Root::new |
85 | |||||
86 | 1 | 4µs | return $self; | ||
87 | } | ||||
88 | |||||
- - | |||||
91 | =head2 start | ||||
92 | |||||
93 | Title : start | ||||
94 | Usage : $start = $policy->start($location); | ||||
95 | Function: Get the integer-valued start coordinate of the given location as | ||||
96 | computed by this computation policy. | ||||
97 | Returns : A positive integer number. | ||||
98 | Args : A Bio::LocationI implementing object. | ||||
99 | |||||
100 | =cut | ||||
101 | |||||
102 | sub start { | ||||
103 | my ($self,$loc) = @_; | ||||
104 | |||||
105 | # For performance reasons we don't check that it's indeed a Bio::LocationI | ||||
106 | # object. Hopefully, Location-object programmers are smart enough. | ||||
107 | my $pos = $loc->min_start(); | ||||
108 | # if min is not defined or equals 0 we resort to max | ||||
109 | $pos = $loc->max_start() if(! $pos); | ||||
110 | return $pos; | ||||
111 | } | ||||
112 | |||||
113 | =head2 end | ||||
114 | |||||
115 | Title : end | ||||
116 | Usage : $end = $policy->end($location); | ||||
117 | Function: Get the integer-valued end coordinate of the given location as | ||||
118 | computed by this computation policy. | ||||
119 | Returns : A positive integer number. | ||||
120 | Args : A Bio::LocationI implementing object. | ||||
121 | |||||
122 | =cut | ||||
123 | |||||
124 | sub end { | ||||
125 | my ($self,$loc) = @_; | ||||
126 | |||||
127 | # For performance reasons we don't check that it's indeed a Bio::LocationI | ||||
128 | # object. Hopefully, Location-object programmers are smart enough. | ||||
129 | my $pos = $loc->max_end(); | ||||
130 | # if max is not defined or equals 0 we resort to min | ||||
131 | $pos = $loc->min_end() if(! $pos); | ||||
132 | return $pos; | ||||
133 | } | ||||
134 | |||||
135 | 1 | 2µs | 1; | ||
136 |