Bio::SearchIO::blastxml.3pm

Langue: en

Version: 2008-06-24 (ubuntu - 07/07/09)

Section: 3 (Bibliothèques de fonctions)

NAME

Bio::SearchIO::blastxml - A SearchIO implementation of NCBI Blast XML parsing.

SYNOPSIS

     use Bio::SearchIO;
     my $searchin = new Bio::SearchIO(-format => 'blastxml',
                                      -file   => 't/data/plague_yeast.bls.xml');
     while( my $result = $searchin->next_result ) {
     }
 
     # one can also request that the parser NOT keep the XML data in memory
     # by using the tempfile initialization flag.
     my $searchin = new Bio::SearchIO(-tempfile => 1,
                                      -format => 'blastxml',
                                      -file   => 't/data/plague_yeast.bls.xml');
     while( my $result = $searchin->next_result ) {
     }
 
 

DESCRIPTION

This object implements a NCBI Blast XML parser. It requires XML::SAX; it is also recommended (for faster parsing) that XML::SAX::ExpatXS be installed and set as the default parser in ParserDetails.ini. This file is located in the SAX subdirectory of XML in your local perl library (normally in the 'site' directory). Currently, XML::SAX::Expat will NOT work as expected if set as default; you must have local copies of the NCBI DTDs if using XML::SAX::Expat.

There is one additional initialization flag from the SearchIO defaults - that is the -tempfile flag. If specified as true, then the parser will write out each report to a temporary filehandle rather than holding the entire report as a string in memory. The reason this is done in the first place is NCBI reports have an uncessary <?xml version=``1.0''?> at the beginning of each report and RPS-BLAST reports have an additional unecessary RPS-BLAST tag at the top of each report. So we currently have implemented the work around by preparsing the file (yes it makes the process slower, but it works).

DEPENDENCIES

In addition to parts of the Bio:: hierarchy, this module uses:
  XML::SAX
 
 

It is also recommended that XML::SAX::ExpatXS be installed and made the default XML::SAX parser using , along with the Expat library () for faster parsing. XML::SAX::Expat is not recommended; XML::SAX::ExpatXS is considered the current replacement for XML::SAX:Expat and is actively being considered to replace XML::SAX::Expat. XML::SAX::Expat will work, but only if you have local copies of the NCBI BLAST DTDs. This is due to issues with NCBI's BLAST XML format. The DTDs and the web address to obtain them are:

   NCBI_BlastOutput.dtd      
   NCBI_BlastOutput.mod.dtd
 
   http://www.ncbi.nlm.nih.gov/data_specs/dtd/
 
 

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/wiki/Mailing_lists  - 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 the web:

   http://bugzilla.open-bio.org/
 
 

AUTHOR - Jason Stajich

Email jason-at-bioperl.org

APPENDIX

The rest of the documentation details each of the object methods. Internal methods are usually preceded with a _

new

  Title   : new
  Usage   : my $searchio = new Bio::SearchIO(-format => 'blastxml',
                                             -file   => 'filename',
                                             -tempfile => 1);
  Function: Initializes the object - this is chained through new in SearchIO
  Returns : Bio::SearchIO::blastxml object
  Args    : One additional argument from the format and file/fh parameters.
            -tempfile => boolean.  Defaults to false.  Write out XML data
                                   to a temporary filehandle to send to 
                                   PerlSAX parser.
 
 

_initialize

  Title   : _initialize
  Usage   : private
  Function: Initializes the object - this is chained through new in SearchIO
 
 

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
 
 

SAX methods


start_document

  Title   : start_document
  Usage   : $parser->start_document;
  Function: SAX method to indicate starting to parse a new document
  Returns : none
  Args    : none
 
 

end_document

  Title   : end_document
  Usage   : $parser->end_document;
  Function: SAX method to indicate finishing parsing a new document
  Returns : Bio::Search::Result::ResultI object
  Args    : none
 
 

start_element

  Title   : start_element
  Usage   : $parser->start_element($data)
  Function: SAX method to indicate starting a new element
  Returns : none
  Args    : hash ref for data
 
 

end_element

  Title   : end_element
  Usage   : $parser->end_element($data)
  Function: Signals finishing an element
  Returns : Bio::Search object dpending on what type of element
  Args    : hash ref for data
 
 

characters

  Title   : characters
  Usage   : $parser->characters($data)
  Function: Signals new characters to be processed
  Returns : characters read
  Args    : hash ref with the key 'Data'
 
 

use_tempfile

  Title   : use_tempfile
  Usage   : $obj->use_tempfile($newval)
  Function: Get/Set boolean flag on whether or not use a tempfile
  Example : 
  Returns : value of use_tempfile
  Args    : newvalue (optional)