[Bioperl-l] GO parser, GO engine
Chris Zmasek
czmasek@gnf.org
Thu, 10 Oct 2002 23:19:19 -0700
Hi!
We are ready to submit our GO parser.
In short, it can be used as follows:
Method "parse" of Bio::Ontology::simpleGOparser returns a Bio::Ontology::simpleGOengine object [implements Bio::Ontology::OntologyEngineI]. This engine provides standard methods to query the ontology (such as methods for getting child terms, parent terms, ancestor terms, descendant terms, root terms, etc. -- "child" refers to direct descendants, whereas "descendant" refers to all descendant of a term).
All the terms used are Bio::Ontology::GOterms.
It is implemented based on the Graph module. Hence, all the methods of Graph can be used, too (through method "graph" which allows clients to access the underlying graph).
Please let me know what you think.
Thanks
-- CZ
In the following is an example:
-----
use Bio::Ontology::simpleGOparser;
my $parser = Bio::Ontology::simpleGOparser->new( -go_defs_file_name => "/home/czmasek/GO/GO.defs",
-components_file_name => "/home/czmasek/GO/component.ontology",
-functions_file_name => "/home/czmasek/GO/function.ontology",
-processes_file_name => "/home/czmasek/GO/process.ontology" );
my $engine = $parser->parse();
my $IS_A = $engine->is_a_relationship();
my $PART_OF = $engine->part_of_relationship();
# root terms
# ----------
print scalar( $engine->get_root_terms() ), "\n";
print( ( $engine->get_root_terms() )[ 0 ]->to_string(), "\n" );
print "\n\n";
# parent terms
# ------------
my @parents1 = $engine->get_parent_terms( "GO:0045474", $IS_A );
my @parents2 = $engine->get_parent_terms( $parents1[ 0 ] );
foreach my $p ( @parents2 ) {
print $p->to_string(), "\n";
}
print "\n\n";
# child terms
# -----------
my @child0 = $engine->get_child_terms( ( $engine->get_root_terms() )[ 0 ] );
foreach my $c ( @child0 ) {
print $c->to_string(), "\n";
}
print "\n\n";
my @child1 = $engine->get_child_terms( "GO:0008044", $IS_A );
foreach my $cc ( @child1 ) {
print $cc->to_string(), "\n";
}
print "\n\n";
# ancestor terms
# --------------
my @ancestor1 = $engine->get_ancestor_terms( "GO:0007323", $PART_OF );
# descendant terms
# ----------------
my @descendant1 = $engine->get_descendant_terms( "GO:0007323", $PART_OF );
# relationships
# -------------
my @rel1 = $engine->get_relationships( "GO:0007323", $PART_OF, $IS_A );
# leaf terms
# ----------
my @l1 = $engine->get_leaf_terms();
# get term with id
# ----------------
my $term = $engine->get_term( "GO:0001661" );
# all terms
# ---------
my @terms = $engine->each_term();