Bio::O...yEngine(3pm)

πŸ“¦
version 1.7.8 Β· 3 versions
, in debian bookworm, debian trixie, ubuntu jammy, ubuntu noble

πŸ’– Bio::O...yEngine(3pm) πŸ’–

okay so this is a page from the User Contributed Perl Documentation, and bestie, we're talking about Bio::Ontology::SimpleOntologyEngine β€” yes the manpage header literally abbreviates it to Bio::O...yEngine(3pm) because the real name is a lot, and honestly? relatable. anyway, let's get into it, this is part 1 so don't go anywhere 🌸


✨ NAME ✨

Bio::Ontology::SimpleOntologyEngine β€” it's an Implementation of OntologyEngineI interface, no cap 🫢


✨ SYNOPSIS ✨

the vibe check, in code:

my $soe = Bio::Ontology::SimpleOntologyEngine->new;

that's it. that's the whole synopsis. iconic brevity πŸ’…


✨ DESCRIPTION ✨

so this is a "simple" implementation of Bio::Ontology::OntologyEngineI. the quotes around "simple" are doing a lot of work here and we respect them πŸŽ€


✨ FEEDBACK ✨

πŸ“¬ Mailing Lists

User feedback is, like, integral to the evolution of this and other Bioperl modules. so send your comments and suggestions preferably to the Bioperl mailing list. your participation is much appreciated, fr fr πŸ₯Ί

bioperl-l@bioperl.org                  - General discussion
http://bioperl.org/wiki/Mailing_lists  - About the mailing lists

🫢 Support

Please direct usage questions or support issues to the mailing list:

bioperl-l@bioperl.org

rather than to the module maintainer directly. bestie, this is the way β€” there are so many experienced and reponsive experts who will be able look at the problem and quickly address it. and please include a thorough description of the problem with code and data examples if at all possible πŸ™

πŸ› 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:

https://github.com/bioperl/bioperl-live/issues

✨ AUTHOR - Peter Dimitrov ✨

Email dimitrov@gnf.org πŸ‘‘


✨ 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, the underscore ones are the behind-the-scenes girlies) πŸ™ˆ

🌟 new

Title   : new
Usage   : $soe = Bio::Ontology::SimpleOntologyEngine->new;
Function: Initializes the ontology engine.
Example : $soe = Bio::Ontology::SimpleOntologyEngine->new;
Returns : Object of class SimpleOntologyEngine.
Args    :

so you call new, it initializes the ontology engine, and you get back an object of class SimpleOntologyEngine. main character energy ✨

🌟 _instantiated_terms_store

Title   : _instantiated_terms_store
Usage   : $obj->_instantiated_terms_store($newval)
Function:
Example :
Returns : hash
Args    : empty hash

returns a hash, args are an empty hash. that's the whole story πŸ“

🌟 mark_instantiated

Title   : mark_instantiated
Usage   : $self->mark_instantiated(TermI terms): TermI
Function: Marks TermI objects as fully instantiated,
          allowing for proper counting of the number of terms in the term store.
          The TermI objects has to be already stored in the term store in order
          to be marked.
Example : $self->mark_instantiated($term);
Returns : its argument or throws an exception if a term is not
          in the term store.
Args    : array of objects of class TermI.

so this marks TermI objects as fully instantiated, which lets the engine count the number of terms in the term store properly. important: the TermI objects has to be already stored in the term store in order to be marked β€” like, you can't mark a term that isn't in the store, okay? it returns its argument, or throws an exception if a term is not in the term store πŸ’€

🌟 mark_uninstantiated

Title   : mark_uninstantiated
Usage   : $self->mark_uninstantiated(TermI terms): TermI
Function: Marks TermI objects as not fully instantiated,
Example : $self->mark_uninstantiated($term);
Returns : its argument or throws an exception if a term is not
          in the term store(if the term is not marked it does nothing).
Args    : array of objects of class TermI.

the opposite of the last one β€” marks TermI objects as not fully instantiated. returns its argument, or throws an exception if a term is not in the term store (and if the term is not marked it does nothing, so, chill) 😌

🌟 _term_store

Title   : term_store
Usage   : $obj->_term_store($newval)
Function:
Example :
Returns : reference to an array of Bio::Ontology::TermI objects
Args    : reference to an array of Bio::Ontology::TermI objects

returns a reference to an array of Bio::Ontology::TermI objects, and takes the same as an arg. cute symmetry πŸ¦‹

🌟 add_term

Title   : add_term
Usage   : add_term(TermI term): TermI
Function: Adds TermI object to the ontology engine term store.
Marks the term fully instantiated by default.
Example : $soe->add_term($term)
Returns : its argument.
Args    : object of class TermI.

