Getting children terms and/or descendant ones

  1. Get all the descendant terms of a given term.
  2. Get only the child terms of a given term.
  1. Get all the descendant terms of a given term:
    		
    			use OBO::Parser::OBOParser;
    			
    			my $my_parser = OBO::Parser::OBOParser->new();
    			my $ontology = $my_parser->work("my_obo_ontology.obo");
    			
    			my $interesting_term = $ontology->get_term_by_name("protein");
    			
    			my @descendents = @{$onto->get_descendent_terms($interesting_term)};
    			
    			foreach my $t (@descendents) {
    				print "The name of the descendant term is: ", $t->name();
    			}
    			
    		
  2. Get only the child terms of a given term:
    		
    			use OBO::Parser::OBOParser;
    			
    			my $my_parser = OBO::Parser::OBOParser->new();
    			my $ontology = $my_parser->work("my_obo_ontology.obo");
    			
    			my $interesting_term = $ontology->get_term_by_name("protein");
    			
    			my @children = @{$onto->get_child_terms($interesting_term)};
    			
    			foreach my $t (@children) {
    				print "The name of the child term is: ", $t->name();
    			}