Bio::O...ntology(3pm)
okay so bestie, this is the manual page for Bio::Ontology::Ontology (3pm), and it's giving standard implementation of an Ontology energy π
it's long so buckle up, this is part 1 π
πΈ NAME πΈ
Bio::Ontology::Ontology β standard implementation of an Ontology π§¬
β¨ SYNOPSIS β¨
use Bio::Ontology::Ontology;
use Bio::Ontology::Term;
# create ontology object
my $ont = Bio::Ontology::Ontology->new(-name => "OBF");
# add terms, relationships ...
my $bp = Bio::Ontology::Term->new(-identifier => '02', -name => "Bioperl");
my $obf = Bio::Ontology::Term->new(-identifier => '01', -name => "OBF");
my $partof = Bio::Ontology::RelationshipType->get_instance("PART_OF");
$ont->add_term($bp);
$ont->add_term($obf);
$ont->add_relationship($bp, $obf, $partof);
# then query
my @terms = $ont->get_root_terms(); # "OBF"
my @desc = $ont->get_descendant_terms($terms[0], $partof); # "Bioperl"
# ... see methods for other ways to query
# for advanced users, you can re-use the query engine outside of an
# ontology to let one instance manage multiple ontologies
my $ont2 = Bio::Ontology::Ontology->new(-name => "Foundations",
-engine => $ont->engine());
π DESCRIPTION π
This is a no-frills implementation of Bio::Ontology::OntologyI. Like, it does exactly what it says on the tin, no extra sparkle, and honestly? That's the vibe π«Ά
The query functions are implemented by delegation to an OntologyEngineI implementation. So all the actual querying gets handed off to the engine β this class is basically the main character that delegates, iykyk π
π¬ FEEDBACK π¬
π Mailing Lists π
User feedback is an integral part of the evolution of this and other Bioperl modules, fr fr. Send your comments and suggestions preferably to the Bioperl mailing list. Your participation is much appreciated, bestie πΈ
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. The way that so many experienced and responsive experts will be able look at the problem and quickly address it π so please include a thorough description of the problem with code and data examples if at all possible. Give them everything, no gatekeeping π
π 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 - Hilmar Lapp π
Email hlapp at gmx.net β¨
π APPENDIX π
The rest of the documentation details each of the object methods. Internal methods are usually preceded with a _ π
π new π
Title : new
Usage : my $obj = Bio::Ontology::Ontology->new();
Function: Builds a new Bio::Ontology::Ontology object
Returns : an instance of Bio::Ontology::Ontology
Args : any number of named arguments. The following names will be
recognized by this module:
-name the name of the ontology
-authority the name of the authority for the ontology
-identifier an identifier for the ontology, if any
-engine the Bio::Ontology::OntologyEngineI
implementation that this instance should use;
default is Bio::Ontology::SimpleOntologyEngine
See the corresponding get/set methods for further documentation
on individual properties.
So new builds you a brand new Bio::Ontology::Ontology object, and it takes any number of named arguments π¦ the ones it recognizes are -name, -authority, -identifier, and -engine (and that engine defaults to Bio::Ontology::SimpleOntologyEngine β the little default that could π). Peep the matching get/set methods for the deets on each property.
π§ Methods from Bio::Ontology::OntologyI π§
π name π
Title : name
Usage : $obj->name($newval)
Function: Get/set the name of the ontology.
Example :
Returns : value of name (a scalar)
Args : on set, new value (a scalar or undef, optional)
Get it, set it, it's the name of the ontology. That's it, that's the method π
π authority π
Title : authority
Usage : $obj->authority($newval)
Function: Get/set the authority for this ontology, for instance the
DNS base for the organization granting the name of the
ontology and identifiers for the terms.
This attribute is optional and should not generally
expected by applications to have been set. It is here to
follow the rules for namespaces, which ontologies serve as
for terms.
Example :
Returns : value of authority (a scalar)
Args : on set, new value (a scalar or undef, optional)
Get/set the authority for this ontology β think the DNS base for the org that granted the ontology's name and the identifiers for the terms ποΈ
Heads up bestie: this attribute is optional and applications should not generally expect it to have been set. It exists to follow the rules for namespaces, which ontologies serve as for terms. So like, don't count on it being there, k? π
π¦ definition π¦
Title : definition
Usage : $obj->definition($newval)
Function: Get/set a descriptive definition of the ontology.
Example :
Returns : value of definition (a scalar)
Args : on set, new value (a scalar or undef, optional)
Get/set a descriptive definition of the ontology. Describe your ontology, bestie, it deserves it π«Ά
π₯ identifier π₯
Title : identifier
Usage : $id = $obj->identifier()
Function: Get an identifier for this ontology.
This is primarily intended for look-up purposes. The value
is not modifiable and is determined automatically by the
implementation. Also, the identifier's uniqueness will only
hold within the scope of a particular application's run
time since it is derived from a memory location.
Example :
Returns : value of identifier (a scalar)
Args :
Grab an identifier for this ontology.
Okay so important things, no cap: this is primarily for look-up purposes. The value is not modifiable and is determined automatically by the implementation. Also β and this is the part people always forget β the identifier's uniqueness only holds within the scope of a particular application's run time, since it is derived from a memory location π so don't go treating it like some globally unique forever-ID, it's not that girl.
π§Ή close π§Ή
Title : close
Usage :
Function: Release any resources this ontology may occupy. In order
to efficiently release unused memory or file handles, you
should call this method once you are finished with an
ontology.
Example :
Returns : TRUE on success and FALSE otherwise
Args : none
Releases any resources this ontology may occupy. In order to efficiently release unused memory or file handles, you should call this method once you're finished with an ontology β like closing the app when you're done, it's just polite π
Returns TRUE on success and FALSE otherwise, args: none β¨
π Implementation-specific public methods π
βοΈ engine βοΈ
Title : engine
Usage : $engine = $obj->engine()
Function: Get/set the ontology engine to which all the query methods
delegate.
Example :
Returns : an object implementing Bio::Ontology::OntologyEngineI
Args : on set, new value (an object implementing
Bio::Ontology::OntologyEngineI, or undef)
Get/set the ontology engine to which all the query methods delegate π₯ this is the one doing the actual work while this class sits there looking pretty, main character energy fr.
Returns an object implementing Bio::Ontology::OntologyEngineI; on set, the new value is an object implementing Bio::Ontology::OntologyEngineI, or undef β¨
See Bio::Ontology::OntologyEngineI π¦
𧬠Methods defined in Bio::Ontology::OntologyEngineI π§¬
These are the ones the interface Bio::Ontology::OntologyEngineI says you gotta have. Every engine out there is expected to bring these, so here's the whole lineup π
add_term
- Title:
add_term - Usage:
add_term(TermI term): TermI - Function: drops a TermI object into the ontology engine's term store. And okay, small lil detail β if the ontology property of the term object was not set already, this implementation will set it to itself while adding the term. so it never shows up to the party unaffiliated π
- Example:
$oe->add_term($term) - Returns: its argument. literally just hands it right back to you π«Ά
- Args: an object of class TermI.
add_relationship
- Title:
add_relationship - Usage:
add_relationship(RelationshipI relationship): RelationshipI
add_relatioship(TermI subject, TermI predicate, TermI object)
- Function: adds a relationship object to the ontology engine. (and yes bestie, that second Usage line really does say
add_relatioshipβ that's how it's written in the source, not my typo, we do not "fix" it, we respect it π) - Example: the original leaves this one blank π
- Returns: its argument.
- Args: a RelationshipI object.
get_relationship_type
- Title:
get_relationship_type - Usage:
get_relationship_type(scalar): RelationshipTypeI - Function: grabs a relationshiptype object back out of the ontology engine. you ask by name, it hands you the whole vibe π¦
- Example: blank in the original π
- Returns: a RelationshipTypeI object.
- Args: the name (a scalar) of the RelationshipTypeI object you're manifesting.
get_relationships
- Title:
get_relationships - Usage:
get_relationships(TermI term): RelationshipI[] - Function: pulls all the relationship objects in the ontology, or all the relationships of one specific term if you give it one.
- Example: also blank in the original π«
- Returns: an array of Bio::Ontology::RelationshipI objects.
- Args: optionally, a Bio::Ontology::TermI compliant object.
get_predicate_terms
- Title:
get_predicate_terms - Usage:
get_predicate_terms(): TermI - Function: retrieves all relationship types. every last one β¨
- Example: blank, bestie π
- Returns: an array of TermI objects.
- Args: nothing. zero. empty. the Args line is just vibes π
get_child_terms
- Title:
get_child_terms - Usage:
get_child_terms(TermI term, TermI predicate_terms): TermI - Function: retrieves all child terms of a given term that satisfy a relationship among the ones you listed in the second argument β or
undefotherwise.get_child_termsis a special case ofget_descendant_terms, it just limits the search to the direct descendants. so like, the immediate children, not the whole extended family πΈ
β οΈ heads up bestie: a returned term may possibly live in another ontology than this one, because the underlying engine may manage multiple ontologies and the relationships of terms between them. if you only want descendants within this ontology, you have to filter the returned array yourself. no cap.
- Example: blank in the original π
- Returns: an array of TermI objects.
- Args: first argument is the term of interest, second is the list of relationship type terms.
get_descendant_terms
- Title:
get_descendant_terms - Usage:
get_descendant_terms(TermI term, TermI rel_types): TermI - Function: retrieves all descendant terms of a given term that satisfy a relationship among the ones specified in the second argument, or
undefotherwise. the whole bloodline, not just the direct kids π
β οΈ same warning, same energy: a returned term may possibly be in another ontology than this one, because the underlying engine may manage multiple ontologies and the relationships of terms between them. want only descendants within this ontology? filter the returned array. periodt.
- Example: blank π
- Returns: an array of TermI objects.
- Args: first argument is the term of interest, second is the list of relationship type terms.
get_parent_terms
- Title:
get_parent_terms - Usage:
get_parent_terms(TermI term, TermI predicate_terms): TermI - Function: retrieves all parent terms of a given term that satisfy a relationship among the ones specified in the second argument, or
undefotherwise.get_parent_termsis a special case ofget_ancestor_terms, limiting the search to the direct ancestors. the parents. the ones who raised it π«Ά
β οΈ yes bestie, same caveat: a returned term may possibly be in another ontology than this one, because the underlying engine may manage multiple ontologies and the relationships of terms between them. if you only want descendants within this ontology, you need to filter the returned array. (that's the original's wording, and yes it says "descendants" on a parents method β we keep it exactly as written π)
- Example: blank in the original π«
- Returns: an array of TermI objects.
- Args: first argument is the term of interest, second is the list of relationship type terms.
get_ancestor_terms
- Title:
get_ancestor_terms - Usage:
get_ancestor_terms(TermI term, TermI predicate_terms): TermI - Function: retrieves all ancestor terms of a given term that satisfy a relationship among the ones specified in the second argument, or
undefotherwise. go all the way up the family tree, bestie π
β οΈ and once more for the people in the back: a returned term may possibly be in another ontology than this one, because the underlying engine may manage multiple ontologies and the relationships of terms between them. if you only want descendants within this ontology, you need to filter the returned array.
- Example: blank π
- Returns: an array of TermI objects.
- Args: first argument is the term of interest, second is the 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. a leaf term is a term w/o descendants. the ends of the branches, the ones with no children, absolute final girls π
- Example:
@leaf_terms = $obj->get_leaf_terms() - Returns: an array of TermI objects.
- Args: nothing at all π
get_root_terms()
- Title:
get_root_terms - Usage:
get_root_terms(): TermI - Function: retrieves all root terms from the ontology. a root term is a term w/o parents. the origin story, the main characters at the very top π
- Example:
@root_terms = $obj->get_root_terms() - Returns: an array of TermI objects.
- Args: nothing π
get_all_terms
- Title:
get_all_terms - Usage:
get_all_terms: TermI - Function: retrieves all terms from the ontology. every single one.
π’ okay important: we do not mandate an order here in which the terms are returned. in fact, the default implementation will return them in an unpredictable order. so do not assume a sort, bestie, it's giving chaos πͺοΈ
- Example:
@terms = $obj->get_all_terms() - Returns: an array of TermI objects.
- Args: nothing β¨
find_terms
- Title:
find_terms - Usage:
($term) = $oe->find_terms(-identifier => "SO:0000263"); - Function: find term instances matching queries for their attributes.
an implementation may not support querying for arbitrary attributes, but can generally be expected to accept -identifier and -name as queries. and if you give it both, they are implicitly intersected. so it's an AND situation, not an OR situation, iykyk π₯
- Example: blank in the original π«
- 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_identical_terms
- Title:
find_identical_terms - Usage:
($term) = $oe->find_identical_terms($term0); - Function: find term instances where name or synonym matches the query exactly. no fuzzy business, exact match only π―
- Example: blank π
- Returns: an array of zero or more Bio::Ontology::TermI objects.
- Args: a Bio::Ontology::TermI object.
find_similar_terms
- Title:
find_similar_terms - Usage:
($term) = $oe->find_similar_terms($term0); - Function: find term instances where name or synonym, or part of one, matches the query. this one's the chill one, it's flexible, it gets the vibe πΈ
- Example: blank π
- Returns: an array of zero or more Bio::Ontology::TermI objects.
- Args: a Bio::Ontology::TermI object.
find_identically_named_terms
- Title:
find_identically_named_terms - Usage:
($term) = $oe->find_identically_named_terms($term0); - Function: find term instances where names match the query term name exactly. just the name field, bestie, we're being precise here π
- Example: blank in the original π«
- Returns: an array of zero or more Bio::Ontology::TermI objects.
- Args: a Bio::Ontology::TermI object.
π Factory for relationships and terms π
Where the objects get made on the fly. obsessed honestly β¨
relationship_factory
- Title:
relationship_factory - Usage:
$fact = $obj->relationship_factory() - Function: get (and set, if the engine supports it) the object factory to be used when relationship objects are created by the implementation on-the-fly. so if your engine likes to spawn relationships mid-thought, this is the plug π
- Example: blank π
- Returns: the value of
relationship_factory(a Bio::Factory::ObjectFactoryI compliant object) - Args: nothing listed π«Ά
term_factory
- Title:
term_factory - Usage:
$fact = $obj->term_factory() - Function: get (and set, if the engine supports it) the object factory to be used when term objects are created by the implementation on-the-fly. same energy, different object type π
- Example: blank π
- Returns: the value of
term_factory(a Bio::Factory::ObjectFactoryI compliant object) - Args: nothing listed π
annotation
- Title:
annotation - Usage:
$annos = $obj->annotation() - Function: get/set the Bio::Annotation::Collection object. this collection holds Bio::Annotation::SimpleValue objects that store header information β like the version and date that live in the header section of an Ontology file. the metadata corner, the receipts, the lore π
- Example: blank in the original π«
- Returns: the value of
annotation(a Bio::Annotation::Collection compliant object) - Args: a Bio::Annotation::Collection object (optional)
and that's the whole page, bestie π₯Ήπ
this was generated from the perl v5.32.1 distribution, dated 2021-08-15, and the page itself is Bio::O...ntology(3pm) β user contributed perl documentation, as always. go read the source, it slays, and remember: the vibe changes, the facts do not π«Άβ¨
π¦ 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