NAME
Bio::SearchIO - Driver for parsing Sequence Database Searches (Blast,FASTA,...)
SYNOPSIS
use Bio::SearchIO;
my $searchio = new Bio::SearchIO( -format => 'blastxml',
-file => 'blastout.xml' );
while ( my $result = $searchio->next_result() ) {
while( my $hit = $result->next_hit ) {
# process the Bio::Search::HitI object
while( my $align = $sbjct->next_align ) {
# process the Bio::Search::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.
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.
bioperl-l@bioperl.org - General discussion
http://bioperl.org/MailList.shtml - About the mailing lists
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 email or the web:
bioperl-bugs@bioperl.org
http://bioperl.org/bioperl-bugs/
AUTHOR - Jason Stajich & Steve Chervitz
Email jason@bioperl.org Email sac@bioperl.org
CONTRIBUTORS
Additional contributors names and emails here
APPENDIX
The rest of the documentation details each of the object methods. Internal methods are usually preceded with a _
new
Title : new
Usage : my $obj = new Bio::SearchIO();
Function: Builds a new Bio::SearchIO object
Returns : Bio::SearchIO initialized with the correct format
Args : Args : -file => $filename
-format => format
-fh => filehandle to attach to
-result_factory => Object implementing Bio::Factory::ResultFactoryI
-hit_factory => Object implementing Bio::Factory::HitFactoryI
-writer => Object implementing Bio::SearchIO::SearchWriterI
See Bio::Factory::ResultFactoryI, Bio::Factory::HitFactoryI, Bio::SearchIO::SearchWriterI
newFh
Title : newFh
Usage : $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 object
print $fh $result; # write a ResultI object
Returns : filehandle tied to the Bio::SearchIO::Fh class
Args :
fh
Title : fh
Usage : $obj->fh
Function:
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::Fh class
Args :
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
_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 ResultI object from the stream and returns it.
Certain driver modules may encounter entries in the stream that
are either misformatted or that use syntax not yet understood
by the driver. If such an incident is recoverable, e.g., by
dismissing a feature of a feature table or some other non-mandatory
part of an entry, the driver will issue a warning. In the case
of a non-recoverable situation an exception will be thrown.
Do not assume that you can resume parsing the same stream after
catching the exception. Note that you can always turn recoverable
errors into exceptions by calling $stream->verbose(2) (see
Bio::Root::RootI POD page).
Returns : A Bio::Search::Result::ResultI object
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_result object into the stream.
: Delegates to the to_string() method of the associated
: WriterI object.
Returns : 1 for success and 0 for error
Args : Bio::Search:Result::ResultI object,
: plus any other arguments for the Writer
Throws : Bio::Root::Exception if a Writer has not been set.
writer
Title : writer
Usage : $writer = $stream->writer;
Function: Sets/Gets a SearchWriterI object to be used for this searchIO.
Returns : 1 for success and 0 for error
Args : Bio::SearchIO::SearchWriterI object (when setting)
Throws : Bio::Root::Exception if a non-Bio::SearchIO::SearchWriterI object
is passed in.
hit_factory
Title : hit_factory
Usage : $hit_factory = $stream->hit_factory; (get)
: $stream->hit_factory( $factory ); (set)
Function: Sets/Gets a factory object to create hit objects for this SearchIO
Returns : Bio::Factory::HitFactoryI object
Args : Bio::Factory::HitFactoryI object (when setting)
Throws : Bio::Root::Exception if a non-Bio::Factory::HitFactoryI object
is passed in.
Comments: A SearchIO implementation should provide a default hit factory.
result_factory
Title : result_factory
Usage : $result_factory = $stream->result_factory; (get)
: $stream->result_factory( $factory ); (set)
Function: Sets/Gets a factory object to create result objects for this
SearchIO.
Returns : Bio::Factory::ResultFactoryI object
Args : Bio::Factory::ResultFactoryI object (when setting)
Throws : Bio::Root::Exception if a non-Bio::Factory::ResultFactoryI object
is passed in.
Comments: A SearchIO implementation should provide a default result factory.
See Bio::Factory::ResultFactoryI
default_hit_factory_class
Title : default_hit_factory_class
Usage : $res_factory = $obj->default_hit_factory_class()->new( @args )
Function: Returns the name of the default class to be used for creating
Bio::Search::Hit::HitI objects.
Example :
Returns : A string containing the name of a class that implements
the Bio::Search::Hit::HitI interface.
Args : none
Comments: Bio::SearchIO does not implement this method. It throws a
NotImplemented exception
_load_format_module
Title : _load_format_module
Usage : *INTERNAL SearchIO stuff*
Function: Loads up (like use) a module at run time on demand
Example :
Returns :
Args :
_guess_format
Title : _guess_format
Usage : $obj->_guess_format($filename)
Function:
Example :
Returns : guessed format of filename (lower case)
Args :