NAME
Bio::Coordinate::Chain - Mapping locations through a chain of coordinate mappers.
VERSION
version 1.007001
SYNOPSIS
# create Bio::Coordinate::Pairs, or any MapperIs, somehow$pair1; $pair2;# add them into a Chain$collection = Bio::Coordinate::Chain->new;$collection->add_mapper($pair1);$collection->add_mapper($pair2);# create a position and map it$pos = Bio::Location::Simple->new (-start => 5, -end => 9 );$match = $collection->map($pos);if ($match) {sprintf "Matches at %d-%d\n", $match->start, $match->end,} else {print "No match\n";}
DESCRIPTION
This class assumes that you have built several mappers and want to link them together so that output from the previous mapper is the next mappers input. This way you can build arbitrarily complex mappers from simpler components.
Note that Chain does not do any sanity checking on its mappers. You are solely responsible that input and output coordinate systems, direction of mapping and parameters internal to mappers make sense when chained together.
To put it bluntly, the present class is just a glorified foreach loop over an array of mappers calling the map method.
It would be neat to an internal function that would generate a new single step mapper from those included in the chain. It should speed things up considerably. Any volunteers?
METHODS
map
Title : mapUsage : $newpos = $obj->map($pos);Function: Map the location through all the mappers in the chain.Example :Returns : new Location in the output coordiante systemArgs : a Bio::Location::Simple object
sort
You do not really want to sort your chain, do you! This function does nothing other than a warning.
Inherited methods
add_mapper
Title : add_mapperUsage : $obj->add_mapper($mapper)Function: Pushes one Bio::Coodinate::MapperI into the list of mappers.Sets _is_sorted() to false.Example :Returns : 1 when succeeds, 0 for failure.Args : mapper object
mappers
Title : mappersUsage : $obj->mappers();Function: Returns or sets a list of mappers.Example :Returns : array of mappersArgs : array of mappers
each_mapper
Title : each_mapperUsage : $obj->each_mapper();Function: Returns a list of mappers.Example :Returns : array of mappersArgs : none
swap
Title : swapUsage : $obj->swap;Function: Swap the direction of mapping;input <-> outputExample :Returns : 1Args :
test
Title : testUsage : $obj->test;Function: test that both components of all pairs are of the same length.Ran automatically.Example :Returns : booleanArgs :
FEEDBACK
Mailing lists
User feedback is an integral part of the evolution of this and other Bioperl modules. Send your comments and suggestions preferably to the Bioperl mailing list. Your participation is much appreciated.
[email protected] - General discussionhttp://bioperl.org/wiki/Mailing_lists - About the mailing lists
Support
Please direct usage questions or support issues to the mailing list: [email protected]
rather than to the module maintainer directly. Many experienced and reponsive experts will be able look at the problem and quickly address it. Please include a thorough description of the problem with code and data examples if at all possible.
Reporting bugs
Report bugs to the Bioperl bug tracking system to help us keep track of the bugs and their resolution. Bug reports can be submitted via the web:
https://github.com/bioperl/%%7Bdist%7D
AUTHOR
Heikki Lehvaslaiho <[email protected]>
COPYRIGHT
This software is copyright (c) by Heikki Lehvaslaiho.
This software is available under the same terms as the perl 5 programming language system itself.
CONTRIBUTOR
Ewan Birney <[email protected]>