Bio::S...:blast(3pm)
π 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, andbl2seqreports π (NCBI XML BLAST output is parsed with theblastxmlSearchIO 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::blastobject β¨ - 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 aBio::Search::Hit::BlastHit.pmobject 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::ResultIobject - 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.
undefif the element type is not to be handled. - Args: string containing type of element.
Optimizations:
- Using the cached pointer to the EventHandler to minimize repeated lookups.
- 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::ResultIobject - 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.0001or1e-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
-signifparameter supplied tonew(). 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
-scoreparameter supplied tonew(). 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_lenparameter supplied tonew(). 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
- debian bookworm: libbio-perl-perl 1.7.8-1 Β· Perl
- debian trixie: libbio-perl-perl 1.7.8-1 Β· Perl
- ubuntu jammy: libbio-perl-perl 1.7.8-1 Β· Perl
- ubuntu noble: libbio-perl-perl 1.7.8-1 Β· Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms