| 1 | # | ||||||||||||||||||||||||||||
| 2 | # BioPerl module for Bio::Location::AvWithinCoordPolicy | ||||||||||||||||||||||||||||
| 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::AvWithinCoordPolicy - class implementing | ||||||||||||||||||||||||||||
| 17 | Bio::Location::CoordinatePolicy as the average for WITHIN and the widest possible and reasonable range otherwise | ||||||||||||||||||||||||||||
| 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 for fuzzy locations | ||||||||||||||||||||||||||||
| 30 | of type WITHIN and BETWEEN the average of the two limits will be | ||||||||||||||||||||||||||||
| 31 | returned, and for all other locations it will return the widest | ||||||||||||||||||||||||||||
| 32 | possible range, but by using some common sense. This means that | ||||||||||||||||||||||||||||
| 33 | e.g. locations like "E<lt>5..100" (start before position 5) will return 5 | ||||||||||||||||||||||||||||
| 34 | as start (returned values have to be positive integers). | ||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||
| 36 | =head1 FEEDBACK | ||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||
| 38 | User feedback is an integral part of the evolution of this and other | ||||||||||||||||||||||||||||
| 39 | Bioperl modules. Send your comments and suggestions preferably to one | ||||||||||||||||||||||||||||
| 40 | of the Bioperl mailing lists. Your participation is much appreciated. | ||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||
| 42 | bioperl-l@bioperl.org - General discussion | ||||||||||||||||||||||||||||
| 43 | http://bioperl.org/wiki/Mailing_lists - About the mailing lists | ||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||
| 45 | =head2 Support | ||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||
| 47 | Please direct usage questions or support issues to the mailing list: | ||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||
| 49 | I<bioperl-l@bioperl.org> | ||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||
| 51 | rather than to the module maintainer directly. Many experienced and | ||||||||||||||||||||||||||||
| 52 | reponsive experts will be able look at the problem and quickly | ||||||||||||||||||||||||||||
| 53 | address it. Please include a thorough description of the problem | ||||||||||||||||||||||||||||
| 54 | with code and data examples if at all possible. | ||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||
| 56 | =head2 Reporting Bugs | ||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||
| 58 | Report bugs to the Bioperl bug tracking system to help us keep track | ||||||||||||||||||||||||||||
| 59 | the bugs and their resolution. Bug reports can be submitted via the | ||||||||||||||||||||||||||||
| 60 | web: | ||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||
| 62 | https://github.com/bioperl/bioperl-live/issues | ||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||
| 64 | =head1 AUTHOR - Hilmar Lapp, Jason Stajich | ||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||
| 66 | Email E<lt>hlapp-at-gmx-dot-netE<gt>, E<lt>jason-at-bioperl-dot-orgE<gt> | ||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||
| 68 | =head1 APPENDIX | ||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||
| 70 | The rest of the documentation details each of the object | ||||||||||||||||||||||||||||
| 71 | methods. Internal methods are usually preceded with a _ | ||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||
| 73 | =cut | ||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||
| 75 | # Let the code begin... | ||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||
| 78 | package Bio::Location::AvWithinCoordPolicy; | ||||||||||||||||||||||||||||
| 79 | 2 | $Bio::Location::AvWithinCoordPolicy::VERSION = '1.7.8'; | |||||||||||||||||||||||||||
| 80 | 2 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||
| 83 | 2 | ▶ | use base qw(Bio::Location::WidestCoordPolicy); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||
| 85 | 1 | ▶ | sub new { | ||||||||||||||||||||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 86 | 1 | my ($class, @args) = @_; | |||||||||||||||||||||||||||
| 87 | 1 | my $self = $class->SUPER::new(@args); | |||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||
| 89 | 1 | return $self; | |||||||||||||||||||||||||||
| 90 | } | ||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||
| 94 | =head2 start | ||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||
| 96 | Title : start | ||||||||||||||||||||||||||||
| 97 | Usage : $start = $policy->start($location); | ||||||||||||||||||||||||||||
| 98 | Function: Get the integer-valued start coordinate of the given location as | ||||||||||||||||||||||||||||
| 99 | computed by this computation policy. | ||||||||||||||||||||||||||||
| 100 | Returns : A positive integer number. | ||||||||||||||||||||||||||||
| 101 | Args : A Bio::LocationI implementing object. | ||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||
| 103 | =cut | ||||||||||||||||||||||||||||
| 104 | |||||||||||||||||||||||||||||
| 105 | 3 | ▶ | sub start { | ||||||||||||||||||||||||||
|
Subroutine
start: called CC=5 SCAR=20.2
Pod
documented
| |||||||||||||||||||||||||||||
| 106 | 3 | my ($self,$loc) = @_; | |||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||
| 108 | 3 | ▶ | if(($loc->start_pos_type() eq 'WITHIN') || | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$loc->start_pos_type eq "WITHIN" or $loc->start_pos_type eq "BETWEEN"
MC/DC0%0/2
$loc->start_pos_type eq "WITHIN" or $loc->start_pos_type eq "BETWEEN"
$loc->start_pos_type eq "WITHIN"
$loc->start_pos_type eq "BETWEEN"
Truth table33%1/3
A or B
A= $loc->start_pos_type eq "WITHIN"B= $loc->start_pos_type eq "BETWEEN"
| |||||||||||||||||||||||||||||
| 109 | ($loc->start_pos_type() eq 'BETWEEN')) { | ||||||||||||||||||||||||||||
| 110 | 3 | my ($min, $max) = ($loc->min_start(), $loc->max_start()); | |||||||||||||||||||||||||||
| 111 | 3 | ▶ | return int(($min+$max)/2) if($min && $max); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$min and $max
MC/DC0%0/2
$min and $max
$min
$max
Truth table33%1/3
A and B
A= $minB= $max
| |||||||||||||||||||||||||||||
| 112 | } | ||||||||||||||||||||||||||||
| 113 | 0 | return $self->SUPER::start($loc); | |||||||||||||||||||||||||||
| 114 | } | ||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||
| 116 | =head2 end | ||||||||||||||||||||||||||||
| 117 | |||||||||||||||||||||||||||||
| 118 | Title : end | ||||||||||||||||||||||||||||
| 119 | Usage : $end = $policy->end($location); | ||||||||||||||||||||||||||||
| 120 | Function: Get the integer-valued end coordinate of the given location as | ||||||||||||||||||||||||||||
| 121 | computed by this computation policy. | ||||||||||||||||||||||||||||
| 122 | Returns : A positive integer number. | ||||||||||||||||||||||||||||
| 123 | Args : A Bio::LocationI implementing object. | ||||||||||||||||||||||||||||
| 124 | |||||||||||||||||||||||||||||
| 125 | =cut | ||||||||||||||||||||||||||||
| 126 | |||||||||||||||||||||||||||||
| 127 | 3 | ▶ | sub end { | ||||||||||||||||||||||||||
|
Subroutine
end: called CC=5 SCAR=20.2
Pod
documented
| |||||||||||||||||||||||||||||
| 128 | 3 | my ($self,$loc) = @_; | |||||||||||||||||||||||||||
| 129 | |||||||||||||||||||||||||||||
| 130 | 3 | ▶ | if(($loc->end_pos_type() eq 'WITHIN') || | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$loc->end_pos_type eq "WITHIN" or $loc->end_pos_type eq "BETWEEN"
MC/DC0%0/2
$loc->end_pos_type eq "WITHIN" or $loc->end_pos_type eq "BETWEEN"
$loc->end_pos_type eq "WITHIN"
$loc->end_pos_type eq "BETWEEN"
Truth table33%1/3
A or B
A= $loc->end_pos_type eq "WITHIN"B= $loc->end_pos_type eq "BETWEEN"
| |||||||||||||||||||||||||||||
| 131 | ($loc->end_pos_type() eq 'BETWEEN')) { | ||||||||||||||||||||||||||||
| 132 | 3 | my ($min, $max) = ($loc->min_end(), $loc->max_end()); | |||||||||||||||||||||||||||
| 133 | 3 | ▶ | return int(($min+$max)/2) if($min && $max); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$min and $max
MC/DC0%0/2
$min and $max
$min
$max
Truth table33%1/3
A and B
A= $minB= $max
| |||||||||||||||||||||||||||||
| 134 | } | ||||||||||||||||||||||||||||
| 135 | 0 | return $self->SUPER::end($loc); | |||||||||||||||||||||||||||
| 136 | } | ||||||||||||||||||||||||||||
| 137 | |||||||||||||||||||||||||||||
| 138 | 2 | 1; | |||||||||||||||||||||||||||
| 139 | |||||||||||||||||||||||||||||