Bio::SearchIO(3pm)
Bio::SearchIO π β¨
okay bestie, so this is Bio::SearchIO, a User Contributed Perl Documentation page, and it's literally your driver for parsing Sequence Database Searches (BLAST, FASTA, ...). no cap. buckle up π
β¨ NAME β¨
Bio::SearchIO β Driver for parsing Sequence Database Searches (BLAST, FASTA, ...)
π¦ SYNOPSIS π¦
use Bio::SearchIO;
# format can be 'fasta', 'blast', 'exonerate', ...
my $searchio = Bio::SearchIO->new( -format => 'blastxml',
-file => 'blastout.xml' );
while ( my $result = $searchio->next_result() ) {
while( my $hit = $result->next_hit ) {
# process the Bio::Search::Hit::HitI object
while( my $hsp = $hit->next_hsp ) {
# process the Bio::Search::HSP::HSPI object
}
}
}
π DESCRIPTION π
So basically this is a driver for instantiating a parser for report files from sequence database searches. This object is serving as a wrapper for the format parsers in Bio::SearchIO::* β and bestie, you should not ever need to touch those format parsers directly, fr fr. (and if you're one of the people who's used the SeqIO system before: yes, we are deliberately using the same pattern, it's giving intentional π
).
Once you get a SearchIO object, calling next_result() hands you back a Bio::Search::Result::ResultI compliant object, which is an object that represents one Blast/Fasta/HMMER whatever report. one report = one object, iconic behavior β¨
A list of module names and formats is below, keep scrolling:
blast BLAST (WUBLAST, NCBIBLAST,bl2seq)
fasta FASTA -m9 and -m0
blasttable BLAST -m9 or -m8 output (both NCBI and WUBLAST tabular)
megablast MEGABLAST
psl UCSC PSL format
waba WABA output
axt AXT format
sim4 Sim4
hmmer HMMER2 hmmpfam and hmmsearch or HMMER3 hmmscan and hmmsearch
exonerate Exonerate CIGAR and VULGAR format
blastxml NCBI BLAST XML
wise Genewise -genesf format
Also see the SearchIO HOWTO, it's lowkey a whole mood: http://bioperl.org/howtos/SearchIO_HOWTO.html
π«Ά FEEDBACK π«Ά
π Mailing Lists π
User feedback is an integral part of the evolution of this and other Bioperl modules β like, genuinely, your voice matters here π₯Ή. Send your comments and suggestions preferably to the Bioperl mailing list. Your participation is much appreciated, no joke.
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. there are so many experienced and responsive experts who will be able look at the problem and quickly address it β let the group chat cook π. Please include a thorough description of the problem with code and data examples if at all possible, bc vague bug reports are not the vibe π.
π Reporting Bugs π
Report bugs to the Bioperl bug tracking system to help us keep track of the bugs and their resolution β gotta keep receipts, bestie. Bug reports can be submitted via the web:
https://github.com/bioperl/bioperl-live/issues
β AUTHOR - Jason Stajich & Steve Chervitz β
Email jason-at-bioperl.org Email sac-at-bioperl.org
π APPENDIX π
okay so this is the part where we go method by method, bestie. every last one of them. internal methods get a lil _ in front, that's the whole vibe.
β¨ new β¨
- Title:
new - Usage:
my $obj = Bio::SearchIO->new(); - Function: builds you a brand spankin' new
Bio::SearchIOobject, no cap - Returns: a
Bio::SearchIOthat's already initialized with the correct format π - Args:
-file=> $filename-format=> format-fh=> filehandle to attach to-result_factory=> object implementingBio::Factory::ObjectFactoryI-hit_factory=> object implementingBio::Factory::ObjectFactoryI-hsp_factory=> object implementingBio::Factory::ObjectFactoryI-writer=> object implementingBio::SearchIO::SearchWriterI-output_format=> output format, which will dynamically load writer-inclusion_threshold=> e-value threshold for inclusion in the PSI-BLAST score matrix model-signif=> float or scientific notation number to be used as a P- or Expect value cutoff-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 thehit_filtercall. 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.
See Bio::Factory::ObjectFactoryI, Bio::SearchIO::SearchWriterI
Any factory objects you hand over in the arguments get passed along to the SearchResultEventBuilder object, which holds all these factories and quietly sets up default ones if you didn't supply any as arguments. she's got you either way π«Ά
β¨ newFh β¨
- Title:
newFh - Usage:
$fh = Bio::SearchIO->newFh(-file=>$filename, -format=>'Format') - Function: does a
new()and then anfh()β two for one, we love efficiency - Example:
$fh = Bio::SearchIO->newFh(-file=>$filename,
-format=>'Format')
$result = <$fh>; # read a ResultI object
print $fh $result; # write a ResultI object
- Returns: filehandle tied to the
Bio::SearchIO::Fhclass - Args: (nothing, bestie, it's empty)
β¨ fh β¨
- Title:
fh - Usage:
$obj->fh - Function: (it's giving mysterious, there's nothing here)
- Example:
$fh = $obj->fh; # make a tied filehandle
$result = <$fh>; # read a ResultI object
print $fh $result; # write a ResultI object
- Returns: filehandle tied to the
Bio::SearchIO::Fhclass - Args: (also empty)
β¨ format β¨
- Title:
format - Usage:
$format = $obj->format() - Function: get the search format
- Returns: search format
- Args: none
β¨ attach_EventHandler β¨
- Title:
attach_EventHandler - Usage:
$parser->attatch_EventHandler($handler) - Function: adds an event handler to listen for events π
- Returns: none
- Args:
Bio::SearchIO::EventHandlerI
See Bio::SearchIO::EventHandlerI
yes, the usage line really does say attatch_EventHandler with two t's. we keep it exactly as-is, that's the law around here π
β¨ _eventHandler β¨
- Title:
_eventHandler - Usage: private
- Function: get the EventHandler
- Returns:
Bio::SearchIO::EventHandlerI - Args: none
See Bio::SearchIO::EventHandlerI
β¨ next_result β¨
- Title:
next_result - Usage:
$result = stream->next_result - Function: reads the next
ResultIobject from the stream and returns it.
lowkey important warning time: certain driver modules may run into entries in the stream that are either misformatted or that use syntax the driver doesn't understand yet. If that incident is recoverable β like, say, by dismissing a feature of a feature table or some other non-mandatory part of an entry β the driver will issue a warning. But if it's a non-recoverable situation, an exception gets thrown. and listen: do not assume you can just resume parsing the same stream after you catch that exception. π the good news is you can always turn recoverable errors into exceptions by calling $stream->verbose(2) (peep the Bio::Root::RootI POD page for that).
- Returns: A
Bio::Search::Result::ResultIobject - Args: n/a
See Bio::Root::RootI
β¨ write_result β¨
- Title:
write_result - Usage:
$stream->write_result($result_result, @other_args) - Function: writes data from the
$result_resultobject into the stream. Delegates to theto_string()method of the associatedWriterIobject. - Returns:
1for success and0for error - Args:
Bio::Search:Result::ResultIobject, plus any other arguments for the Writer - Throws:
Bio::Root::Exceptionif a Writer has not been set. π
See Bio::Root::Exception
β¨ write_report β¨
- Title:
write_report - Usage:
$stream->write_report(SearchIO stream, @other_args) - Function: writes data directly from the
SearchIOstream object into the writer. this one's mainly useful if you've got multipleResultIobjects chilling in aSearchIOstream and you do not want to keep re-iterating header/footer between each call. - Returns:
1for success and0for error - Args:
Bio::SearchIOstream object, plus any other arguments for the Writer - Throws:
Bio::Root::Exceptionif a Writer has not been set. π
See Bio::Root::Exception
β¨ writer β¨
- Title:
writer - Usage:
$writer = $stream->writer; - Function: sets/gets a
SearchWriterIobject to be used for this searchIO - Returns:
1for success and0for error - Args:
Bio::SearchIO::SearchWriterIobject (when setting) - Throws:
Bio::Root::Exceptionif a non-Bio::SearchIO::SearchWriterIobject is passed in. we do not accept imposters here π«
β¨ result_count β¨
- Title:
result_count - Usage:
$num = $stream->result_count; - Function: gets the number of Blast results that have been successfully parsed at the point of the method call. this is not the total # of results in the file, bestie, read that twice π
- Returns: integer
- Args: none
- Throws: 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 the significance screening cutoff. this is the value of the
-signifparameter you supplied tonew(). hits with a P or E-value above this get skipped, sorry babes βοΈ - 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 β¨
just a synonym for max_significance(). same girl, different name π
β¨ min_score β¨
- Usage:
$obj->min_score(); - Purpose: set/get the Blast score used as the screening cutoff. this is the value of the
-scoreparameter you supplied tonew(). hits with scores below this get 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 the screening criteria. this is the value of the
-min_query_lenparameter you supplied tonew(). hits with a sequence length below this get 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 first non-significance hit or the first hit that fails any hit filter.
- Returns: boolean (
1|0) - Argument: boolean (
1|0) (when setting)
β¨ _load_format_module β¨
- Title:
_load_format_module - Usage: INTERNAL SearchIO stuff
- Function: loads up (like
use) a module at run time on demand - Example: (empty)
- Returns: (empty)
- Args: (empty)
β¨ _get_seq_identifiers β¨
- Title:
_get_seq_identifiers - Usage:
my ($gi, $acc,$ver) = &_get_seq_identifiers($id) - Function: private function to get the gi, accession, version data for an ID (if it's in NCBI format)
- Returns: 3-pule of gi, accession, version
- Args: ID string to process (NCBI format)
β¨ _guess_format β¨
- Title:
_guess_format - Usage:
$obj->_guess_format($filename) - Function: (empty, she's shy)
- Example: (empty)
- Returns: guessed format of filename (lower case)
- Args: (empty)
and that's a wrap on the whole page, bestie!! πβ¨ you just read Bio::SearchIO(3pm) β shipped as perl v5.32.1, dated 2021-08-15. go forth and parse some search results, you absolute icon ππ¦π periodt.
π¦ 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