---
name: "Bio::Ontology::OBOEngine"
section: "3pm"
platform: "linux"
package: "libbio-perl-perl"
version: "1.7.8-1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/Bio::Ontology::OBOEngine"
---

# Bio::Ontology::OBOEngine(3pm)

An Ontology Engine for OBO style flat file format from the Gene Ontology Consortium

## NAME

Bio::Ontology::OBOEngine - An Ontology Engine for OBO style flat file format from the Gene Ontology Consortium

## SYNOPSIS

```
  use Bio::Ontology::OBOEngine;
  my $parser = Bio::Ontology::OBOEngine->new
        ( -file => "gene_ontology.obo" );
  my $engine = $parser->parse();
```

## DESCRIPTION

Needs Graph.pm from CPAN.

This module replaces SimpleGOEngine.pm, which is deprecated.

## 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 lists  Your participation is much appreciated.

```
  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. 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 the bugs and their resolution.  Bug reports can be submitted via the web:

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

## AUTHOR

Sohel Merchant

Email: s-merchant@northwestern.edu

Address:

```
  Northwestern University
  Center for Genetic Medicine (CGM), dictyBase
  Suite 1206,
  676 St. Clair st
  Chicago IL 60611
```

### CONTRIBUTOR

```
 Hilmar Lapp, hlapp at gmx.net
 Chris Mungall,   cjm at fruitfly.org
```

## APPENDIX

The rest of the documentation details each of the object methods. Internal methods are usually preceded with a \_

### new

```
 Title   : new
 Usage   : $engine = Bio::Ontology::OBOEngine->new()
 Function: Creates a new OBOEngine
 Returns : A new OBOEngine object
 Args    :
```

### init

```
 Title   : init()
 Usage   : $engine->init();
 Function: Initializes this Engine.
 Returns :
 Args    :
```

### is\_a\_relationship

```
 Title   : is_a_relationship()
 Usage   : $IS_A = $engine->is_a_relationship();
 Function: Returns a Bio::Ontology::RelationshipType object for "is-a"
           relationships
 Returns : Bio::Ontology::RelationshipType set to "IS_A"
 Args    :
```

### part\_of\_relationship

```
 Title   : part_of_relationship()
 Usage   : $PART_OF = $engine->part_of_relationship();
 Function: Returns a Bio::Ontology::RelationshipType object for "part-of"
           relationships
 Returns : Bio::Ontology::RelationshipType set to "PART_OF"
 Args    :
```

### related\_to\_relationship

```
 Title   : related_to_relationship()
 Usage   : $RELATED_TO = $engine->related_to_relationship();
 Function: Returns a Bio::Ontology::RelationshipType object for "related-to"
           relationships
 Returns : Bio::Ontology::RelationshipType set to "RELATED_TO"
 Args    :
```

### regulates\_relationship

```
 Title   : regulates_relationship()
 Usage   : $REGULATES = $engine->regulates_relationship();
 Function: Returns a Bio::Ontology::RelationshipType object for "regulates"
           relationships
 Returns : Bio::Ontology::RelationshipType set to "REGULATES"
 Args    :
```

### positively\_regulates\_relationship

```
 Title   : positively_regulates_relationship()
 Usage   : $REGULATES = $engine->positively_regulates_relationship();
 Function: Returns a Bio::Ontology::RelationshipType object for "positively_regulates"
           relationships
 Returns : Bio::Ontology::RelationshipType set to "POSITIVELY_REGULATES"
 Args    :
```

### negatively\_regulates\_relationship

```
 Title   : negatively_regulates_relationship()
 Usage   : $REGULATES = $engine->negatively_regulates_relationship();
 Function: Returns a Bio::Ontology::RelationshipType object for "negatively_regulates"
           relationships
 Returns : Bio::Ontology::RelationshipType set to "POSITIVELY_REGULATES"
 Args    :
```

### add\_term

```
 Title   : add_term
 Usage   : $engine->add_term( $term_obj );
 Function: Adds a Bio::Ontology::TermI to this engine
 Returns : true if the term was added and false otherwise (e.g., if the
           term already existed in the ontology engine)
 Args    : Bio::Ontology::TermI`
```

### has\_term

```
 Title   : has_term
 Usage   : $engine->has_term( $term );
 Function: Checks whether this engine contains a particular term
 Returns : true or false
 Args    : Bio::Ontology::TermI
           or
           Term identifier (e.g. "GO:0012345")
```

### add\_relationship\_type

```
 Title   : add_relationship_type
 Usage   : $engine->add_relationship_type( $type_name, $ont );
 Function: Adds a new relationship type to the engine.  Use
           get_relationship_type($type_name) to retrieve.
 Returns : true if successfully added, false otherwise
 Args    : relationship type name to add (scalar)
           ontology to which to assign the relationship type
```

### get\_relationship\_type

```
 Title   : get_relationship_type
 Usage   : $engine->get_relationship_type( $type_name );
 Function: Gets a Bio::Ontology::RelationshipI object corresponding
           to $type_name
 Returns : a Bio::Ontology::RelationshipI object
 Args    :
```

### add\_relationship

