3 # BioPerl module for Bio::MapIO::mapmaker
5 # Cared for by Jason Stajich <jason@bioperl.org>
7 # Copyright Jason Stajich
9 # You may distribute this module under the same terms as perl itself
11 # POD documentation - main docs before the code
15 Bio::MapIO::mapmaker - A Mapmaker Map reader
19 # do not use this object directly it is accessed through the Bio::MapIO system
22 my $mapio = Bio::MapIO->new(-format => "mapmaker",
23 -file => "mapfile.map");
24 while ( my $map = $mapio->next_map ) { # get each map
25 foreach my $marker ( $map->each_element ) {
26 # loop through the markers associated with the map
32 This object contains code for parsing and processing Mapmaker output
33 and creating L<Bio::Map::MapI> objects from it.
39 User feedback is an integral part of the evolution of this and other
40 Bioperl modules. Send your comments and suggestions preferably to
41 the Bioperl mailing list. Your participation is much appreciated.
43 bioperl-l@bioperl.org - General discussion
44 http://bioperl.org/wiki/Mailing_lists - About the mailing lists
48 Report bugs to the Bioperl bug tracking system to help us keep track
49 of the bugs and their resolution. Bug reports can be submitted via the
52 http://bugzilla.open-bio.org/
54 =head1 AUTHOR - Jason Stajich
56 Email jason@bioperl.org
60 The rest of the documentation details each of the object methods.
61 Internal methods are usually preceded with a _
65 # Let the code begin...
67 package Bio
::MapIO
::mapmaker
;
70 use Bio
::Map
::SimpleMap
;
71 use Bio
::Map
::LinkagePosition
;
74 use base
qw(Bio::MapIO);
79 Usage : my $map = $factory->next_map;
80 Function: Get one or more map objects from the Mapmaker input
81 Returns : Bio::Map::MapI
90 my $map = Bio
::Map
::SimpleMap
->new(-name
=> '',
94 # Mapmaker input can be free-form, like the result of a copy-paste
95 # from a terminal, with no particular format before or after the
96 # map data. The $in_map variable is a flag that's set to 1 when
97 # we're reading map data lines and set back to 0 when we're finished.
98 my ($in_map,$runningDistance);
100 while ( defined ($_ = $self->_readline()) ) {
101 if ( /^\s+Markers\s+Distance/ ) {
108 my ($number,$name,$distance) = split;
109 $runningDistance += $distance unless ($distance =~ /-+/);
110 $runningDistance = '0.0' if ($runningDistance == 0 || $distance =~ /-+/);
112 my $pos = Bio
::Map
::LinkagePosition
->new(-order
=> $number,
114 -value
=> $runningDistance );
115 my $marker = Bio
::Map
::Marker
->new(-name
=> $name,
118 if ($distance =~ /-+/) { # last marker
128 Usage : $factory->write_map($map);
129 Function: Write a map out through the factory
131 Args : Bio::Map::MapI
136 my ($self,@args) = @_;
137 $self->throw_not_implemented();