[Bioperl-l] GO parser, GO engine

Hilmar Lapp hlapp@gnf.org
Thu, 10 Oct 2002 23:55:34 -0700


ChrisZ, if you're still there, can you post the method PODs of 
OntologyEngineI to the list for feedback.

OK -- I just see you sent code examples. Should give an idea as well.

I should mention OntologyEngineI is basically our proposal for a 
common denominator simple interface for querying an ontology. An 
ontology parser must return an implementation of that when 
next_ontology() is called. It largely resembles ChrisM's 
StructuredVocabI, with some methods left out, and some name changes 
to untie it from graph jargon (believe it or not but we had a heated 
discussion here about the best - most intuitive and ontology-ish - 
naming).

ChrisZ, I realize you need to move some things into the OntologyIO 
directory, but that's minor. (Just in case core people get nervous, 
we'll sort this out here to conform to conventions :-)

	-hilmar

On Thursday, October 10, 2002, at 11:19 PM, Chris Zmasek wrote:

>
> 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();
>
>
>
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l@bioperl.org
> http://bioperl.org/mailman/listinfo/bioperl-l
>
--
-------------------------------------------------------------
Hilmar Lapp                            email: lapp at gnf.org
GNF, San Diego, Ca. 92121              phone: +1-858-812-1757
-------------------------------------------------------------