```
 Title   : add_relationship
 Usage   : $engine->add_relationship( $relationship );
           $engine->add_relatioship( $subject_term, $predicate_term,
                                     $object_term, $ontology );
           $engine->add_relatioship( $subject_id, $predicate_id,
                                     $object_id, $ontology);
 Function: Adds a relationship to this engine
 Returns : true if successfully added, false otherwise
 Args    : The relationship in one of three ways:
             a) subject (or child) term id, Bio::Ontology::TermI
                (rel.type), object (or parent) term id, ontology
           or
             b) subject Bio::Ontology::TermI, predicate
                Bio::Ontology::TermI (rel.type), object
                Bio::Ontology::TermI, ontology
           or
             c) Bio::Ontology::RelationshipI-compliant object
```

### get\_relationships

```
 Title   : get_relationships
 Usage   : $engine->get_relationships( $term );
 Function: Returns all relationships of a term, or all relationships in
           the graph if no term is specified.
 Returns : Relationship
 Args    : term id
           or
           Bio::Ontology::TermI
```

### get\_all\_relationships

```
 Title   : get_all_relationships
 Usage   : @rels = $engine->get_all_relationships();
 Function: Returns all relationships in the graph.
 Returns : Relationship
 Args    :
```

### get\_predicate\_terms

```
 Title   : get_predicate_terms
 Usage   : $engine->get_predicate_terms();
 Function: Returns the types of relationships this engine contains
 Returns : Bio::Ontology::RelationshipType
 Args    :
```

### get\_child\_terms

```
 Title   : get_child_terms
 Usage   : $engine->get_child_terms( $term_obj, @rel_types );
           $engine->get_child_terms( $term_id, @rel_types );
 Function: Returns the children of this term
 Returns : Bio::Ontology::TermI
 Args    : Bio::Ontology::TermI, Bio::Ontology::RelationshipType
           or
           term id, Bio::Ontology::RelationshipType
           if NO Bio::Ontology::RelationshipType is indicated: children
           of ALL types are returned
```

### get\_descendant\_terms

```
 Title   : get_descendant_terms
 Usage   : $engine->get_descendant_terms( $term_obj, @rel_types );
           $engine->get_descendant_terms( $term_id, @rel_types );
 Function: Returns the descendants of this term
 Returns : Bio::Ontology::TermI
 Args    : Bio::Ontology::TermI, Bio::Ontology::RelationshipType
           or
           term id, Bio::Ontology::RelationshipType
           if NO Bio::Ontology::RelationshipType is indicated:
           descendants of ALL types are returned
```

### get\_parent\_terms

```
 Title   : get_parent_terms
 Usage   : $engine->get_parent_terms( $term_obj, @rel_types );
           $engine->get_parent_terms( $term_id, @rel_types );
 Function: Returns the parents of this term
 Returns : Bio::Ontology::TermI
 Args    : Bio::Ontology::TermI, Bio::Ontology::RelationshipType
           or
           term id, Bio::Ontology::RelationshipType
           if NO Bio::Ontology::RelationshipType is indicated:
           parents of ALL types are returned
```

### get\_ancestor\_terms

```
 Title   : get_ancestor_terms
 Usage   : $engine->get_ancestor_terms( $term_obj, @rel_types );
           $engine->get_ancestor_terms( $term_id, @rel_types );
 Function: Returns the ancestors of this term
 Returns : Bio::Ontology::TermI
 Args    : Bio::Ontology::TermI, Bio::Ontology::RelationshipType
           or
           term id, Bio::Ontology::RelationshipType
           if NO Bio::Ontology::RelationshipType is indicated:
           ancestors of ALL types are returned
```

### get\_leaf\_terms

```
 Title   : get_leaf_terms
 Usage   : $engine->get_leaf_terms();
 Function: Returns the leaf terms
 Returns : Bio::Ontology::TermI
 Args    :
```

### get\_root\_terms()

```
 Title   : get_root_terms
 Usage   : $engine->get_root_terms();
 Function: Returns the root terms
 Returns : Bio::Ontology::TermI
 Args    :
```

### get\_terms

```
 Title   : get_terms
 Usage   : @terms = $engine->get_terms( "GO:1234567", "GO:2234567" );
 Function: Returns term objects with given identifiers
 Returns : Bio::Ontology::TermI, or the term corresponding to the
           first identifier if called in scalar context
 Args    : term ids
```

### get\_all\_terms

```
 Title   : get_all_terms
 Usage   : $engine->get_all_terms();
 Function: Returns all terms in this engine
 Returns : Bio::Ontology::TermI
 Args    :
```

### 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\_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
 Example :
 Returns : an array of zero or more Bio::Ontology::TermI objects
 Args    : a Bio::Ontology::TermI object
```

### 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
 Example :
 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.
 Example :
 Returns : an array of zero or more Bio::Ontology::TermI objects
 Args    : a Bio::Ontology::TermI object
```

### 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.
 Example :
 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 to be used when term objects are
           created by the implementation on-the-fly.
           Note that this ontology engine implementation does not
           create term objects on the fly, and therefore setting this
           attribute is meaningless.
 Example :
 Returns : value of term_factory (a Bio::Factory::ObjectFactoryI
           compliant object)
 Args    : on set, a Bio::Factory::ObjectFactoryI compliant object
```

### graph

```
 Title   : graph()
 Usage   : $engine->graph();
 Function: Returns the Graph this engine is based on
 Returns : Graph
 Args    :
```
