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

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

πŸ’– Bio::SearchIO::blast πŸ’–

the blast driver from Bio::SearchIO β€” aka the perl manual page for Bio::S...:blast(3pm), straight out of the User Contributed Perl Documentation ✨


✨ NAME ✨

Bio::SearchIO::blast β€” event generator for event based parsing of blast reports 🧬


🌸 SYNOPSIS 🌸

okay so bestie, listen: do NOT use this object directly πŸ™… it's a behind-the-scenes girlie that lives inside the Bio::SearchIO system 🫢

# Do not use this object directly - it is used as part of the
# Bio::SearchIO system.

 use Bio::SearchIO;
 my $searchio = Bio::SearchIO->new(-format => 'blast',
                                  -file   => 't/data/ecolitst.bls');
 while( my $result = $searchio->next_result ) {
     while( my $hit = $result->next_hit ) {
         while( my $hsp = $hit->next_hsp ) {
             # ...
         }
     }
 }

look at that nested loop situation πŸ’… results β†’ hits β†’ hsp's, like a little matryoshka of science πŸŽ€


πŸ¦‹ DESCRIPTION πŸ¦‹

so this object encapsulates all the necessary methods for generating events β€” the kind of events you need to build up Bio::Search objects from a BLAST report file πŸ“„βœ¨ Read the Bio::SearchIO docs for more info on how to actually use this, bestie, iykyk.

This driver can parse:

  • NCBI produced plain text BLAST reports from blastall β€” and yes that includes PSIBLAST, PSITBLASTN, RPSBLAST, and bl2seq reports πŸ’– (NCBI XML BLAST output is parsed with the blastxml SearchIO driver, different girl, different vibe)
  • WU-BLAST all reports πŸ”₯
  • Jim Kent's BLAST-like output from his programs (BLASTZ, BLAT) πŸ‘‘
  • BLAST-like output from Paracel BTK output 🌈

🧚 bl2seq parsing

okay so real talk: since I cannot differentiate between BLASTX and TBLASTN β€” because bl2seq doesn't report which algorithm was used 😭 β€” I just assume it's BLASTX by default. but you can supply the program type yourself with -report_type in the Bio::SearchIO constructor, like:

my $parser = Bio::SearchIO->new(-format => 'blast',
                               -file => 'bl2seq.tblastn.report',
                               -report_type => 'tblastn');

and the tea is: this only really affects where the frame and strand information are put 🧡 β€” they'll always be on the $hsp->query instead of on the $hsp->hit part of the feature pair, for blastx and tblastn bl2seq produced reports. hope that's clear... πŸ™ˆ (it's giving "trust me bro" but it's actually correct, fr fr)


πŸ’Œ 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, no cap πŸ’–

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 so many experienced and responsive experts will be able look at the problem and quickly address it. and bestie, please include a thorough description of the problem with code and data examples if at all possible πŸ“Ž β€” it's giving helpful, it's giving efficient, it's giving slay.

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


πŸ‘‘ AUTHOR - Jason Stajich πŸ‘‘

email Jason Stajich jason-at-bioperl.org πŸ’Œ


🌟 CONTRIBUTORS 🌟

Steve Chervitz sac-at-bioperl.org πŸŽ€

✨ APPENDIX ✨

ok bestie, this is the deep-lore part πŸ’– the rest of the documentation goes through every single object method, one by one. Internal methods β€” the ones that are lowkey just the module handling its own business β€” usually get an underscore _ in front of their name. iykyk.


πŸŽ€ new

  • Title: new
  • Usage:
