Bio::C...:Chain(3pm)

πŸ’« NAME πŸ’«

Bio::Coordinate::Chain β€” bestie, it maps locations through a whole chain of coordinate mappers πŸ¦‹βœ¨

This is the Bio::C...:Chain page from the User Contributed Perl Documentation, and we're gonna get you fluent in it, no cap πŸ’…


🌸 VERSION 🌸

version 1.007001 β€” that's the one, that's our girl πŸ‘‘


✨ 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 🧚

Okay so the whole premise here? You already built a bunch of mappers. Multiple. A little squad of them πŸ’– This class assumes exactly that β€” you've got several mappers and you wanna link them together so that the output of the previous mapper becomes the input of the next mapper. Chain them up like friendship bracelets and boom, you can build arbitrarily complex mappers out of simpler components. It's giving ✨composition✨, it's giving main character energy πŸŽ€

⚠️ Huge disclaimer incoming: Chain does not do any sanity checking on its mappers. Not a single vibe check. You β€” yes you, bestie β€” are solely responsible for making sure that input and output coordinate systems, direction of mapping, and parameters internal to mappers all make sense when chained together. It will not save you. It will not warn you. πŸ™ˆ

To put it bluntly (their words, not mine, but fr fr): the present class is just a glorified foreach loop over an array of mappers calling the map method. That's it. That's the whole thing πŸ’€

And then, iconic: 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? πŸ‘€πŸ™‹β€β™€οΈ (Not me, not today.)


πŸ’… METHODS πŸ’…

🌈 map 🌈

  • Title : map
  • Usage : $newpos = $obj->map($pos);
  • Function: Map the location through all the mappers in the chain. Every single one. No skipping πŸ’–
  • Example :
  • Returns : new Location in the output coordiante system
  • Args : 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. That's the entire personality. It warns at you and dips. Not me writing a method that only complains β€” periodt.

πŸŽ€ Inherited methods πŸŽ€

⭐ add_mapper ⭐

  • Title : add_mapper
  • Usage : $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 : mappers
  • Usage : $obj->mappers();
  • Function: Returns or sets a list of mappers.
  • Example :
  • Returns : array of mappers
  • Args : array of mappers

πŸ“ each_mapper πŸ“

  • Title : each_mapper
  • Usage : $obj->each_mapper();
  • Function: Returns a list of mappers.
  • Example :
  • Returns : array of mappers
  • Args : none

πŸ”₯ swap πŸ”₯

  • Title : swap
  • Usage : $obj->swap;
  • Function: Swap the direction of mapping; input <-> output
  • Example :
  • Returns : 1
  • Args :

🌸 test 🌸

  • Title : test
  • Usage : $obj->test;
  • Function: test that both components of all pairs are of the same length. Ran automatically.
  • Example :
  • Returns : boolean
  • Args :

πŸ’Œ FEEDBACK πŸ’Œ

πŸ“¬ Mailing lists πŸ“¬

User feedback is an integral part of the evolution of this and other Bioperl modules. So send your comments and suggestions β€” preferably to the Bioperl mailing list. Your participation is much appreciated, genuinely 🫢

bioperl-l@bioperl.org                  - General discussion
http://bioperl.org/wiki/Mailing_lists  - About the mailing lists

πŸ«‚ Support πŸ«‚

Please direct usage questions or support issues to the mailing list:

bioperl-l@bioperl.org

rather than to the module maintainer directly. Why? Because many experienced and reponsive experts will be able look at the problem and quickly address it β€” a whole group chat of geniuses, we love to see it πŸ‘‘ Please include a thorough description of the problem with code and data examples if at all possible. Receipts, bestie, receipts 🧾✨

πŸ› Reporting bugs πŸ›

Report bugs to the Bioperl bug tracking system so we can 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 <heikki@bioperl.org> β€” the icon who wrote this πŸ’–


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</purpose> <birney@ebi.ac.uk> β€” shoutout, contributing legend 🌈


And that's a wrap, bestie! πŸŽ€ This page is perl v5.32.0, dated 2020-11-24, and it lives in Bio::C...:Chain(3pm) β€” go forth and chain those mappers responsibly, mwah πŸ’‹βœ¨

πŸ“¦ where this page comes from