adds a TermI object to the ontology engine term store, and β€” heads up β€” it marks the term fully instantiated by default. returns its argument. so easy, so slay πŸ’…

🌟 get_term_by_identifier

Title   : get_term_by_identifier
Usage   : get_term_by_identifier(String id): TermI
Function: Retrieves terms from the term store by their identifier
          field, or an empty list if not there.
Example : $term = $soe->get_term_by_identifier("IPR000001");
Returns : An array of zero or more Bio::Ontology::TermI objects.
Args    : An array of identifier strings

looks up terms from the term store by their identifier field, or an empty list if they're not there (no drama, just an empty list). returns an array of zero or more Bio::Ontology::TermI objects, and you feed it an array of identifier strings. the example is straight up:

$term = $soe->get_term_by_identifier("IPR000001");

🌟 _get_number_rels

Title   : get_number_rels
Usage   :
Function:
Example :
Returns :
Args    :

internal, all fields basically vibes 🌈

🌟 _get_number_terms

Title   : _get_number_terms
Usage   :
Function:
Example :
Returns :
Args    :

also internal, also mysterious 🧚

🌟 _relationship_store

Title   : _storerelationship_store
Usage   : $obj->relationship_store($newval)
Function:
Example :
Returns : reference to an array of Bio::Ontology::TermI objects
Args    : reference to an array of Bio::Ontology::TermI objects

returns a reference to an array of Bio::Ontology::TermI objects, takes a reference to an array of Bio::Ontology::TermI objects. (yes, the Title line says _storerelationship_store β€” that's literally what it says, we're not touching it, periodt) πŸ™ˆ

🌟 _inverted_relationship_store

Title   : _inverted_relationship_store
Usage   :
Function:
Example :
Returns : reference to an array of Bio::Ontology::TermI objects
Args    : reference to an array of Bio::Ontology::TermI objects

returns a reference to an array of Bio::Ontology::TermI objects, args are a reference to an array of Bio::Ontology::TermI objects πŸ’œ

🌟 _relationship_type_store

Title   : _relationship_type_store
Usage   : $obj->_relationship_type_store($newval)
Function:
Example :
Returns : reference to an array of Bio::Ontology::RelationshipType objects
Args    : reference to an array of Bio::Ontology::RelationshipType objects

returns a reference to an array of Bio::Ontology::RelationshipType objects, takes a reference to an array of Bio::Ontology::RelationshipType objects πŸ”₯

🌟 _add_relationship_simple

Title   : _add_relationship_simple
Usage   :
Function:
Example :
Returns :
Args    :

internal. short. sweet. ⭐

🌟 add_relationship

Title   : add_relationship
Usage   : add_relationship(RelationshipI relationship): RelationshipI
Function: Adds a relationship object to the ontology engine.
Example :
Returns : Its argument.
Args    : A RelationshipI object.

adds a relationship object to the ontology engine. returns its argument, takes a RelationshipI object. lowkey the most straightforward method here 😌

🌟 get_relationships

Title   : get_relationships
Usage   : get_relationships(): RelationshipI
Function: Retrieves all relationship objects.
Example :
Returns : Array of RelationshipI objects
Args    :

retrieves all the relationship objects. returns an Array of RelationshipI objects. no args, just vibes 🌸

🌟 get_all_relationships

Title   : get_all_relationships
Usage   : get_all_relationships(): RelationshipI
Function: Retrieves all relationship objects.
Example :
Returns : Array of RelationshipI objects
Args    :

same energy as the last one: retrieves all relationship objects, returns an Array of RelationshipI objects πŸ‘‘

🌟 get_predicate_terms

Title   : get_predicate_terms
Usage   : get_predicate_terms(): TermI
Function: Retrieves all relationship types stored in the engine
Example :
Returns : reference to an array of Bio::Ontology::RelationshipType objects
Args    :

retrieves all the relationship types stored in the engine, and gives you back a reference to an array of Bio::Ontology::RelationshipType objects πŸŽ€

🌟 _is_rel_type

Title   : _is_rel_type
Usage   :
Function:
Example :
Returns :
Args    :

internal helper, mystery girlie ✨

🌟 _typed_traversal

Title   : _typed_traversal
Usage   :
Function:
Example :
Returns :
Args    :

also internal β€” but remember this name, because get_descendant_terms and get_ancestor_terms both use it to do their thing πŸ‘€

🌟 get_child_terms

Title   : get_child_terms
Usage   : get_child_terms(TermI term, TermI predicate_terms): TermI
          get_child_terms(TermI term, RelationshipType predicate_terms): TermI
Function: Retrieves all child terms of a given term, that satisfy a
          relationship among those that are specified in the second
          argument or undef otherwise. get_child_terms is a special
          case of get_descendant_terms, limiting the search to the
          direct descendants.
Example :
Returns : Array of TermI objects.
Args    : First argument is the term of interest, second is the list of
          relationship type terms.

retrieves all child terms of a given term that satisfy a relationship among those specified in the second argument β€” or undef otherwise. and here's the tea: get_child_terms is a special case of get_descendant_terms, limiting the search to the direct descendants only. returns an Array of TermI objects. first arg = the term of interest, second arg = the list of relationship type terms πŸ’–

🌟 get_descendant_terms

Title   : get_descendant_terms
Usage   : get_descendant_terms(TermI term, TermI rel_types): TermI
          get_child_terms(TermI term, RelationshipType predicate_terms): TermI
Function: Retrieves all descendant terms of a given term, that
          satisfy a relationship among those that are specified in
          the second argument or undef otherwise. Uses
          _typed_traversal to find all descendants.

Example :
Returns : Array of TermI objects.
Args    : First argument is the term of interest, second is the list of
          relationship type terms.

retrieves all descendant terms of a given term that satisfy a relationship among those specified in the second argument, or undef otherwise. it uses _typed_traversal to find all descendants (told you that name would come back). returns an Array of TermI objects. first arg = term of interest, second = list of relationship type terms πŸ¦‹

🌟 get_parent_terms

Title   : get_parent_terms
Usage   : get_parent_terms(TermI term, TermI predicate_terms): TermI
          get_child_terms(TermI term, RelationshipType predicate_terms): TermI
Function: Retrieves all parent terms of a given term, that satisfy a
          relationship among those that are specified in the second
          argument or undef otherwise. get_parent_terms is a special
          case of get_ancestor_terms, limiting the search to the
          direct ancestors.

Example :
Returns : Array of TermI objects.
Args    : First argument is the term of interest, second is the list of relationship type terms.

retrieves all parent terms of a given term that satisfy a relationship among those specified in the second argument, or undef otherwise. and yes, get_parent_terms is a special case of get_ancestor_terms, limiting the search to the direct ancestors. returns an Array of TermI objects. first arg = term of interest, second = list of relationship type terms πŸ’œ

🌟 get_ancestor_terms

Title   : get_ancestor_terms
Usage   : get_ancestor_terms(TermI term, TermI predicate_terms): TermI
          get_child_terms(TermI term, RelationshipType predicate_terms): TermI
Function: Retrieves all ancestor terms of a given term, that satisfy
          a relationship among those that are specified in the second
          argument or undef otherwise. Uses _typed_traversal to find
          all ancestors.

Example :
Returns : Array of TermI objects.
Args    : First argument is the term of interest, second is the list
          of relationship type terms.

retrieves all ancestor terms of a given term that satisfy a relationship among those specified in the second argument, or undef otherwise. uses _typed_traversal to find all ancestors. returns an Array of TermI objects. first arg = term of interest, second = list of relationship type terms 🌈

🌟 get_leaf_terms

Title   : get_leaf_terms
Usage   : get_leaf_terms(): TermI
Function: Retrieves all leaf terms from the ontology. Leaf term is a term w/o descendants.
Example : @leaf_terms = $obj->get_leaf_terms()
Returns : Array of TermI objects.
Args    :

retrieves all leaf terms from the ontology. a leaf term is a term w/o descendants β€” that's the definition, write it down. example:

@leaf_terms = $obj->get_leaf_terms()

returns an Array of TermI objects πŸ“

🌟 get_root_terms

Title   : get_root_terms
Usage   : get_root_terms(): TermI
Function: Retrieves all root terms from the ontology. Root term is a term w/o descendants.
Example : @root_terms = $obj->get_root_terms()
Returns : Array of TermI objects.
Args    :

retrieves all root terms from the ontology. (the original says "Root term is a term w/o descendants" β€” yes, exactly like the leaf one, we're reporting it as written, no editing, that's the rule πŸ’€) example:

@root_terms = $obj->get_root_terms()

returns an Array of TermI objects ✨

🌟 _filter_repeated

Title   : _filter_repeated
Usage   : @lst = $self->_filter_repeated(@old_lst);
Function: Removes repeated terms
Example :
Returns : List of unique TermI objects
Args    : List of TermI objects

removes repeated terms. you give it a List of TermI objects, it gives you back a List of unique TermI objects. dedupe queen πŸ‘‘

🌟 get_all_terms

Title   : get_all_terms
Usage   : get_all_terms(): TermI
Function: Retrieves all terms currently stored in the ontology.
Example : @all_terms = $obj->get_all_terms()
Returns : Array of TermI objects.
Args    :

retrieves all terms currently stored in the ontology. example:

@all_terms = $obj->get_all_terms()

returns an Array of TermI objects πŸ’–

🌟 find_terms

Title   : find_terms
Usage   : ($term) = $oe->find_terms(-identifier => "SO:0000263");
Function: Find term instances matching queries for their attributes.

          This implementation can efficiently resolve queries by
          identifier.

Example :
Returns : an array of zero or more Bio::Ontology::TermI objects
Args    : Named parameters. The following parameters should be recognized
          by any implementations:

             -identifier    query by the given identifier
             -name          query by the given name

find term instances matching queries for their attributes. and ooh, this implementation can efficiently resolve queries by identifier β€” that's a flex. returns an array of zero or more Bio::Ontology::TermI objects.

args are Named parameters, and the following parameters should be recognized by any implementations:

  • -identifier β€” query by the given identifier
  • -name β€” query by the given name

example usage:

($term) = $oe->find_terms(-identifier => "SO:0000263");

🌟 relationship_factory

Title   : relationship_factory
Usage   : $fact = $obj->relationship_factory()
Function: Get/set the object factory to be used when relationship
          objects are created by the implementation on-the-fly.

get/set the object factory to be used when relationship objects are created by the implementation on-the-fly. that's the last one for part 1, bestie β€” more parts follow, so don't go anywhere πŸŒΈπŸ’…

okay so we were mid-sentence in relationship_factory β€” here's the last lil chunk of it, no cap 🫢

  • Example : literally nothing here, it's giving minimalist
  • Returns : value of relationship_factory (a Bio::Factory::ObjectFactoryI compliant object)
  • Args : on set, a Bio::Factory::ObjectFactoryI compliant object

✨ term_factory ✨

  • Title : term_factory
  • Usage : $fact = $obj->term_factory()
  • Function : get/set the object factory that gets used when term objects are created by the implementation on-the-fly πŸ’…
⚠️ bestie, read this twice: this ontology engine implementation does not create term objects on the fly, so setting this attribute is meaningless. Not "kinda useless", not "meh" β€” meaningless. Don't waste your main character energy on it. 😭
  • Example : empty, it said what it said
  • Returns : value of term_factory (a Bio::Factory::ObjectFactoryI compliant object)
  • Args : on set, a Bio::Factory::ObjectFactoryI compliant object

🌸 _filter_unmarked 🌸

  • Title : _filter_unmarked
  • Usage : _filter_unmarked(TermI terms): TermI
  • Function : removes the uninstantiated terms from the list of terms 🧹✨
  • Example : nope, nothing
  • Returns : array of fully instantiated TermI objects
  • Args : array of TermI objects

πŸ’œ remove_term_by_id πŸ’œ

  • Title : remove_term_by_id
  • Usage : remove_term_by_id(String id): TermI
  • Function : removes a TermI object from the ontology engine, using the string id as the identifier. Heads up tho: the current implementation does not enforce consistency of the relationships that use that term. So like… it's gone, but its situationships are still out there. πŸ™ˆ
  • Example : $term = $soe->remove_term_by_id($id);
  • Returns : object of class TermI, or undef if it wasn't found
  • Args : the string identifier of a term

πŸŽ€ to_string πŸŽ€

  • Title : to_string
  • Usage : print $sv->to_string();
  • Function : currently returns a formatted string containing the number of terms and the number of relationships from the ontology engine πŸ“Šβœ¨
  • Example : print $sv->to_string();
  • Returns : nothing listed
  • Args : nothing listed

πŸ¦‹ _unique_termid πŸ¦‹

  • Title : _unique_termid
  • Usage : blank, it's mysterious like that
  • Function : returns a string that can be used as an ID, using fail-over approaches πŸ”
    • if the identifier attribute is not set, it uses the combination of name and ontology name β€” provided both are set
    • if they are not, it returns the name alone
πŸ™ˆ real talk: this is a private method. Call it from inheriting classes, but not from outside. It's iykyk only, bestie.
  • Example : empty
  • Returns : a string
  • Args : a Bio::Ontology::TermI compliant object

and that's the whole page, bestie, we ate and left no crumbs πŸ‘‘πŸ’–

this was served up from the perl v5.32.1 release, dated 2021-08-15, and yeah β€” the footer really does just say Bio::O...yEngine(3pm) like that, abbreviations and all, iconic behaviour honestly 🌈⭐ periodt.

πŸ“¦ where this page comes from