Bio::O...andler(3pm)
π Bio::OntologyIO::Handlers::InterPro_BioSQL_Handler π
okay bestie, listen β this page is from the Bio::O...andler(3pm) manual, and it's all about a little module that eats InterPro XML and yeets the terms straight into a BioSQL database. let's get into it β¨
πΈ NAME πΈ
Bio::OntologyIO::Handlers::InterPro_BioSQL_Handler β parse an InterPro XML file and persist the resulting terms to a Biosql database. no cap, that's literally the whole job description π«Ά
β¨ SYNOPSIS β¨
# see load_interpro.pl in bioperl-db/scripts/biosql/
that's it, that's the synopsis π the real tea is in the script.
π¦ DESCRIPTION π¦
okay so this module is for parsing an InterPro XML file and persisting the resulting terms to a Biosql database as soon as the term is complete, as signaled by the appropriate xml tag. she's fast like that β‘
and the way she does it?? this parser takes advantage of SAX, a stream-based XML parser technology, to keep the used memory as small as possible. tiny memory footprint, main character energy π
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. so likeβ¦ choose wisely bestie π
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
heads up: 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-dbor 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 propertiespersist_term_handlerandpersist_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. internal methods are usually preceded with a _ (iykyk π
).
π 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)
so like, you don't have to touch this one β there's a default, she's fine π«Ά but if you wanna switch it up, the easiest route is instantiating L<Bio::Ontology::TermFactory> with the proper -type argument. and honestly most if not all parsers will use this very implementation anyway, so the even-easier move is just calling $ontio->term_factory->type("Bio::Ontology::MyTerm"). slay β¨
π 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)
the adaptor factory is a Bio::DB::DBAdaptorI compliant object, and she's the one who gets you the persistence adaptors you need to serialize terms and relationships into the database. usually you get such an object from a call to Bio::DB::BioDB. and bestie β you must set this property before starting the parse. periodt. π₯
β οΈ ngl this property is immutable once set, except that you may set it toundef. so be careful not to set it toundefbefore setting the desired real value. do not play yourself π
π 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.
if set, the first argument gets treated as a closure and called for each term to persist to the database β the term comes through as a named parameter -term, followed by the other arguments you passed to this setter. which like, lets you pass an arbitrary configuration to the handler. iconic π
if not set, terms will be persisted along with their relationships using the respective persistence adaptor returned by the adaptor factory (see property db).
π§ 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.
same vibe as the term handler but for relationships π if set, the first argument is treated as a closure and called for each relationship to persist to the database. the relationship arrives as a named parameter -rel, followed by the other arguments passed to this setter. again: arbitrary configuration to the handler, love that for us.
if not set, relationships will be persisted along with their relationships using the respective persistence adaptor returned by the adaptor factory (see property db).
π _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
internal method alert β persists a term to the database, using either a previously set persistence handler, or the adaptor factory directly. 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
also internal β persists a relationship to the database, using either a previously set persistence handler, or the adaptor factory directly. 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 persistent object with primary key
Args : the ontology to persist as a Bio::Ontology::OntologyI
compliant object
persists 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. so don't come for her about the missing pieces bestie π
returns: the ontology as a persistent object with primary key. args: the ontology to persist as a Bio::Ontology::OntologyI compliant object. π
and that's the whole page, you're officially an InterPro-to-BioSQL girlie now πΈ
this was perl v5.32.1, dated 2021-08-15, from Bio::O...andler(3pm) β mwah, go forth and parse π
β¨π«Ά
π¦ where this page comes from
- debian bookworm: libbio-perl-perl 1.7.8-1 Β· Perl
- debian trixie: libbio-perl-perl 1.7.8-1 Β· Perl
- ubuntu jammy: libbio-perl-perl 1.7.8-1 Β· Perl
- ubuntu noble: libbio-perl-perl 1.7.8-1 Β· Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms