Building an ontology from an existing sub-ontology

## Working with sub-ontologies

1. Building an ontology from an existing sub-ontology.

1. Building an ontology from an existing sub-ontology:

       			use OBO::Parser::OBOParser;

       			my $my_parser = OBO::Parser::OBOParser->new();
       			my $onto = $my_parser->work("gene_ontology.obo");        # load: gene_ontology.obo

       			my $sub_ontology_root_id = "GO:0007126";                 # term: meiosis
       			my $term = $onto->get_term_by_id($sub_ontology_root_id); # get the term 'meiosis'
       			my @descendents = @{$onto->get_descendent_terms($term)}; # get its descendants
       			unshift @descendents, $term;

       			my $term_set = OBO::Util::TermSet->new();
       			$term_set->add_all(@descendents);                        # collect the descendants
       			my $so = $onto->subontology_by_terms($term_set);         # get the sub-ontology
       			$so->default_namespace("meiosis_ontology");
       			$so->subsets($onto->subsets()->get_set());
       			$so->remarks("A Meiosis Sub-Ontology");

Copyright (c) 2006-2015 by Erick Antezana. All rights reserved.