NAME
Bio::Ontology::Ontology - standard implementation of an Ontology
SYNOPSIS
use Bio::Ontology::Ontology;use Bio::Ontology::Term;# create ontology objectmy $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 querymy @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 ontologiesmy $ont2 = Bio::Ontology::Ontology->new(-name => "Foundations",-engine => $ont->engine());
DESCRIPTION
This is a no-frills implementation of Bio::Ontology::OntologyI.
The query functions are implemented by delegation to an OntologyEngineI implementation.
FEEDBACK
Mailing Lists
User feedback is an integral part of the evolution of this and other Bioperl modules. Send your comments and suggestions preferably to the Bioperl mailing list. Your participation is much appreciated.
[email protected] - General discussionhttp://bioperl.org/wiki/Mailing_lists - About the mailing lists
Support
Please direct usage questions or support issues to the mailing list:
rather than to the module maintainer directly. Many experienced and reponsive experts will be able look at the problem and quickly address it. 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 - 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 : newUsage : my $obj = Bio::Ontology::Ontology->new();Function: Builds a new Bio::Ontology::Ontology objectReturns : an instance of Bio::Ontology::OntologyArgs : any number of named arguments. The following names will berecognized 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::OntologyEngineIimplementation that this instance should use;default is Bio::Ontology::SimpleOntologyEngineSee the corresponding get/set methods for further documentationon individual properties.
Methods from Bio::Ontology::OntologyI
name
Title : nameUsage : $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)
authority
Title : authorityUsage : $obj->authority($newval)Function: Get/set the authority for this ontology, for instance theDNS base for the organization granting the name of theontology and identifiers for the terms.This attribute is optional and should not generallyexpected by applications to have been set. It is here tofollow the rules for namespaces, which ontologies serve asfor terms.Example :Returns : value of authority (a scalar)Args : on set, new value (a scalar or undef, optional)
definition
Title : definitionUsage : $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)
identifier
Title : identifierUsage : $id = $obj->identifier()Function: Get an identifier for this ontology.This is primarily intended for look-up purposes. The valueis not modifiable and is determined automatically by theimplementation. Also, the identifier's uniqueness will onlyhold within the scope of a particular application's runtime since it is derived from a memory location.Example :Returns : value of identifier (a scalar)Args :
close
Title : closeUsage :Function: Release any resources this ontology may occupy. In orderto efficiently release unused memory or file handles, youshould call this method once you are finished with anontology.Example :Returns : TRUE on success and FALSE otherwiseArgs : none
Implementation-specific public methods
engine
Title : engineUsage : $engine = $obj->engine()Function: Get/set the ontology engine to which all the query methodsdelegate.Example :Returns : an object implementing Bio::Ontology::OntologyEngineIArgs : on set, new value (an object implementingBio::Ontology::OntologyEngineI, or undef)
See Bio::Ontology::OntologyEngineI.
Methods defined in Bio::Ontology::OntologyEngineI
add_term
Title : add_termUsage : add_term(TermI term): TermIFunction: Adds TermI object to the ontology engine term storeIf the ontology property of the term object was not set,this implementation will set it to itself upon adding theterm.Example : $oe->add_term($term)Returns : its argument.Args : object of class TermI.
add_relationship
Title : add_relationshipUsage : add_relationship(RelationshipI relationship): RelationshipIadd_relatioship(TermI subject, TermI predicate, TermI object)Function: Adds a relationship object to the ontology engine.Example :Returns : Its argument.Args : A RelationshipI object.
get_relationship_type
Title : get_relationship_typeUsage : get_relationship_type(scalar): RelationshipTypeIFunction: Get a relationshiptype object from the ontology engine.Example :Returns : A RelationshipTypeI object.Args : The name (scalar) of the RelationshipTypeI object desired.
get_relationships
Title : get_relationshipsUsage : get_relationships(TermI term): RelationshipI[]Function: Retrieves all relationship objects in the ontology, or allrelationships of a given term.Example :Returns : Array of Bio::Ontology::RelationshipI objectsArgs : Optionally, a Bio::Ontology::TermI compliant object
get_predicate_terms
Title : get_predicate_termsUsage : get_predicate_terms(): TermIFunction: Retrieves all relationship types.Example :Returns : Array of TermI objectsArgs :
get_child_terms
Title : get_child_termsUsage : get_child_terms(TermI term, TermI predicate_terms): TermIFunction: Retrieves all child terms of a given term, that satisfy arelationship among those that are specified in the secondargument or undef otherwise. get_child_terms is a specialcase of get_descendant_terms, limiting the search to thedirect descendants.Note that a returned term may possibly be in anotherontology than this one, because the underlying engine maymanage multiple ontologies and the relationships of termsbetween them. If you only want descendants within thisontology, you need to filter the returned array.Example :Returns : Array of TermI objects.Args : First argument is the term of interest, second is the listof relationship type terms.
get_descendant_terms
Title : get_descendant_termsUsage : get_descendant_terms(TermI term, TermI rel_types): TermIFunction: Retrieves all descendant terms of a given term, thatsatisfy a relationship among those that are specified inthe second argument or undef otherwise.Note that a returned term may possibly be in anotherontology than this one, because the underlying engine maymanage multiple ontologies and the relationships of termsbetween them. If you only want descendants within thisontology, you need to filter the returned array.Example :Returns : Array of TermI objects.Args : First argument is the term of interest, second is the listof relationship type terms.
get_parent_terms
Title : get_parent_termsUsage : get_parent_terms(TermI term, TermI predicate_terms): TermIFunction: Retrieves all parent terms of a given term, that satisfy arelationship among those that are specified in the secondargument or undef otherwise. get_parent_terms is a specialcase of get_ancestor_terms, limiting the search to thedirect ancestors.Note that a returned term may possibly be in anotherontology than this one, because the underlying engine maymanage multiple ontologies and the relationships of termsbetween them. If you only want descendants within thisontology, you need to filter the returned array.Example :Returns : Array of TermI objects.Args : First argument is the term of interest, second is the listof relationship type terms.
get_ancestor_terms
Title : get_ancestor_termsUsage : get_ancestor_terms(TermI term, TermI predicate_terms): TermIFunction: Retrieves all ancestor terms of a given term, that satisfya relationship among those that are specified in the secondargument or undef otherwise.Note that a returned term may possibly be in anotherontology than this one, because the underlying engine maymanage multiple ontologies and the relationships of termsbetween them. If you only want descendants within thisontology, you need to filter the returned array.Example :Returns : Array of TermI objects.Args : First argument is the term of interest, second is the listof relationship type terms.
get_leaf_terms
Title : get_leaf_termsUsage : get_leaf_terms(): TermIFunction: Retrieves all leaf terms from the ontology. Leaf term is aterm w/o descendants.Example : @leaf_terms = $obj->get_leaf_terms()Returns : Array of TermI objects.Args :
get_root_terms()
Title : get_root_termsUsage : get_root_terms(): TermIFunction: Retrieves all root terms from the ontology. Root term is aterm w/o parents.Example : @root_terms = $obj->get_root_terms()Returns : Array of TermI objects.Args :
get_all_terms
Title : get_all_termsUsage : get_all_terms: TermIFunction: Retrieves all terms from the ontology.We do not mandate an order here in which the terms arereturned. In fact, the default implementation will returnthem in unpredictable order.Example : @terms = $obj->get_all_terms()Returns : Array of TermI objects.Args :
find_terms
Title : find_termsUsage : ($term) = $oe->find_terms(-identifier => "SO:0000263");Function: Find term instances matching queries for their attributes.An implementation may not support querying for arbitraryattributes, but can generally be expected to accept-identifier and -name as queries. If both are provided,they are implicitly intersected.Example :Returns : an array of zero or more Bio::Ontology::TermI objectsArgs : Named parameters. The following parameters should be recognizedby any implementations:-identifier query by the given identifier-name query by the given name
find_identical_terms
Title : find_identical_termsUsage : ($term) = $oe->find_identical_terms($term0);Function: Find term instances where name or synonymmatches the query exactlyExample :Returns : an array of zero or more Bio::Ontology::TermI objectsArgs : a Bio::Ontology::TermI object
find_similar_terms
Title : find_similar_termsUsage : ($term) = $oe->find_similar_terms($term0);Function: Find term instances where name or synonym, or part of one,matches the query.Example :Returns : an array of zero or more Bio::Ontology::TermI objectsArgs : a Bio::Ontology::TermI object
find_identically_named_terms
Title : find_identically_named_termsUsage : ($term) = $oe->find_identically_named_terms($term0);Function: Find term instances where names match the query termname exactlyExample :Returns : an array of zero or more Bio::Ontology::TermI objectsArgs : a Bio::Ontology::TermI object
Factory for relationships and terms
relationship_factory
Title : relationship_factoryUsage : $fact = $obj->relationship_factory()Function: Get (and set, if the engine supports it) the objectfactory to be used when relationship objects are created bythe implementation on-the-fly.Example :Returns : value of relationship_factory (a Bio::Factory::ObjectFactoryIcompliant object)Args :
term_factory
Title : term_factoryUsage : $fact = $obj->term_factory()Function: Get (and set, if the engine supports it) the objectfactory to be used when term objects are created bythe implementation on-the-fly.Example :Returns : value of term_factory (a Bio::Factory::ObjectFactoryIcompliant object)Args :
annotation
Title : annotationUsage : $annos = $obj->annotation()Function: Get/Set the Bio::Annotation::Collection objectThe collection contains Bio::Annotation::SimpleValueobjects to store header information like the versionand date present in the header section of an Ontologyfile.Example :Returns : value of annotation (a Bio::Annotation::Collectioncompliant object)Args : A Bio::Annotation::Collection object (Optional)