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 objectwhile( my $hsp = $hit->next_hsp ) {# process the Bio::Search::HSP::HSPI object}}}
DESCRIPTION
This is a driver for instantiating a parser for report files from sequence database searches. This object serves as a wrapper for the format parsers in Bio::SearchIO::* - you should not need to ever use those format parsers directly. (For people used to the SeqIO system it, we are deliberately using the same pattern).
Once you get a SearchIO object, calling next_result() gives you back a Bio::Search::Result::ResultI compliant object, which is an object that represents one Blast/Fasta/HMMER whatever report.
A list of module names and formats is below:
blast BLAST (WUBLAST, NCBIBLAST,bl2seq)fasta FASTA -m9 and -m0blasttable BLAST -m9 or -m8 output (both NCBI and WUBLAST tabular)megablast MEGABLASTpsl UCSC PSL formatwaba WABA outputaxt AXT formatsim4 Sim4hmmer HMMER2 hmmpfam and hmmsearch or HMMER3 hmmscan and hmmsearchexonerate Exonerate CIGAR and VULGAR formatblastxml NCBI BLAST XMLwise Genewise -genesf format
Also see the SearchIO HOWTO: 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. Send your comments and suggestions preferably to the Bioperl mailing list. Your participation is much appreciated.
[email protected] - General discussionhttp://bioperl.org/wiki/Mailing_lists - About the mailing lists
Support
Please direct usage questions or support issues to the mailing list:
rather than to the module maintainer directly. Many experienced and reponsive experts will be able look at the problem and quickly address it. Please include a thorough description of the problem with code and data examples if at all possible.
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 & Steve Chervitz
Email jason-at-bioperl.org Email sac-at-bioperl.org
APPENDIX
The rest of the documentation details each of the object methods. Internal methods are usually preceded with a _
new
Title : newUsage : my $obj = Bio::SearchIO->new();Function: Builds a new Bio::SearchIO objectReturns : Bio::SearchIO initialized with the correct formatArgs : -file => $filename-format => format-fh => filehandle to attach to-result_factory => object implementing Bio::Factory::ObjectFactoryI-hit_factory => object implementing Bio::Factory::ObjectFactoryI-hsp_factory => object implementing Bio::Factory::ObjectFactoryI-writer => object implementing Bio::SearchIO::SearchWriterI-output_format => output format, which will dynamically load writer-inclusion_threshold => e-value threshold for inclusion in thePSI-BLAST score matrix model-signif => float or scientific notation number to be usedas a P- or Expect value cutoff-check_all_hits => boolean. Check all hits for significance againstsignificance criteria. Default = false.If false, stops processing hits after the firstnon-significant hit or the first hit that failsthe hit_filter call. This speeds parsing,taking advantage of the fact that the hits areprocessed in the order they appear in the report.-min_query_len => integer to be used as a minimum for query sequencelength. Reports with query sequences below thislength 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 in the arguments are passed along to the SearchResultEventBuilder object which holds these factories and sets default ones if none are supplied as arguments.
newFh
Title : newFhUsage : $fh = Bio::SearchIO->newFh(-file=>$filename,-format=>'Format')Function: does a new() followed by an fh()Example : $fh = Bio::SearchIO->newFh(-file=>$filename,-format=>'Format')$result = <$fh>; # read a ResultI objectprint $fh $result; # write a ResultI objectReturns : filehandle tied to the Bio::SearchIO::Fh classArgs :
fh
Title : fhUsage : $obj->fhFunction:Example : $fh = $obj->fh; # make a tied filehandle$result = <$fh>; # read a ResultI objectprint $fh $result; # write a ResultI objectReturns : filehandle tied to the Bio::SearchIO::Fh classArgs :
format
Title : formatUsage : $format = $obj->format()Function: Get the search formatReturns : search formatArgs : none
attach_EventHandler
Title : attach_EventHandlerUsage : $parser->attatch_EventHandler($handler)Function: Adds an event handler to listen for eventsReturns : noneArgs : Bio::SearchIO::EventHandlerI
See Bio::SearchIO::EventHandlerI
_eventHandler
Title : _eventHandlerUsage : privateFunction: Get the EventHandlerReturns : Bio::SearchIO::EventHandlerIArgs : none
See Bio::SearchIO::EventHandlerI
next_result
Title : next_resultUsage : $result = stream->next_resultFunction: Reads the next ResultI object from the stream and returns it.Certain driver modules may encounter entries in the stream thatare either misformatted or that use syntax not yet understoodby the driver. If such an incident is recoverable, e.g., bydismissing a feature of a feature table or some other non-mandatorypart of an entry, the driver will issue a warning. In the caseof a non-recoverable situation an exception will be thrown.Do not assume that you can resume parsing the same stream aftercatching the exception. Note that you can always turn recoverableerrors into exceptions by calling $stream->verbose(2) (seeBio::Root::RootI POD page).Returns : A Bio::Search::Result::ResultI objectArgs : n/a
See Bio::Root::RootI
write_result
Title : write_resultUsage : $stream->write_result($result_result, @other_args)Function: Writes data from the $result_result object into the stream.: Delegates to the to_string() method of the associated: WriterI object.Returns : 1 for success and 0 for errorArgs : Bio::Search:Result::ResultI object,: plus any other arguments for the WriterThrows : Bio::Root::Exception if a Writer has not been set.
See Bio::Root::Exception
write_report
Title : write_reportUsage : $stream->write_report(SearchIO stream, @other_args)Function: Writes data directly from the SearchIO stream object into the: writer. This is mainly useful if one has multiple ResultI objects: in a SearchIO stream and you don't want to reiterate header/footer: between each call.Returns : 1 for success and 0 for errorArgs : Bio::SearchIO stream object,: plus any other arguments for the WriterThrows : Bio::Root::Exception if a Writer has not been set.
See Bio::Root::Exception
writer
Title : writerUsage : $writer = $stream->writer;Function: Sets/Gets a SearchWriterI object to be used for this searchIO.Returns : 1 for success and 0 for errorArgs : Bio::SearchIO::SearchWriterI object (when setting)Throws : Bio::Root::Exception if a non-Bio::SearchIO::SearchWriterI objectis passed in.
result_count
Title : result_countUsage : $num = $stream->result_count;Function: Gets the number of Blast results that have been successfully parsedat the point of the method call. This is not the total # of resultsin the file.Returns : integerArgs : noneThrows : none
inclusion_threshold
Title : inclusion_thresholdUsage : my $incl_thresh = $isreb->inclusion_threshold;: $isreb->inclusion_threshold(1e-5);Function: Get/Set the e-value threshold for inclusion in the PSI-BLASTscore matrix model (blastpgp) that was used for generating the reportsbeing parsed.Returns : number (real)Default value: $Bio::SearchIO::IteratedSearchResultEventBuilder::DEFAULT_INCLUSION_THRESHOLDArgs : 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 : IntegerArgument : n/a
best_hit_only
Title : best_hit_onlyUsage : 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_hitsUsage : 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)
_load_format_module
Title : _load_format_moduleUsage : *INTERNAL SearchIO stuff*Function: Loads up (like use) a module at run time on demandExample :Returns :Args :
_get_seq_identifiers
Title : _get_seq_identifiersUsage : my ($gi, $acc,$ver) = &_get_seq_identifiers($id)Function: Private function to get the gi, accession, version datafor an ID (if it is in NCBI format)Returns : 3-pule of gi, accession, versionArgs : ID string to process (NCBI format)
_guess_format
Title : _guess_formatUsage : $obj->_guess_format($filename)Function:Example :Returns : guessed format of filename (lower case)Args :