[Bioperl-l] Bio::Ontology help solicited

Govind Chandra govind.chandra at bbsrc.ac.uk
Thu Jun 19 09:42:23 EDT 2008


In the code snippet below it seems I get the Bio::Ontology::Ontology
object $ontology but $ontology->find_terms is failing. It will help
greatly if someone points out what is wrong with this code and suggest a
correction. That the obo file is being read is obvious from the time it
takes from invocation to output.

I wrote another version of this script which read the "go" format and it
works fine. I cannot use the go format because it is deprecated and not
frequently updated. Even if I am willing to use the go format, the
process.ontology file (from geneontology.org) has an error in it which
causes Bio::OntologyIO->next_ontology() to fail. It will be best if I
could make the obo format work for me.



### code begins ###

use strict;
use Bio::OntologyIO;

my $file='gene_ontology.1_2.obo';
my $parser = Bio::OntologyIO->new(
  -format => "obo",
  -file => $file
my $ontology = $parser->next_ontology();
print(ref($ontology), "\n");
my ($term)=$ontology->find_terms(-name => "GO:0000072");
print($term->definition(), "\n");

### code ends ###

### output begins ###

Can't call method "definition" on an undefined value at
ontology_check.pl line 26, <GEN0> line 288014.
### output ends ###

Other Possibly relevant information:

Perl is: v5.8.8 built for x86_64-linux-thread-multi

BioPerl is: bioperl-1.5.2_102 

Output of uname -a: Linux n61347 2.6.18-92.1.1.el5 #1 SMP Thu May 22
09:01:47 EDT 2008 x86_64 x86_64 x86_64 GNU/Linux

Contents of /etc/redhat-release: Red Hat Enterprise Linux Server release
5.2 (Tikanga)

More information about the Bioperl-l mailing list