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 toBio::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, [email protected]
Contributors
Hilmar Lapp, hlapp at gmx.net
APPENDIX
The rest of the documentation details each of the object methods. Internal methods are usually preceded with a _
term_factory
Title : term_factoryUsage : $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 thismethod as there will be default. In order to change thedefault, the easiest way is to instantiateL<Bio::Ontology::TermFactory> with the proper -typeargument. Most if not all parsers will actually use thisvery implementation, so even easier than the aforementionedway 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 : dbUsage : $obj->db($newval)Function: Sets or retrieves the database adaptor factory.The adaptor factory is a Bio::DB::DBAdaptorI compliantobject and will be used to obtain the persistence adaptorsnecessary to serialize terms and relationships to thedatabase.Usually, you will obtain such an object from a call toBio::DB::BioDB. You *must* set this property beforestarting the parse.Note that this property is immutable once set, except thatyou may set it to undef. Therefore, be careful not to setto 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 objector undef, optional)
persist_term_handler
Title : persist_term_handlerUsage : $obj->persist_term_handler($handler,@args)Function: Sets or retrieves the persistence handler for terms alongwith the constant set of arguments to be passed to thehandler.If set, the first argument will be treated as a closure andbe called for each term to persist to the database. Theterm will be passed as a named parameter (-term), followedby the other arguments passed to this setter. Note thatthis allows one to pass an arbitrary configuration to thehandler.If not set, terms will be persisted along with theirrelationships using the respective persistence adaptorreturned by the adaptor factory (see property db).Example :Returns : an array reference with the values passed on set, or an emptyarray if never setArgs : On set, an array of values. The first value is the handleras a closure; all other values will be passed to the handleras constant argument.
persist_relationship_handler
Title : persist_relationship_handlerUsage : $obj->persist_relationship_handler($handler,@args)Function: Sets or retrieves the persistence handler for relationshipsalong with the constant set of arguments to be passed tothe handler.If set, the first argument will be treated as a closure andbe called for each relationship to persist to the database. Therelationship will be passed as a named parameter (-rel), followedby the other arguments passed to this setter. Note thatthis allows one to pass an arbitrary configuration to thehandler.If not set, relationships will be persisted along with theirrelationships using the respective persistence adaptorreturned by the adaptor factory (see property db).Example :Returns : an array reference with the values passed on set, or an emptyarray if never setArgs : On set, an array of values. The first value is the handleras a closure; all other values will be passed to the handleras constant argument.
_persist_term
Title : _persist_termUsage :Function: Persists a term to the database, using either a previouslyset persistence handler, or the adaptor factory directly.Example :Returns :Args : the ontology term to persist
_persist_relationship
Title : _persist_relationshipUsage :Function: Persists a relationship to the database, using either apreviously set persistence handler, or the adaptor factorydirectly.Example :Returns :Args : the term relationship to persist
_persist_ontology
Title : _persist_ontologyUsage :Function: Perists the ontology itself to the database, by eitherinserting or updating it.Note that this will only create or update the ontology asan entity, not any of its terms, relationships, orrelationship types.Example :Returns : the ontology as a persistent object with primary keyArgs : the ontology to persist as a Bio::Ontology::OntologyIcompliant object