Bio::OntologyIO::Handlers::InterPro_BioSQL_Handler(3)

NAME
Bio::OntologyIO::Handlers::InterPro_BioSQL_Handler - parse an InterPro XML file and persist the resulting terms to a Biosql database

SYNOPSIS
   # see load_interpro.pl in bioperl-db/scripts/biosql/

DESCRIPTION
This module is for parsing an InterPro XML file and persist the resulting terms to a Biosql database as soon as the term is complete as signaled by the appropriate xml tag. This parser takes advantage of SAX, a stream-based XML parser technology, to keep the used memory as small as possible. The alternative parser for InterPro, module InterProHandler, builds up the entire ontology in memory, which given the size of the latest InterPro releases requires a huge amount of memory.

This module takes the following non-standard arguments upon instantiation.

   -db           the adaptor factory as returned by a call to
                 Bio::DB::BioDB->new()
   -version      the InterPro version (not available as property!)
   -term_factory the object factory to use for creating terms

Note that there are two alternatives for how to persist the terms and relationships to the database. The default is using the adaptor factory passed as -db or set as a property to create persistent objects and store them in the database. The alternative is to specify a term persistence and a relationship persistence handler; if one or both have been set, the respective handler will be called with each term and relationship that is to be stored. See properties persist_term_handler and persist_relationship_handler.

AUTHOR
Juguang Xiao, juguang@tll.org.sg

Contributors
Hilmar Lapp, hlapp at gmx.net

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

  term_factory
 Title   : term_factory
 Usage   : $obj->term_factory($newval)
 Function: Get/set the ontology term factory to use.

           As a user of this module it is not necessary to call this
           method as there will be default. In order to change the
           default, the easiest way is to instantiate
           L<Bio::Ontology::TermFactory> with the proper -type
           argument. Most if not all parsers will actually use this
           very implementation, so even easier than the aforementioned
           way is to simply call
           $ontio->term_factory->type("Bio::Ontology::MyTerm").

 Example :
 Returns : value of term_factory (a Bio::Factory::ObjectFactoryI object)
 Args    : on set, new value (a Bio::Factory::ObjectFactoryI object, optional)

  db
 Title   : db
 Usage   : $obj->db($newval)
 Function: Sets or retrieves the database adaptor factory.

           The adaptor factory is a Bio::DB::DBAdaptorI compliant
           object and will be used to obtain the persistence adaptors
           necessary to serialize terms and relationships to the
           database.

           Usually, you will obtain such an object from a call to
           Bio::DB::BioDB. You *must* set this property before
           starting the parse.

           Note that this property is immutable once set, except that
           you may set it to undef. Therefore, be careful not to set
           to undef before setting the desired real value.

 Example :
 Returns : value of db (a Bio::DB::DBAdaptorI compliant object)
 Args    : on set, new value (a Bio::DB::DBAdaptorI compliant object
           or undef, optional)

  persist_term_handler
 Title   : persist_term_handler
 Usage   : $obj->persist_term_handler($handler,@args)
 Function: Sets or retrieves the persistence handler for terms along
           with the constant set of arguments to be passed to the
           handler.

           If set, the first argument will be treated as a closure and
           be called for each term to persist to the database. The
           term will be passed as a named parameter (-term), followed
           by the other arguments passed to this setter. Note that
           this allows one to pass an arbitrary configuration to the
           handler.

           If not set, terms will be persisted along with their
           relationships using the respective persistence adaptor
           returned by the adaptor factory (see property db).

 Example :
 Returns : an array reference with the values passed on set, or an empty
           array if never set
 Args    : On set, an array of values. The first value is the handler
           as a closure; all other values will be passed to the handler
           as constant argument.

  persist_relationship_handler
 Title   : persist_relationship_handler
 Usage   : $obj->persist_relationship_handler($handler,@args)
 Function: Sets or retrieves the persistence handler for relationships
           along with the constant set of arguments to be passed to
           the handler.

           If set, the first argument will be treated as a closure and
           be called for each relationship to persist to the database. The
           relationship will be passed as a named parameter (-rel), followed
           by the other arguments passed to this setter. Note that
           this allows one to pass an arbitrary configuration to the
           handler.

           If not set, relationships will be persisted along with their
           relationships using the respective persistence adaptor
           returned by the adaptor factory (see property db).

 Example :
 Returns : an array reference with the values passed on set, or an empty
           array if never set
 Args    : On set, an array of values. The first value is the handler
           as a closure; all other values will be passed to the handler
           as constant argument.

  _persist_term
 Title   : _persist_term
 Usage   :
 Function: Persists a term to the database, using either a previously
           set persistence handler, or the adaptor factory directly.
 Example :
 Returns :
 Args    : the ontology term to persist

  _persist_relationship
 Title   : _persist_relationship
 Usage   :
 Function: Persists a relationship to the database, using either a
           previously set persistence handler, or the adaptor factory
           directly.

 Example :
 Returns :
 Args    : the term relationship to persist

  _persist_ontology
 Title   : _persist_ontology
 Usage   :
 Function: Perists the ontology itself to the database, by either
           inserting or updating it.

           Note that this will only create or update the ontology as
           an entity, not any of its terms, relationships, or
           relationship types.

 Example :
 Returns : the ontology as a peristent object with primary key
 Args    : the ontology to persist as a Bio::Ontology::OntologyI
           compliant object