The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
<title>Retrieve the descendants of a given term</title>
</head>
<body>

<h2>Getting children terms and/or descendant ones</h2>
	
<ol>
	<li><a href="#1">Get all the descendant terms of a given term.</a></li>
		
	<li><a href="#2">Get only the child terms of a given term.</a></li>

</ol>
	
	<ol>
	<li> <b><a name="1">Get all the descendant terms of a given term:</a></b>
		<pre>
		
			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();
			}
			
		</pre>
	</li>

	<li> <b><a name="2">Get only the child terms of a given term:</a></b>
		<pre>
		
			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();
			}
			
		</pre>
	</li>
	</ol>
</body>
</html>