3 # BioPerl module for Bio::Ontology::SimpleGOEngine
5 # Cared for by Christian M. Zmasek <czmasek@gnf.org> or <cmzmasek@yahoo.com>
7 # (c) Christian M. Zmasek, czmasek@gnf.org, 2002.
8 # (c) GNF, Genomics Institute of the Novartis Research Foundation, 2002.
10 # You may distribute this module under the same terms as perl itself.
11 # Refer to the Perl Artistic License (see the license accompanying this
12 # software package, or see http://www.perl.com/language/misc/Artistic.html)
13 # for the terms under which you may use, modify, and redistribute this module.
15 # THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
16 # WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
17 # MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
19 # You may distribute this module under the same terms as perl itself
21 # POD documentation - main docs before the code
25 Bio::Ontology::SimpleGOEngine - a Ontology Engine for GO implementing OntologyEngineI
29 use Bio::Ontology::SimpleGOEngine;
31 my $parser = Bio::Ontology::SimpleGOEngine->new
32 ( -defs_file => "/home/czmasek/GO/GO.defs",
33 -files => ["/home/czmasek/GO/component.ontology",
34 "/home/czmasek/GO/function.ontology",
35 "/home/czmasek/GO/process.ontology"] );
37 my $engine = $parser->parse();
39 my $IS_A = Bio::Ontology::RelationshipType->get_instance( "IS_A" );
40 my $PART_OF = Bio::Ontology::RelationshipType->get_instance( "PART_OF" );
41 my $RELATED_TO = Bio::Ontology::RelationshipType->get_instance( "RELATED_TO" );
45 This class is deprecated and instead Bio::Ontology::OBOEngine should be used.
47 Needs Graph.pm from CPAN.
53 User feedback is an integral part of the evolution of this and other
54 Bioperl modules. Send your comments and suggestions preferably to the
55 Bioperl mailing lists Your participation is much appreciated.
57 bioperl-l@bioperl.org - General discussion
58 http://bioperl.org/wiki/Mailing_lists - About the mailing lists
62 Report bugs to the Bioperl bug tracking system to help us keep track
63 the bugs and their resolution. Bug reports can be submitted via
66 http://bugzilla.open-bio.org/
72 Email: czmasek@gnf.org or cmzmasek@yahoo.com
74 WWW: http://www.genetics.wustl.edu/eddy/people/zmasek/
78 Genomics Institute of the Novartis Research Foundation
79 10675 John Jay Hopkins Drive
84 The rest of the documentation details each of the object
85 methods. Internal methods are usually preceded with a _
90 # Let the code begin...
91 package Bio
::Ontology
::SimpleGOEngine
;
95 use base
qw(Bio::Ontology::OBOEngine);
101 ## Overiding this method from OBOEngine
102 # Checks the correct format of a GOBO-formatted id
103 # Gets the id out of a term or id string
105 my ( $self, $term ) = @_;
109 # use TermI standard API
110 $self->throw("Object doesn't implement Bio::Ontology::TermI. ".
112 unless $term->isa("Bio::Ontology::TermI");
113 $id = $term->identifier();
114 # if there is no ID, we need to fake one from ontology name and name
115 # in order to achieve uniqueness
117 $id = $term->ontology->name() if $term->ontology();
118 $id = $id ?
$id.'|' : '';
119 $id .= $term->name();
122 # don't fuss if it looks remotely standard, and we trust GO terms
124 # if $term->isa("Bio::Ontology::GOterm")||($id =~ /^[A-Z_]{1,8}:\d{1,}$/);
125 if $term->isa("Bio::Ontology::GOterm")||($id =~ /^\w+:\w+$/);
126 # prefix with something if only numbers
128 $self->warn(ref($self).": identifier [$id] is only numbers - ".
129 "prefixing with 'GO:'");
132 # we shouldn't have gotten here if it's at least a remotely decent ID
133 $self->throw(ref($self).": non-standard identifier '$id'\n")