maint: restructure to use Dist::Zilla
[bioperl-live.git] / lib / Bio / Map / OrderedPositionWithDistance.pm
blobafa001fa10d5e6d8f0abca48040c42cb0224e59b
1 ### TO BE DELETED ###
3 # BioPerl module for Bio::Map::OrderedPositionWithDistance
5 # Please direct questions and support issues to <bioperl-l@bioperl.org>
7 # Cared for by Chad Matsalla <bioinformatics1@dieselwurks.com>
9 # Copyright Chad Matsalla
11 # You may distribute this module under the same terms as perl itself
13 # POD documentation - main docs before the code
15 =head1 NAME
17 Bio::Map::OrderedPositionWithDistance - Abstracts the notion of a member
18 of an ordered list of markers. Each marker is a certain distance
19 from the one in the ordered list before it.
21 =head1 SYNOPSIS
23 use Bio::Map::OrderedPositionWithDistance;
24 # the first marker in the sequence
25 my $position = Bio::Map::OrderedPositionWithDistance->new(-positions => 1,
26 -distance => 22.3 );
27 # the second marker in the sequence, 15.6 units from the fist one
28 my $position2 = Bio::Map::OrderedPositionWithDistance->new(-positions => 2,
29 -distance => 15.6 );
30 # the third marker in the sequence, coincidental with the second
31 # marker
32 my $position3 = Bio::Map::OrderedPositionWithDistance->new(-positions => 3,
33 -distance => 0 );
36 =head1 DESCRIPTION
38 This object is an implementation of the PositionI interface and the
39 Position object handles the specific values of a position.
40 OrderedPositionWithDistance is intended to be slightly more specific
41 then Position but only specific enough for a parser from the MarkerIO
42 subsystem to create and then pass to a client application to bless into
43 the proper type. For an example of how this is intended to work, see the
44 Mapmaker.pm.
46 No units are assumed here - units are handled by context of which Map
47 a position is placed in.
49 Se Bio::Map::Position for additional information.
51 =head1 FEEDBACK
53 =head2 Mailing Lists
55 User feedback is an integral part of the evolution of this and other
56 Bioperl modules. Send your comments and suggestions preferably to
57 the Bioperl mailing list. Your participation is much appreciated.
59 bioperl-l@bioperl.org - General discussion
60 http://bioperl.org/wiki/Mailing_lists - About the mailing lists
62 =head2 Support
64 Please direct usage questions or support issues to the mailing list:
66 I<bioperl-l@bioperl.org>
68 rather than to the module maintainer directly. Many experienced and
69 reponsive experts will be able look at the problem and quickly
70 address it. Please include a thorough description of the problem
71 with code and data examples if at all possible.
73 =head2 Reporting Bugs
75 Report bugs to the Bioperl bug tracking system to help us keep track
76 of the bugs and their resolution. Bug reports can be submitted via the
77 web:
79 https://github.com/bioperl/bioperl-live/issues
81 =head1 AUTHOR - Chad Matsalla
83 Email bioinformatics1@dieselwurks.com
85 =head1 CONTRIBUTORS
87 Lincoln Stein, lstein@cshl.org
88 Heikki Lehvaslaiho, heikki-at-bioperl-dot-org
90 =head1 APPENDIX
92 The rest of the documentation details each of the object methods.
93 Internal methods are usually preceded with a _
95 =cut
98 # Let the code begin...
101 package Bio::Map::OrderedPositionWithDistance;
102 use strict;
105 use base qw(Bio::Map::Position);
107 =head2 new
109 Title : new
110 Usage : my $obj = Bio::Map::OrderedPositionWithDistance->new();
111 Function: Builds a new Bio::Map::OrderedPositionWithDistance object
112 Returns : Bio::Map::OrderedPositionWithDistance
113 Args : -positions - Should be a single value representing the order
114 of this marker within the list of markers
115 -distance - The distance this marker is from the marker before it.
116 0 reflects coincidentality.
118 =cut
120 sub new {
121 my($class,@args) = @_;
122 my $self = $class->SUPER::new(@args);
123 $self->{'_positions'} = [];
124 my ($positions,$distance) = $self->_rearrange([qw(POSITIONS DISTANCE)], @args);
125 if( ref($positions) =~ /array/i ) {
126 foreach my $p ( @$positions ) {
127 $self->add_position($p);
129 } else {
130 $self->add_position($positions);
132 $distance && $self->distance($distance);
134 return $self;
139 =head2 distance($new_distance)
141 Title : distance($new_distance)
142 Usage : $position->distance(new_distance) _or_
143 $position->distance()
144 Function: get/set the distance of this position from the previous marker
145 Returns : A scalar representing the current distance for this position.
146 Args : If $new_distance is provided the distance of this Position will
147 be set to $new_distance
149 =cut
151 sub distance {
152 my ($self,$distance) = @_;
153 if ($distance) {
154 $self->{'_distance'} = $distance;
156 return $self->{'_distance'};