Mercurial > repos > mahtabm > ensembl
comparison variant_effect_predictor/Bio/Location/WidestCoordPolicy.pm @ 0:1f6dce3d34e0
Uploaded
author | mahtabm |
---|---|
date | Thu, 11 Apr 2013 02:01:53 -0400 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:1f6dce3d34e0 |
---|---|
1 # $Id: WidestCoordPolicy.pm,v 1.6 2002/12/01 00:05:20 jason Exp $ | |
2 # | |
3 # BioPerl module for Bio::Location::WidestCoordPolicy | |
4 # | |
5 # Cared for by Hilmar Lapp <hlapp@gmx.net> | |
6 # and Jason Stajich <jason@bioperl.org> | |
7 # | |
8 # Copyright Hilmar Lapp, Jason Stajich | |
9 # | |
10 # You may distribute this module under the same terms as perl itself | |
11 # POD documentation - main docs before the code | |
12 | |
13 =head1 NAME | |
14 | |
15 Bio::Location::WidestCoordPolicy - class implementing | |
16 Bio::Location::CoordinatePolicy as the widest possible and reasonable range | |
17 | |
18 =head1 SYNOPSIS | |
19 | |
20 See Bio::Location::CoordinatePolicyI | |
21 | |
22 =head1 DESCRIPTION | |
23 | |
24 CoordinatePolicyI implementing objects are used by Bio::LocationI | |
25 implementing objects to determine integer-valued coordinates when | |
26 asked for it. | |
27 | |
28 This class will compute the coordinates such that always the widest possible | |
29 range is returned, but by using some common sense. This means that e.g. | |
30 locations like "E<lt>5..100" (start before position 5) will return 5 as start | |
31 (returned values have to be positive integers). | |
32 | |
33 =head1 FEEDBACK | |
34 | |
35 User feedback is an integral part of the evolution of this and other | |
36 Bioperl modules. Send your comments and suggestions preferably to one | |
37 of the Bioperl mailing lists. Your participation is much appreciated. | |
38 | |
39 bioperl-l@bioperl.org - General discussion | |
40 http://bio.perl.org/MailList.html - About the mailing lists | |
41 | |
42 =head2 Reporting Bugs | |
43 | |
44 Report bugs to the Bioperl bug tracking system to help us keep track | |
45 the bugs and their resolution. Bug reports can be submitted via email | |
46 or the web: | |
47 | |
48 bioperl-bugs@bio.perl.org | |
49 http://bugzilla.bioperl.org/ | |
50 | |
51 =head1 AUTHOR - Hilmar Lapp, Jason Stajich | |
52 | |
53 Email hlapp@gmx.net, jason@bioperl.org | |
54 | |
55 =head1 APPENDIX | |
56 | |
57 The rest of the documentation details each of the object | |
58 methods. Internal methods are usually preceded with a _ | |
59 | |
60 =cut | |
61 | |
62 # Let the code begin... | |
63 | |
64 | |
65 package Bio::Location::WidestCoordPolicy; | |
66 use vars qw(@ISA); | |
67 use strict; | |
68 | |
69 use Bio::Root::Root; | |
70 use Bio::Location::CoordinatePolicyI; | |
71 | |
72 @ISA = qw(Bio::Root::Root Bio::Location::CoordinatePolicyI); | |
73 | |
74 sub new { | |
75 my ($class, @args) = @_; | |
76 my $self = $class->SUPER::new(@args); | |
77 | |
78 return $self; | |
79 } | |
80 | |
81 | |
82 | |
83 =head2 start | |
84 | |
85 Title : start | |
86 Usage : $start = $policy->start($location); | |
87 Function: Get the integer-valued start coordinate of the given location as | |
88 computed by this computation policy. | |
89 Returns : A positive integer number. | |
90 Args : A Bio::LocationI implementing object. | |
91 | |
92 =cut | |
93 | |
94 sub start { | |
95 my ($self,$loc) = @_; | |
96 | |
97 # For performance reasons we don't check that it's indeed a Bio::LocationI | |
98 # object. Hopefully, Location-object programmers are smart enough. | |
99 my $pos = $loc->min_start(); | |
100 # if min is not defined or equals 0 we resort to max | |
101 $pos = $loc->max_start() if(! $pos); | |
102 return $pos; | |
103 } | |
104 | |
105 =head2 end | |
106 | |
107 Title : end | |
108 Usage : $end = $policy->end($location); | |
109 Function: Get the integer-valued end coordinate of the given location as | |
110 computed by this computation policy. | |
111 Returns : A positive integer number. | |
112 Args : A Bio::LocationI implementing object. | |
113 | |
114 =cut | |
115 | |
116 sub end { | |
117 my ($self,$loc) = @_; | |
118 | |
119 # For performance reasons we don't check that it's indeed a Bio::LocationI | |
120 # object. Hopefully, Location-object programmers are smart enough. | |
121 my $pos = $loc->max_end(); | |
122 # if max is not defined or equals 0 we resort to min | |
123 $pos = $loc->min_end() if(! $pos); | |
124 return $pos; | |
125 } | |
126 | |
127 1; | |
128 |