2 # BioPerl module for Bio::MapIO::mapmaker
4 # Please direct questions and support issues to <bioperl-l@bioperl.org>
6 # Cared for by Jason Stajich <jason@bioperl.org>
8 # Copyright Jason Stajich
10 # You may distribute this module under the same terms as perl itself
12 # POD documentation - main docs before the code
16 Bio::MapIO::mapmaker - A Mapmaker Map reader
20 # do not use this object directly it is accessed through the Bio::MapIO system
23 my $mapio = Bio::MapIO->new(-format => "mapmaker",
24 -file => "mapfile.map");
25 while ( my $map = $mapio->next_map ) { # get each map
26 foreach my $marker ( $map->each_element ) {
27 # loop through the markers associated with the map
33 This object contains code for parsing and processing Mapmaker output
34 and creating L<Bio::Map::MapI> objects from it.
40 User feedback is an integral part of the evolution of this and other
41 Bioperl modules. Send your comments and suggestions preferably to
42 the Bioperl mailing list. Your participation is much appreciated.
44 bioperl-l@bioperl.org - General discussion
45 http://bioperl.org/wiki/Mailing_lists - About the mailing lists
49 Please direct usage questions or support issues to the mailing list:
51 I<bioperl-l@bioperl.org>
53 rather than to the module maintainer directly. Many experienced and
54 reponsive experts will be able look at the problem and quickly
55 address it. Please include a thorough description of the problem
56 with code and data examples if at all possible.
60 Report bugs to the Bioperl bug tracking system to help us keep track
61 of the bugs and their resolution. Bug reports can be submitted via the
64 https://github.com/bioperl/bioperl-live/issues
66 =head1 AUTHOR - Jason Stajich
68 Email jason@bioperl.org
72 The rest of the documentation details each of the object methods.
73 Internal methods are usually preceded with a _
77 # Let the code begin...
79 package Bio
::MapIO
::mapmaker
;
82 use Bio
::Map
::SimpleMap
;
83 use Bio
::Map
::LinkagePosition
;
86 use base
qw(Bio::MapIO);
91 Usage : my $map = $factory->next_map;
92 Function: Get one or more map objects from the Mapmaker input
93 Returns : Bio::Map::MapI
102 my $map = Bio
::Map
::SimpleMap
->new(-name
=> '',
106 # Mapmaker input can be free-form, like the result of a copy-paste
107 # from a terminal, with no particular format before or after the
108 # map data. The $in_map variable is a flag that's set to 1 when
109 # we're reading map data lines and set back to 0 when we're finished.
110 my ($in_map,$runningDistance);
112 while ( defined ($_ = $self->_readline()) ) {
113 if ( /^\s+Markers\s+Distance/ ) {
120 my ($number,$name,$distance) = split;
121 $runningDistance += $distance unless ($distance =~ /-+/);
122 $runningDistance = '0.0' if ($runningDistance == 0 || $distance =~ /-+/);
124 my $pos = Bio
::Map
::LinkagePosition
->new(-order
=> $number,
126 -value
=> $runningDistance );
127 my $marker = Bio
::Map
::Marker
->new(-name
=> $name,
130 if ($distance =~ /-+/) { # last marker
140 Usage : $factory->write_map($map);
141 Function: Write a map out through the factory
143 Args : Bio::Map::MapI
148 my ($self,@args) = @_;
149 $self->throw_not_implemented();