maint: remove Travis stuff which has been replaced with Github actions (#325)
[bioperl-live.git] / lib / Bio / Location / WidestCoordPolicy.pm
blob9c75566a1b5e40bb66b508f6664d2e5214851777
2 # BioPerl module for Bio::Location::WidestCoordPolicy
4 # Please direct questions and support issues to <bioperl-l@bioperl.org>
6 # Cared for by Hilmar Lapp <hlapp@gmx.net>
7 # and Jason Stajich <jason@bioperl.org>
9 # Copyright Hilmar Lapp, Jason Stajich
11 # You may distribute this module under the same terms as perl itself
12 # POD documentation - main docs before the code
14 =head1 NAME
16 Bio::Location::WidestCoordPolicy - class implementing
17 Bio::Location::CoordinatePolicy as the widest possible and reasonable range
19 =head1 SYNOPSIS
21 See Bio::Location::CoordinatePolicyI
23 =head1 DESCRIPTION
25 CoordinatePolicyI implementing objects are used by Bio::LocationI
26 implementing objects to determine integer-valued coordinates when
27 asked for it.
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).
34 =head1 FEEDBACK
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.
40 bioperl-l@bioperl.org - General discussion
41 http://bioperl.org/wiki/Mailing_lists - About the mailing lists
43 =head2 Support
45 Please direct usage questions or support issues to the mailing list:
47 I<bioperl-l@bioperl.org>
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.
54 =head2 Reporting Bugs
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:
60 https://github.com/bioperl/bioperl-live/issues
62 =head1 AUTHOR - Hilmar Lapp, Jason Stajich
64 Email E<lt>hlapp-at-gmx-dot-netE<gt>, E<lt>jason-at-bioperl-dot-orgE<gt>
66 =head1 APPENDIX
68 The rest of the documentation details each of the object
69 methods. Internal methods are usually preceded with a _
71 =cut
73 # Let the code begin...
76 package Bio::Location::WidestCoordPolicy;
78 use strict;
81 use base qw(Bio::Root::Root Bio::Location::CoordinatePolicyI);
83 sub new {
84 my ($class, @args) = @_;
85 my $self = $class->SUPER::new(@args);
87 return $self;
92 =head2 start
94 Title : start
95 Usage : $start = $policy->start($location);
96 Function: Get the integer-valued start coordinate of the given location as
97 computed by this computation policy.
98 Returns : A positive integer number.
99 Args : A Bio::LocationI implementing object.
101 =cut
103 sub start {
104 my ($self,$loc) = @_;
106 # For performance reasons we don't check that it's indeed a Bio::LocationI
107 # object. Hopefully, Location-object programmers are smart enough.
108 my $pos = $loc->min_start();
109 # if min is not defined or equals 0 we resort to max
110 $pos = $loc->max_start() if(! $pos);
111 return $pos;
114 =head2 end
116 Title : end
117 Usage : $end = $policy->end($location);
118 Function: Get the integer-valued end coordinate of the given location as
119 computed by this computation policy.
120 Returns : A positive integer number.
121 Args : A Bio::LocationI implementing object.
123 =cut
125 sub end {
126 my ($self,$loc) = @_;
128 # For performance reasons we don't check that it's indeed a Bio::LocationI
129 # object. Hopefully, Location-object programmers are smart enough.
130 my $pos = $loc->max_end();
131 # if max is not defined or equals 0 we resort to min
132 $pos = $loc->min_end() if(! $pos);
133 return $pos;