id
Usage - print $ontology->id() or $ontology->id($id)
Returns - the ID space of this ontology (string)
Args - the ID space of this ontology (string)
Function - gets/sets the ID space of this ontology
name
Usage - print $ontology->name() or $ontology->name($name)
Returns - the name (string) of the ontology
Args - the name (string) of the ontology
Function - gets/sets the name of the ontology
imports
Usage - $onto->imports() or $onto->imports($id1, $id2, $id3, ...)
Returns - a set (OBO::Util::Set) with the imported id ontologies
Args - the ontology id(s) (string)
Function - gets/sets the id(s) of the ontologies that are imported by this one
treat_xrefs_as_equivalent
Usage - $onto->treat_xrefs_as_equivalent() or $onto->treat_xrefs_as_equivalent($xref1, $xref2, $xref3, ...)
Returns - a set (OBO::Util::Set) of ontology id spaces
Args - an ontology ID space(s) (string)
Function - gets/sets the id spaces(s) of the ontologies that their xrefs are treated as equivalent
Remark - Macro. Treats all xrefs coming from a particular ID-Space as being statements of exact equivalence.
treat_xrefs_as_is_a
Usage - $onto->treat_xrefs_as_is_a() or $onto->treat_xrefs_as_is_a($xref1, $xref2, $xref3, ...)
Returns - a set (OBO::Util::Set) of ontology id spaces
Args - an ontology ID space(s) (string)
Function - gets/sets the id spaces(s) of the ontologies that their xrefs are treated as equivalent
Remark - Treats all xrefs coming from a particular ID-Space as being is_a relationships.
date
Usage - print $ontology->date()
Returns - the current date (in dd:MM:yyyy HH:mm format) of the ontology
Args - the current date (in dd:MM:yyyy HH:mm format) of the ontology
Function - gets/sets the date of the ontology
Remark - for historic reasons, this is NOT a ISO 8601 date, as is the case for the creation-date field
default_relationship_id_prefix
Usage - print $ontology->default_relationship_id_prefix() or $ontology->default_relationship_id_prefix("OBO_REL")
Returns - the default relationship ID prefix (string) of this ontology
Args - the default relationship ID prefix (string) of this ontology
Function - gets/sets the default relationship ID prefix of this ontology
Remark - Any relationship lacking an ID space will be prefixed with the value of this tag.
default_namespace
Usage - print $ontology->default_namespace() or $ontology->default_namespace("cellcycle_ontology")
Returns - the default namespace (string) of this ontology
Args - the default namespace (string) of this ontology
Function - gets/sets the default namespace of this ontology
idspaces
Usage - $ontology->idspaces() or $ontology->idspaces($IDspace)
Returns - the id spaces, as a set (OBO::Util::IDspaceSet) of OBO::Core::IDspace's, of this ontology
Args - the id spaces, as a set (OBO::Util::IDspaceSet) of OBO::Core::IDspace's, of this ontology
Function - gets/sets the idspaces of this ontology
data_version
Usage - print $ontology->data_version()
Returns - the data version (string) of this ontology
Args - the data version (string) of this ontology
Function - gets/sets the data version of this ontology
saved_by
Usage - print $ontology->saved_by()
Returns - the username of the person (string) to last save this ontology
Args - the username of the person (string) to last save this ontology
Function - gets/sets the username of the person to last save this ontology
remarks
Usage - print $ontology->remarks()
Returns - the remarks (OBO::Util::Set) of this ontology
Args - the remarks (OBO::Util::Set) of this ontology
Function - gets/sets the remarks of this ontology
subset_def_map
Usage - $onto->subset_def_map() or $onto->subset_def_map($subset_def_map)
Returns - a map (OBO::Util::SubsetDefMap) with the subset definition(s) used in this ontology. A subset is a view over an ontology
Args - a subset definitions map (OBO::Core::SubsetDefMap)
Function - gets/sets the subset definition(s) of this ontology
synonym_type_def_set
Usage - $onto->synonym_type_def_set() or $onto->synonym_type_def_set($st1, $st2, $st3, ...)
Returns - a set (OBO::Util::SynonymTypeDefSet) with the synonym type definitions used in this ontology. A synonym type is a description of a user-defined synonym type
Args - the synonym type definition(s) (OBO::Core::SynonymTypeDef) used in this ontology
Function - gets/sets the synonym type definitions (s) of this ontology
add_term
Usage - $ontology->add_term($term)
Returns - the just added term (OBO::Core::Term)
Args - the term (OBO::Core::Term) to be added. The ID of the term to be added must have already been defined.
Function - adds a term to this ontology
Remark - adding a term to an ontology does not mean adding its instances
add_instance
Usage - $ontology->add_instance($instance)
Returns - the just added instance (OBO::Core::Instance)
Args - the instance (OBO::Core::Instance) to be added. The ID of the instance to be added must have already been defined.
Function - adds a instance to this ontology
add_term_as_string
Usage - $ontology->add_term_as_string($term_id, $term_name)
Returns - the just added term (OBO::Core::Term)
Args - the term id (string) and the term name (string) of term to be added
Function - adds a term to this ontology
add_instance_as_string
Usage - $ontology->add_instance_as_string($instance_id, $instance_name)
Returns - the just added instance (OBO::Core::Instance)
Args - the instance id (string) and the instance name (string) of instance to be added
Function - adds a instance to this ontology
add_relationship_type
Usage - $ontology->add_relationship_type($relationship_type)
Returns - the just added relationship type (OBO::Core::RelationshipType)
Args - the relationship type to be added (OBO::Core::RelationshipType). The ID of the relationship type to be added must have already been defined.
Function - adds a relationship type to this ontology
add_relationship_type_as_string
Usage - $ontology->add_relationship_type_as_string($relationship_type_id, $relationship_type_name)
Returns - the just added relationship type (OBO::Core::RelationshipType)
Args - the relationship type id (string) and the relationship type name (string) of the relationship type to be added
Function - adds a relationship type to this ontology
delete_term
Usage - $ontology->delete_term($term)
Returns - none
Args - the term (OBO::Core::Term) to be deleted
Function - deletes a term from this ontology
Remark - the resulting ontology might be segmented, i.e., the deleted node might create an unconnected sub-ontology
Remark - the term (OBO::Core::Term) still exits after removing it from this ontology
delete_instance
Usage - $ontology->delete_instance($instance)
Returns - none
Args - the instance (OBO::Core::Instance) to be deleted
Function - deletes a instance from this ontology
Remark - the instance (OBO::Core::Instance) still exits after removing it from this ontology
delete_relationship
Usage - $ontology->delete_relationship($rel)
Returns - none
Args - the relationship (OBO::Core::Relationship) to be deleted
Function - deletes a relationship from this ontology
Remark - the relationship (OBO::Core::Relationship) still exits after removing it from this ontology
has_term
Usage - print $ontology->has_term($term)
Returns - true or false
Args - the term (OBO::Core::Term) to be tested
Function - checks if the given term belongs to this ontology
has_instance
Usage - print $ontology->has_instance($instance)
Returns - true or false
Args - the instance (OBO::Core::Instance) to be tested
Function - checks if the given instance belongs to this ontology
has_term_id
Usage - print $ontology->has_term_id($term_id)
Returns - true or false
Args - the term id (string) to be tested
Function - checks if the given term id corresponds to a term held by this ontology
has_instance_id
Usage - print $ontology->has_instance_id($instance_id)
Returns - true or false
Args - the instance id (string) to be tested
Function - checks if the given instance id corresponds to a instance held by this ontology
has_relationship_type
Usage - print $ontology->has_relationship_type($relationship_type)
Returns - true or false
Args - the relationship type (OBO::Core::RelationshipType) to be tested
Function - checks if the given relationship type belongs to this ontology
has_relationship_type_id
Usage - print $ontology->has_relationship_type_id($relationship_type_id)
Returns - true or false
Args - the relationship type id (string) to be tested
Function - checks if the given relationship type id corresponds to a relationship type held by this ontology
has_relationship_id
Usage - print $ontology->has_relationship_id($rel_id)
Returns - true or false
Args - the relationship id (string) to be tested
Function - checks if the given relationship id corresponds to a relationship held by this ontology
equals
Usage - print $ontology->equals($another_ontology)
Returns - either 1 (true) or 0 (false)
Args - the ontology (OBO::Core::Ontology) to compare with
Function - tells whether this ontology is equal to the parameter
get_terms
Usage - $ontology->get_terms() or $ontology->get_terms("APO:I.*") or $ontology->get_terms("GO:012*")
Returns - the terms held by this ontology as a reference to an array of OBO::Core::Term's
Args - none or the regular expression for filtering the terms by id's
Function - returns the terms held by this ontology
get_instances
Usage - $ontology->get_instances() or $ontology->get_instances("APO:K.*")
Returns - the instances held by this ontology as a reference to an array of OBO::Core::Instance's
Args - none or the regular expression for filtering the instances by id's
Function - returns the instances held by this ontology
get_terms_sorted_by_id
Usage - $ontology->get_terms_sorted_by_id() or $ontology->get_terms_sorted_by_id("APO:I.*")
Returns - the terms held by this ontology as a reference to a sorted (by ID) array of OBO::Core::Term's
Args - none or the regular expression for filtering the terms by id's
Function - returns the terms held by this ontology, the terms are sorted by ID (using the Schwartzian Transform)
get_instances_sorted_by_id
Usage - $ontology->get_instances_sorted_by_id() or $ontology->get_instances_sorted_by_id("APO:K.*")
Returns - the instances held by this ontology as a reference to a sorted (by ID) array of OBO::Core::Instance's
Args - none or the regular expression for filtering the instances by id's
Function - returns the instances held by this ontology, the instances are sorted by ID (using the Schwartzian Transform)
get_terms_by_subnamespace
Usage - $ontology->get_terms_by_subnamespace() or $ontology->get_terms_by_subnamespace("P") or or $ontology->get_terms_by_subnamespace("Pa")
Returns - the terms held by this ontology corresponding to the requested subnamespace as a reference to an array of OBO::Core::Term's
Args - none or the subnamespace: 'P', 'I', 'Pa', 'Ia' and so on.
Function - returns the terms held by this ontology corresponding to the requested subnamespace
get_instances_by_subnamespace
Usage - $ontology->get_instances_by_subnamespace() or $ontology->get_instances_by_subnamespace("K") or or $ontology->get_instances_by_subnamespace("Ka")
Returns - the instances held by this ontology corresponding to the requested subnamespace as a reference to an array of OBO::Core::Instance's
Args - none or the subnamespace: 'K', 'L', 'Ka', 'La' and so on.
Function - returns the instances held by this ontology corresponding to the requested subnamespace
get_terms_by_subset
Usage - $ontology->get_terms_by_subset("GO_SLIM")
Returns - the terms held by this ontology belonging to the given subset as a reference to an array of OBO::Core::Term's
Args - a subset name
Function - returns the terms held by this ontology belonging to the requested subset
get_instances_by_subset
Usage - $ontology->get_instances_by_subset("INSTANCES_SLIM")
Returns - the instances held by this ontology belonging to the given subset as a reference to an array of OBO::Core::Instance's
Args - a subset name
Function - returns the instances held by this ontology belonging to the requested subset
get_relationships
Usage - $ontology->get_relationships()
Returns - the relationships held by this ontology as a reference to an array of OBO::Core::Relationship's
Args - none
Function - returns the relationships held by this ontology
get_relationship_types
Usage - $ontology->get_relationship_types()
Returns - a reference to an array with the relationship types (OBO::Core::RelationshipType) held by this ontology
Args - none
Function - returns the relationship types held by this ontology
get_relationship_types_sorted_by_id
Usage - $ontology->get_relationship_types_sorted_by_id()
Returns - the relationship types held by this ontology as a reference to a sorted (by ID) array of OBO::Core::Term's
Args - none or the regular expression for filtering the terms by id's
Function - returns the relationship types held by this ontology, the relationship types are sorted by ID (using the Schwartzian Transform)
get_term_local_neighbourhood
Usage - $ontology->get_term_local_neighbourhood($term, $rel_type)
Returns - the neighbourhood of a given term as a reference to an array with the relationships (OBO::Core::Relationship)
Args - the term (OBO::Core::Term) for which its relationships will be found out; and optionally the relationship type name (e.g. 'participates_in') to select only those types of relationships
Function - returns the local neighbourhood of the given term as a reference to an array with the relationships (OBO::Core::Relationship)
Remark - this subroutine, which is an alias of OBO::Core::get_relationships_by_source_term, might change its interface in the future (a new module, named e.g. TermNeighbourhood, might be implemented)
get_relationships_by_source_term
Usage - $ontology->get_relationships_by_source_term($source_term, $rel_type)
Returns - a reference to an array with the relationships (OBO::Core::Relationship) connecting the given term to its children
Args - the term (OBO::Core::Term) for which its relationships will be found out; and optionally the relationship type name (e.g. 'participates_in') to filter out those types of relationships
Function - returns the relationships associated to the given source term
get_relationships_by_target_term
Usage - $ontology->get_relationships_by_target_term($target_term, $rel_type)
Returns - a reference to an array with the relationships (OBO::Core::Relationship) connecting the given term to its parents
Args - the term (OBO::Core::Term) for which its relationships will be found out; and optionally the relationship type name (e.g. 'participates_in') to filter out those types of relationships
Function - returns the relationships associated to the given target term
get_term_by_id
Usage - $ontology->get_term_by_id($id)
Returns - the term (OBO::Core::Term) associated to the given ID
Args - the term's ID (string)
Function - returns the term associated to the given ID
get_instance_by_id
Usage - $ontology->get_instance_by_id($id)
Returns - the instance (OBO::Core::Instance) associated to the given ID
Args - the instance's ID (string)
Function - returns the instance associated to the given ID
set_term_id
Usage - $ontology->set_term_id($term, $new_term_id)
Returns - the term (OBO::Core::Term) with its new ID
Args - the term (OBO::Core::Term) and its new term's ID (string)
Function - sets a new term ID for the given term
set_instance_id
Usage - $ontology->set_instance_id($instance, $new_id)
Returns - the instance (OBO::Core::Instance) with its new ID
Args - the instance (OBO::Core::Instance) and its new instance's ID (string)
Function - sets a new instance ID for the given instance
get_relationship_type_by_id
Usage - $ontology->get_relationship_type_by_id($id)
Returns - the relationship type (OBO::Core::RelationshipType) associated to the given id
Args - the relationship type's id (string)
Function - returns the relationship type associated to the given id
get_term_by_name
Usage - $ontology->get_term_by_name($name)
Returns - the term (OBO::Core::Term) associated to the given name
Args - the term's name (string)
Function - returns the term associated to the given name
Remark - the argument (string) is case sensitive
get_instance_by_name
Usage - $ontology->get_instance_by_name($name)
Returns - the instance (OBO::Core::Instance) associated to the given name
Args - the instance's name (string)
Function - returns the instance associated to the given name
Remark - the argument (string) is case sensitive
get_term_by_name_or_synonym
Usage - $ontology->get_term_by_name_or_synonym($name, $scope)
Returns - the term (OBO::Core::Term) associated to the given name or synonym (given its scope, EXACT by default); 'undef' is returned if no term is found.
Args - the term's name or synonym (string) and optionally the scope of the synonym (EXACT by default)
Function - returns the term associated to the given name or synonym (given its scope, EXACT by default)
Remark - this function should be carefully used since among ontologies there may be homonyms at the level of the synonyms (e.g. genes)
Remark - the argument (string) is case sensitive
get_instance_by_name_or_synonym
Usage - $ontology->get_instance_by_name_or_synonym($name, $scope)
Returns - the instance (OBO::Core::Instance) associated to the given name or synonym (given its scope, EXACT by default); 'undef' is returned if no instance is found.
Args - the instance's name or synonym (string) and optionally the scope of the synonym (EXACT by default)
Function - returns the instance associated to the given name or synonym (given its scope, EXACT by default)
Remark - this function should be carefully used since among ontologies there may be homonyms at the level of the synonyms (e.g. locations)
Remark - the argument (string) is case sensitive
get_terms_by_name
Usage - $ontology->get_terms_by_name($name)
Returns - the term set (OBO::Util::TermSet) with all the terms (OBO::Core::Term) having $name in their names
Args - the term name (string)
Function - returns the terms having $name in their names
get_instances_by_name
Usage - $ontology->get_instances_by_name($name)
Returns - the instance set (OBO::Util::InstanceSet) with all the instances (OBO::Core::Instance) having $name in their names
Args - the instance name (string)
Function - returns the instances having $name in their names
get_relationship_types_by_name
Usage - $ontology->get_relationship_types_by_name($name)
Returns - the relationship types set (OBO::Util::RelationshipTypeSet) with all the relationship types (OBO::Core::RelationshipType) having $name in their names
Args - the relationship type name (string)
Function - returns the relationship type having $name in their names
get_relationship_type_by_name
Usage - $ontology->get_relationship_type_by_name($name)
Returns - the relationship type (OBO::Core::RelationshipType) associated to the given name
Args - the relationship type's name (string)
Function - returns the relationship type associated to the given name
add_relationship
Usage - $ontology->add_relationship($relationship)
Returns - none
Args - the relationship (OBO::Core::Relationship) to be added between two existing terms or two relationship types
Function - adds a relationship between either two terms or two relationship types.
Remark - If the terms or relationship types bound by this relationship are not yet in the ontology, they will be added
Remark - if you are adding relationships to an ontology, sometimes it might be better to add their type first (usually if you are building a new ontology from an extant one)
get_relationship_by_id
Usage - print $ontology->get_relationship_by_id()
Returns - the relationship (OBO::Core::Relationship) associated to the given id
Args - the relationship id (string)
Function - returns the relationship associated to the given relationship id
create_rel
Usage - $ontology->create_rel($tail, $type, $head)
Returns - the OBO::Core::Ontology object
Args - an OBO::Core::(Term|Relationship) object, a relationship type string (e.g. 'is_a'), and an OBO::Core::(Term|Relationship) object
Function - creates and adds a new relationship (between two terms or relationships) to this ontology
get_child_terms
Usage - $ontology->get_child_terms($term)
Returns - a reference to an array with the child terms (OBO::Core::Term) of the given term
Args - the term (OBO::Core::Term) for which the children will be found
Function - returns the child terms of the given term
get_parent_terms
Usage - $ontology->get_parent_terms($term)
Returns - a reference to an array with the parent terms (OBO::Core::Term) of the given term
Args - the term (OBO::Core::Term) for which the parents will be found
Function - returns the parent terms of the given term
get_head_by_relationship_type
Usage - $ontology->get_head_by_relationship_type($term, $relationship_type) or $ontology->get_head_by_relationship_type($rel_type, $relationship_type)
Returns - a reference to an array of terms (OBO::Core::Term) or relationship types (OBO::Core::RelationshipType) pointed out by the relationship of the given type; otherwise undef
Args - the term (OBO::Core::Term) or relationship type (OBO::Core::RelationshipType) and the pointing relationship type (OBO::Core::RelationshipType)
Function - returns the terms or relationship types pointed out by the relationship of the given type
get_tail_by_relationship_type
Usage - $ontology->get_tail_by_relationship_type($term, $relationship_type) or $ontology->get_tail_by_relationship_type($rel_type, $relationship_type)
Returns - a reference to an array of terms (OBO::Core::Term) or relationship types (OBO::Core::RelationshipType) pointing out the given term by means of the given relationship type; otherwise undef
Args - the term (OBO::Core::Term) or relationship type (OBO::Core::RelationshipType) and the relationship type (OBO::Core::RelationshipType)
Function - returns the terms or relationship types pointing out the given term by means of the given relationship type
get_root_terms
Usage - $ontology->get_root_terms()
Returns - the root term(s) held by this ontology (as a reference to an array of OBO::Core::Term's)
Args - none
Function - returns the root term(s) held by this ontology
get_number_of_terms
Usage - $ontology->get_number_of_terms()
Returns - the number of terms held by this ontology
Args - none
Function - returns the number of terms held by this ontology
get_number_of_instances
Usage - $ontology->get_number_of_instances()
Returns - the number of instances held by this ontology
Args - none
Function - returns the number of instances held by this ontology
get_number_of_relationships
Usage - $ontology->get_number_of_relationships()
Returns - the number of relationships held by this ontology
Args - none
Function - returns the number of relationships held by this ontology
get_number_of_relationship_types
Usage - $ontology->get_number_of_relationship_types()
Returns - the number of relationship types held by this ontology
Args - none
Function - returns the number of relationship types held by this ontology
export2obo
See - OBO::Core::Ontology::export()
export2rdf
See - OBO::Core::Ontology::export()
export2owl
See - OBO::Core::Ontology::export()
export2xml
See - OBO::Core::Ontology::export()
export2dot
See - OBO::Core::Ontology::export()
export2gml
See - OBO::Core::Ontology::export()
export
Usage - $ontology->export($export_format, $output_file_handle, $error_file_handle)
Returns - exports this ontology
Args - the format: obo, xml, owl, dot, gml, xgmml, sbml
- the output file handle (e.g. STDOUT), and
- the error file handle (STDERR by default; if not writable, STDOUT is used)
Function - exports this ontology
Remark - warning and errors are printed to the STDERR (by default)
Remark - you may use this method to check your OBO file syntax and/or to clean it up
Remark - Standard arguments:
- 1. Format, one of 'obo', 'rdf', 'xml', 'owl', 'dot', 'gml', 'xgmml', 'sbml'
- 2. Otput filehandle \*OUT
- 3. Error filehandle \*ERR ( default \*STDERR, but for RDF or OWL )
- Extra arguments:
- 'rdf':
- 1. base URI (e.g. 'http://www.semantic-systems-biology.org/')
- 2. name space (e.g. 'SSB')
- 3. Flag, 1=construct closures, 0=no closures (default)
- 4. Flag, 1=skip exporting Typedefs, 0=export Typedefs (default)
- 'owl':
- 1. URI for content
- 2. URI for OboInOwl (optional)
- 3. note: the OWL export is broken!
subontology_by_terms
Usage - $ontology->subontology_by_terms($term_set)
Returns - a subontology with the given terms from this ontology
Args - the terms (OBO::Util::TermSet) that will be included in the subontology
Function - creates a subontology based on the given terms from this ontology
Remark - instances of terms (classes) are added to the resulting ontology
get_subontology_from
Usage - $ontology->get_subontology_from($new_root_term)
Returns - a subontology from the given term of this ontology
Args - the term (OBO::Core::Term) that is the root of the subontology, and optionally, a reference to relationship type ids
Function - creates a subontology having as root the given term
get_terms_idspace
Usage - $ontology->get_terms_idspace()
Returns - the idspace (e.g. GO) of the terms held by this ontology (or 'NN' is there is no idspace)
Args - none
Function - look for the idspace of the terms held by this ontology
Remark - it is assumed that most of the terms share the same idspace (e.g. GO)
get_instances_idspace
Usage - $ontology->get_instances_idspace()
Returns - the idspace (e.g. GO) of the instances held by this ontology (or 'NN' is there is no idspace)
Args - none
Function - look for the idspace of the instances held by this ontology
Remark - it is assumed that most of the instances share the same idspace (e.g. GO)
get_descendent_terms
Usage - $ontology->get_descendent_terms($term) or $ontology->get_descendent_terms($term_id)
Returns - a set with the descendent terms (OBO::Core::Term) of the given term
Args - the term, as an object (OBO::Core::Term) or string (e.g. GO:0003677), for which all the descendents will be found
Function - returns recursively all the child terms of the given term
get_ancestor_terms
Usage - $ontology->get_ancestor_terms($term)
Returns - a set with the ancestor terms (OBO::Core::Term) of the given term
Args - the term (OBO::Core::Term) for which all the ancestors will be found
Function - returns recursively all the parent terms of the given term
get_descendent_terms_by_subnamespace
Usage - $ontology->get_descendent_terms_by_subnamespace($term, subnamespace)
Returns - a set with the descendent terms (OBO::Core::Term) of the given subnamespace
Args - the term (OBO::Core::Term), the subnamespace (string, e.g. 'P', 'R', 'Ia' etc)
Function - returns recursively the given term's children of the given subnamespace
get_ancestor_terms_by_subnamespace
Usage - $ontology->get_ancestor_terms_by_subnamespace($term, subnamespace)
Returns - a set with the ancestor terms (OBO::Core::Term) of the given subnamespace
Args - the term (OBO::Core::Term), the subnamespace (string, e.g. 'P', 'R', 'Ia' etc)
Function - returns recursively the given term's parents of the given subnamespace
get_descendent_terms_by_relationship_type
Usage - $ontology->get_descendent_terms_by_relationship_type($term, $rel_type)
Returns - a set with the descendent terms (OBO::Core::Term) of the given term linked by the given relationship type
Args - OBO::Core::Term object, OBO::Core::RelationshipType object
Function - returns recursively all the child terms of the given term linked by the given relationship type
get_ancestor_terms_by_relationship_type
Usage - $ontology->get_ancestor_terms_by_relationship_type($term, $rel_type)
Returns - a set with the ancestor terms (OBO::Core::Term) of the given term linked by the given relationship type
Args - OBO::Core::Term object, OBO::Core::RelationshipType object
Function - returns recursively the parent terms of the given term linked by the given relationship type
get_term_by_xref
Usage - $ontology->get_term_by_xref($db, $acc)
Returns - the term (OBO::Core::Term) associated with the given external database ID. 'undef' is returned if there is no term for the given arguments.
Args - the name of the external database and the ID (strings)
Function - returns the term associated with the given external database ID
get_instance_by_xref
Usage - $ontology->get_instance_by_xref($db, $acc)
Returns - the instance (OBO::Core::Instance) associated with the given external database ID. 'undef' is returned if there is no instance for the given arguments.
Args - the name of the external database and the ID (strings)
Function - returns the instance associated with the given external database ID
get_paths_term1_term2
Usage - $ontology->get_paths_term1_term2($term1_id, $term2_id)
Returns - an array of references to the paths between term1 and term2
Args - the IDs of the terms for which a path (or paths) will be found
Function - returns the path(s) linking term1 and term2, where term1 is more specific than term2
get_paths_term_terms
Usage - $ontology->get_paths_term_terms($term, $set_of_terms)
Returns - an array of references to the paths between a given term ID and a given set of terms IDs
Args - the ID of the term (string) for which a path (or paths) will be found and a set of terms (OBO::Util::Set)
Function - returns the path(s) linking the given term and the given set of terms
get_paths_term_terms_same_rel
Usage - $ontology->get_paths_term_terms_same_rel($term_id, $set_of_terms, $type_of_relationship)
Returns - an array of references to the paths between a given term ID and a given set of terms IDs
Args - the ID of the term (string) for which a path (or paths) will be found, a set of terms (OBO::Util::Set) and the ID of the relationship type
Function - returns the path(s) linking the given term (term ID) and the given set of terms along the same relationship (e.g. is_a)
obo_id2owl_id
Usage - $ontology->obo_id2owl_id($term)
Returns - the ID for OWL representation.
Args - the OBO-type ID.
Function - Transform an OBO-type ID into an OWL-type one. E.g. APO:I1234567 -> APO_I1234567
owl_id2obo_id
Usage - $ontology->owl_id2obo_id($term)
Returns - the ID for OBO representation.
Args - the OWL-type ID.
Function - Transform an OWL-type ID into an OBO-type one. E.g. APO_I1234567 -> APO:I1234567
__char_hex_http
Usage - $ontology->__char_hex_http($seq)
Returns - the sequence with the numeric HTML representation for the given special character
Args - the sequence of characters
Function - Transforms a character into its equivalent HTML number, e.g. : -> :
NAME
OBO::Core::Ontology - An ontology of terms/concepts/universals, instances/individuals and relationships/properties.
SYNOPSIS
use OBO::Core::Ontology;
use OBO::Core::Term;
use OBO::Core::Relationship;
use OBO::Core::RelationshipType;
use strict;
# three new terms
my $n1 = OBO::Core::Term->new();
my $n2 = OBO::Core::Term->new();
my $n3 = OBO::Core::Term->new();
# new ontology
my $onto = OBO::Core::Ontology->new;
$n1->id("APO:P0000001");
$n2->id("APO:P0000002");
$n3->id("APO:P0000003");
$n1->name("One");
$n2->name("Two");
$n3->name("Three");
my $def1 = OBO::Core::Def->new();
$def1->text("Definition of One");
my $def2 = OBO::Core::Def->new();
$def2->text("Definition of Two");
my $def3 = OBO::Core::Def->new();
$def3->text("Definition of Three");
$n1->def($def1);
$n2->def($def2);
$n3->def($def3);
$onto->add_term($n1);
$onto->add_term($n2);
$onto->add_term($n3);
$onto->delete_term($n1);
$onto->add_term($n1);
# new term
my $n4 = OBO::Core::Term->new();
$n4->id("APO:P0000004");
$n4->name("Four");
my $def4 = OBO::Core::Def->new();
$def4->text("Definition of Four");
$n4->def($def4);
$onto->delete_term($n4);
$onto->add_term($n4);
# add term as string
my $new_term = $onto->add_term_as_string("APO:P0000005", "Five");
$new_term->def_as_string("This is a dummy definition", '[APO:vm, APO:ls, APO:ea "Erick Antezana"]');
my $n5 = $new_term;
# five new relationships
my $r12 = OBO::Core::Relationship->new();
my $r23 = OBO::Core::Relationship->new();
my $r13 = OBO::Core::Relationship->new();
my $r14 = OBO::Core::Relationship->new();
my $r35 = OBO::Core::Relationship->new();
$r12->id("APO:P0000001_is_a_APO:P0000002");
$r23->id("APO:P0000002_part_of_APO:P0000003");
$r13->id("APO:P0000001_participates_in_APO:P0000003");
$r14->id("APO:P0000001_participates_in_APO:P0000004");
$r35->id("APO:P0000003_part_of_APO:P0000005");
$r12->type('is_a');
$r23->type('part_of');
$r13->type("participates_in");
$r14->type("participates_in");
$r35->type('part_of');
$r12->link($n1, $n2);
$r23->link($n2, $n3);
$r13->link($n1, $n3);
$r14->link($n1, $n4);
$r35->link($n3, $n5);
# get all terms
my $c = 0;
my %h;
foreach my $t (@{$onto->get_terms()}) {
$h{$t->id()} = $t;
$c++;
}
# get terms with argument
my @processes = sort {$a->id() cmp $b->id()} @{$onto->get_terms("APO:P.*")};
my @odd_processes = sort {$a->id() cmp $b->id()} @{$onto->get_terms("APO:P000000[35]")};
$onto->idspace_as_string("APO", "http://www.cellcycle.org/ontology/APO");
my @same_processes = @{$onto->get_terms_by_subnamespace("P")};
my @no_processes = @{$onto->get_terms_by_subnamespace("p")};
# add relationships
$onto->add_relationship($r12);
$onto->add_relationship($r23);
$onto->add_relationship($r13);
$onto->add_relationship($r14);
$onto->add_relationship($r35);
# add relationships and terms linked by this relationship
my $n11 = OBO::Core::Term->new();
my $n21 = OBO::Core::Term->new();
$n11->id("APO:P0000011"); $n11->name("One one"); $n11->def_as_string("Definition One one", "");
$n21->id("APO:P0000021"); $n21->name("Two one"); $n21->def_as_string("Definition Two one", "");
my $r11_21 = OBO::Core::Relationship->new();
$r11_21->id("APO:R0001121"); $r11_21->type("r11-21");
$r11_21->link($n11, $n21);
$onto->add_relationship($r11_21); # adds to the ontology the terms linked by this relationship
# get all relationships
my %hr;
foreach my $r (@{$onto->get_relationships()}) {
$hr{$r->id()} = $r;
}
# get children
my @children = @{$onto->get_child_terms($n1)};
@children = @{$onto->get_child_terms($n3)};
my %ct;
foreach my $child (@children) {
$ct{$child->id()} = $child;
}
@children = @{$onto->get_child_terms($n2)};
# get parents
my @parents = @{$onto->get_parent_terms($n3)};
@parents = @{$onto->get_parent_terms($n1)};
@parents = @{$onto->get_parent_terms($n2)};
# get all descendents
my @descendents1 = @{$onto->get_descendent_terms($n1)};
my @descendents2 = @{$onto->get_descendent_terms($n2)};
my @descendents3 = @{$onto->get_descendent_terms($n3)};
my @descendents5 = @{$onto->get_descendent_terms($n5)};
# get all ancestors
my @ancestors1 = @{$onto->get_ancestor_terms($n1)};
my @ancestors2 = @{$onto->get_ancestor_terms($n2)};
my @ancestors3 = @{$onto->get_ancestor_terms($n3)};
# get descendents by term subnamespace
my @descendents4 = @{$onto->get_descendent_terms_by_subnamespace($n1, 'P')};
my @descendents5 = @{$onto->get_descendent_terms_by_subnamespace($n2, 'P')};
my @descendents6 = @{$onto->get_descendent_terms_by_subnamespace($n3, 'P')};
my @descendents6 = @{$onto->get_descendent_terms_by_subnamespace($n3, 'R')};
# get ancestors by term subnamespace
my @ancestors4 = @{$onto->get_ancestor_terms_by_subnamespace($n1, 'P')};
my @ancestors5 = @{$onto->get_ancestor_terms_by_subnamespace($n2, 'P')};
my @ancestors6 = @{$onto->get_ancestor_terms_by_subnamespace($n3, 'P')};
my @ancestors6 = @{$onto->get_ancestor_terms_by_subnamespace($n3, 'R')};
# three new relationships types
my $r1 = OBO::Core::RelationshipType->new();
my $r2 = OBO::Core::RelationshipType->new();
my $r3 = OBO::Core::RelationshipType->new();
$r1->id("APO:R0000001");
$r2->id("APO:R0000002");
$r3->id("APO:R0000003");
$r1->name('is_a');
$r2->name('part_of');
$r3->name("participates_in");
# add relationship types
$onto->add_relationship_type($r1);
$onto->add_relationship_type($r2);
$onto->add_relationship_type($r3);
# get descendents or ancestors linked by a particular relationship type
my $rel_type1 = $onto->get_relationship_type_by_name('is_a');
my $rel_type2 = $onto->get_relationship_type_by_name('part_of');
my $rel_type3 = $onto->get_relationship_type_by_name("participates_in");
my @descendents7 = @{$onto->get_descendent_terms_by_relationship_type($n5, $rel_type1)};
@descendents7 = @{$onto->get_descendent_terms_by_relationship_type($n5, $rel_type2)};
@descendents7 = @{$onto->get_descendent_terms_by_relationship_type($n2, $rel_type1)};
@descendents7 = @{$onto->get_descendent_terms_by_relationship_type($n3, $rel_type3)};
my @ancestors7 = @{$onto->get_ancestor_terms_by_relationship_type($n1, $rel_type1)};
@ancestors7 = @{$onto->get_ancestor_terms_by_relationship_type($n1, $rel_type2)};
@ancestors7 = @{$onto->get_ancestor_terms_by_relationship_type($n1, $rel_type3)};
@ancestors7 = @{$onto->get_ancestor_terms_by_relationship_type($n2, $rel_type2)};
# add relationship type as string
my $relationship_type = $onto->add_relationship_type_as_string("APO:R0000004", "has_participant");
# get relationship types
my @rt = @{$onto->get_relationship_types()};
my %rrt;
foreach my $relt (@rt) {
$rrt{$relt->name()} = $relt;
}
my @rtbt = @{$onto->get_relationship_types_by_term($n1)};
my %rtbth;
foreach my $relt (@rtbt) {
$rtbth{$relt} = $relt;
}
# get_head_by_relationship_type
my @heads_n1 = @{$onto->get_head_by_relationship_type($n1, $onto->get_relationship_type_by_name("participates_in"))};
my %hbrt;
foreach my $head (@heads_n1) {
$hbrt{$head->id()} = $head;
}
DESCRIPTION
This module supports the manipulation of OBO-formatted ontologies, such as the Gene Ontology (http://www.geneontology.org/) or the Cell Cycle Ontology (http://www.cellcycleontology.org). For a longer list of OBO-formatted ontologies, look at http://www.obofoundry.org/.
This module basically provides a representation of a directed acyclic graph (DAG) holding terms (OBO::Core::Term) which in turn are linked by relationships (OBO::Core::Relationship). Those relationships have an associated relationship type (OBO::Core::RelationshipType).
AUTHOR
Erick Antezana, <erick.antezana -@- gmail.com>
COPYRIGHT AND LICENSE
Copyright (c) 2006-2014 by Erick Antezana
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.7 or, at your option, any later version of Perl 5 you may have available.