my $obj = Bio::SearchIO::blast->new(%args);
  • Function: Builds a brand-new Bio::SearchIO::blast object ✨
  • Returns: Bio::SearchIO::blast
  • Args: key-value pairs, and here's the whole menu, no skips:
    • -fh/-file => filehandle/filename to BLAST file
    • -format => 'blast'
    • -report_type => 'blastx', 'tblastn', etc -- only for bl2seq reports when you want to distinguish between tblastn and blastx reports (this only controls where the frame information is put - on the query or subject object.
    • -inclusion_threshold => e-value threshold for inclusion in the PSI-BLAST score matrix model (blastpgp)
    • -signif => float or scientific notation number to be used as a P- or Expect value cutoff
    • -score => integer or scientific notation number to be used as a blast score value cutoff
    • -bits => integer or scientific notation number to be used as a bit score value cutoff
    • -hit_filter => reference to a function to be used for filtering hits based on arbitrary criteria. All hits of each BLAST report must satisfy this criteria to be retained. If a hit fails this test, it is ignored. This function should take a Bio::Search::Hit::BlastHit.pm object as its first argument and return true if the hit should be retained.

Sample filter function:

   -hit_filter => sub { $hit = shift;
                        $hit->gaps == 0; },

(Note: -filt_func is synonymous with -hit_filter)

  • -overlap => integer. The amount of overlap to permit between adjacent HSPs when tiling HSPs. A reasonable value is 2. Default = $Bio::SearchIO::blast::MAX_HSP_OVERLAP.

The following criteria are not yet supported πŸ™ˆ (these are probably best applied within this module rather than in the event handler since they would permit the parser to take some shortcuts.)

  • -check_all_hits => boolean. Check all hits for significance against significance criteria. Default = false. If false, stops processing hits after the first non-significant hit or the first hit that fails the hit_filter call. This speeds parsing, taking advantage of the fact that the hits are processed in the order they appear in the report.
  • -min_query_len => integer to be used as a minimum for query sequence length. Reports with query sequences below this length will not be processed. Default = no minimum length.
  • -best => boolean. Only process the best hit of each report; default = false.

πŸ¦‹ 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

πŸ’… _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.

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().


🌸 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: end_element
  • Usage: $eventgenerator->end_element
  • Function: Handles an end element event
  • Returns: hashref with an element's worth of data
  • Args: hashref with at least 2 keys 'Data' and 'Name'

🧚 element

  • Title: element
  • Usage: $eventhandler->element({'Name' => $name, 'Data' => $str});
  • Function: Convenience method that calls start_element, characters, end_element
  • Returns: none
  • Args: Hash ref with the keys 'Name' and 'Data'

⭐ characters

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

πŸ’œ 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

See Also: in_element


🫢 in_element

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

See Also: within_element


πŸ“ start_document

  • Title: start_document
  • Usage: $eventgenerator->start_document
  • Function: Handle 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

πŸ‘‘ inclusion_threshold

  • Title: inclusion_threshold
  • Usage:
my $incl_thresh = $isreb->inclusion_threshold;
$isreb->inclusion_threshold(1e-5);
  • Function: Get/Set the e-value threshold for inclusion in the PSI-BLAST score matrix model (blastpgp) that was used for generating the reports being parsed.
  • Returns: number (real). Default value: $Bio::SearchIO::IteratedSearchResultEventBuilder::DEFAULT_INCLUSION_THRESHOLD
  • Args: number (real) (e.g., 0.0001 or 1e-4 )

πŸ’– max_significance

  • Usage: $obj->max_significance();
  • Purpose: Set/Get the P or Expect value used as significance screening cutoff. This is the value of the -signif parameter supplied to new(). Hits with P or E-value above this are skipped.
  • Returns: Scientific notation number with this format: 1.0e-05.
  • Argument: Scientific notation number or float (when setting)
  • Comments: Screening of significant hits uses the data provided on the description line. For NCBI BLAST1 and WU-BLAST, this data is P-value. for NCBI BLAST2 it is an Expect value.

🌟 signif

Synonym for max_significance()


✨ min_score

  • Usage: $obj->min_score();
  • Purpose: Set/Get the Blast score used as screening cutoff. This is the value of the -score parameter supplied to new(). Hits with scores below this are skipped.
  • Returns: Integer or scientific notation number.
  • Argument: Integer or scientific notation number (when setting)
  • Comments: Screening of significant hits uses the data provided on the description line.

πŸŽ€ min_query_length

  • Usage: $obj->min_query_length();
  • Purpose: Gets the query sequence length used as screening criteria. This is the value of the -min_query_len parameter supplied to new(). Hits with sequence length below this are skipped.
  • Returns: Integer
  • Argument: n/a

πŸ’« best_hit_only

  • Title: best_hit_only
  • Usage: print "only getting best hit.\n" if $obj->best_hit_only;
  • Purpose: Set/Get the indicator for whether or not to process only the best BlastHit.
  • Returns: Boolean ( 1 | 0 )
  • Argument: Boolean ( 1 | 0 ) (when setting)

πŸ” check_all_hits

  • Title: check_all_hits
  • Usage: print "checking all hits.\n" if $obj->check_all_hits;
  • Purpose: Set/Get the indicator for whether or not to process all hits. If false, the parser will stop processing hits after the the first non-significance hit or the first hit that fails any hit filter.
  • Returns: Boolean ( 1 | 0 )
  • Argument: Boolean ( 1 | 0 ) (when setting)

and that's the whole page, bestie πŸ’… you made it to the very end, which is honestly iconic of you. this one came from the perl v5.32.1 era, dated 2021-08-15, and it's the Bio::S...:blast(3pm) page β€” go forth and parse some BLAST reports, you absolute legend 🫢🌈

πŸ“¦ where this page comes from