Bio::S...:fasta(3pm)

πŸ“¦
version 1.7.8 Β· 3 versions
, in debian bookworm, debian trixie, ubuntu jammy, ubuntu noble

πŸ’– Bio::SearchIO::fasta β€” the vibe ✨

okay bestie, gather round, because we're talking about Bio::SearchIO::fasta from the User Contributed Perl Documentation, and it's literally the SearchIO parser for FASTA results. no cap. πŸ§¬πŸ¦‹


✨ NAME ✨

Bio::SearchIO::fasta β€” a SearchIO parser for FASTA results. that's the whole vibe. πŸ’…


🌸 SYNOPSIS 🌸

# Do not use this object directly, use it through the SearchIO system
 use Bio::SearchIO;
 my $searchio = Bio::SearchIO->new(-format => 'fasta',
                  -file   => 'report.FASTA');
 while( my $result = $searchio->next_result ) {
  # ... do what you would normally doi with Bio::SearchIO.
 }

(yes, the typo doi is canon, we don't touch it, it's iconic 🫢)


πŸŽ€ DESCRIPTION πŸŽ€

so this object holds the event based parsing code for FASTA format reports. it's giving parser, it's giving events. and here's the lil glow-up it does: it creates Bio::Search::HSP::FastaHSP objects instead of Bio::Search::HSP::GenericHSP for the HSP objects. so fancy. πŸ‘‘

this module will parse -m 9 -d 0 output as well as default m 1 output from FASTA as well as SSEARCH. yes bestie, all of those. ⭐

Also see the SearchIO HOWTO: <http://bioperl.org/howtos/SearchIO_HOWTO.html>. go read it, it's lowkey required reading fr fr. πŸ“–


πŸ’Œ FEEDBACK πŸ’Œ

🫢 Mailing Lists

user feedback is an integral part of the evolution of this and other Bioperl modules. like, we literally need you. send your comments and suggestions preferably to the Bioperl mailing list. your participation is much appreciated, no seriously, we're obsessed with you. πŸ˜­πŸ’–

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. because like, many experienced and reponsive experts will be able look at the problem and quickly address it. (yes reponsive, we keep the original spelling, it's part of the lore ✨) please include a thorough description of the problem with code and data examples if at all possible. the more context the better, bestie. πŸ“

πŸ› 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/bioperl-live/issues

πŸ‘‘ AUTHOR β€” Jason Stajich, Aaron Mackey, William Pearson πŸ‘‘

Email jason-at-bioperl.org


πŸ“š APPENDIX πŸ“š

the rest of the documentation details each of the object methods. internal methods are usually preceded with a _ (you know, the lil private-method signature πŸ’…).


🌟 new

  • Title β€” new
  • Usage β€” my $obj = Bio::SearchIO::fasta->new();
  • Function β€” Builds a new Bio::SearchIO::fasta object
  • Returns β€” Bio::SearchIO::fasta
  • Args β€” -idlength β€” set ID length to something other than the default (6), this is only necessary if you have compiled FASTA with a new default id length to display in the HSP alignment blocks
ngl the -idlength thing is niche, but if you recompiled FASTA with a different default id length, you KNOW who you are, and this is for you. 🎯

🌟 next_result

  • Title β€” next_result
  • Usage β€” my $hit = $searchio->next_result;
  • Function β€” Returns the next Result from a search
  • Returns β€” Bio::Search::Result::ResultI object
  • Args β€” none

🌟 start_element

  • Title β€” start_element
  • Usage β€” $eventgenerator->start_element
  • Function β€” Handles a start element event
  • Returns β€” none
  • Args β€” hashref with at least 2 keys 'Data' and 'Name'

🌟 end_element

  • Title β€” start_element (yes, it says start_element here too, we are NOT fixing it, it's iconic 😭)
  • Usage β€” $eventgenerator->end_element
  • Function β€” Handles an end element event
  • Returns β€” none
  • Args β€” hashref with at least 2 keys 'Data' and 'Name'

🌟 element

  • Title β€” element
  • Usage β€” $eventhandler->element({'Name' => $name, 'Data' => $str});
  • Function β€” Convience method that calls start_element, characters, end_element
  • Returns β€” none
  • Args β€” Hash ref with the keys 'Name' and 'Data'
Convience β€” again, original spelling, preserved with love. πŸ™ˆ

🌟 characters

  • Title β€” characters
  • Usage β€” $eventgenerator->characters($str)
  • Function β€” Send a character events
  • Returns β€” none
  • Args β€” string

🌟 _mode

  • Title β€” _mode
  • Usage β€” $obj->_mode($newval)
  • Function β€” (blank, it's mysterious, it's giving enigmatic main character energy πŸ’€)
  • Example β€” (blank)
  • Returns β€” value of _mode
  • Args β€” newvalue (optional)

🌟 within_element

  • Title β€” within_element
  • Usage β€” if( $eventgenerator->within_element($element) ) {}
  • Function β€” Test if we are within a particular element. This is different than 'in' because within can be tested for a whole block.
  • Returns β€” boolean
  • Args β€” string element name

🌟 in_element

  • Title β€” in_element
  • Usage β€” if( $eventgenerator->in_element($element) ) {}
  • Function β€” Test if we are in a particular element. This is different than 'in' because within can be tested for a whole block.
  • Returns β€” boolean
  • Args β€” string element name

🌟 start_document

  • Title β€” start_document
  • Usage β€” $eventgenerator->start_document
  • Function β€” Handles a start document event
  • Returns β€” none
  • Args β€” none

🌟 end_document

  • Title β€” end_document
  • Usage β€” $eventgenerator->end_document
  • Function β€” Handles an end document event
  • Returns β€” Bio::Search::Result::ResultI object
  • Args β€” none

🌟 idlength

  • Title β€” idlength
  • Usage β€” $obj->idlength($newval)
  • Function β€” Internal storage of the length of the ID desc in the HSP alignment blocks. Defaults to $IDLENGTH class variable value
  • Returns β€” value of idlength
  • Args β€” newvalue (optional)

🌟 result_count

  • Title β€” result_count
  • Usage β€” my $count = $searchio->result_count
  • Function β€” Returns the number of results we have processed
  • Returns β€” integer
  • Args β€” none

🌟 _will_handle

  • Title β€” _will_handle
  • Usage β€” Private method. For internal use only.
   if( $self->_will_handle($type) ) { ... }
  • Function β€” Provides an optimized way to check whether or not an element of a given type is to be handled.
  • Returns β€” Reference to EventHandler object if the element type is to be handled. undef if the element type is not to be handled.
  • Args β€” string containing type of element.

⚑ Optimizations:

  1. Using the cached pointer to the EventHandler to minimize repeated lookups.
  2. Caching the will_handle status for each type that is encountered so that it only need be checked by calling handler->will_handle($type) once.

this does not lead to a major savings by itself (only 5-10%). in combination with other optimizations, or for large parse jobs, the savings good be significant. (yes, good be, that's the original, we stan a typo legacy πŸ’œ)

to test against the unoptimized version, remove the parentheses from around the third term in the ternary " ? : " operator and add two calls to $self->_eventHandler().


🌟 _processHits

  • Title β€” _processHits
  • Usage β€” Private method. For internal use only.
  • Function β€” Process/report any hits/hsps we saw in the top table, not in alignments.
  • Returns β€” nothing.
  • Args β€” array of hits to process.

and that's the whole page bestie!! πŸŽ‰πŸ¦‹βœ¨ this doc was churned out by perl v5.32.1 on 2021-08-15, so shoutout to that era, mwah, love that for us πŸ’…πŸ’– periodt.

πŸ“¦ where this page comes from