[Bioperl-l] Bio::Ontology help solicited

Hilmar Lapp hlapp at gmx.net
Thu Jun 19 16:06:26 UTC 2008


Hi Govind,

this looks like a bug (though it could indeed be a problem with the  
obo file - that has happened in the past too). Would you mind posting  
it at bugzilla.open-bio.org?

	-hilmar

On Jun 19, 2008, at 11:54 AM, Govind Chandra wrote:

> Hi Hilmar,
>
> Below is an extract from perldoc Bio::Ontology::Ontology from which I
> _wrongly_ concluded that -identifier and -name do the same thing.
>
>
>
>       find_terms
>
>        Title   : find_terms
>        Usage   : ($term) = $oe->find_terms(-identifier => "SO: 
> 0000263");
>        Function: Find term instances matching queries for their  
> attributes.
>
>                  An implementation may not support querying for  
> arbitrary
>                  attributes, but can generally be expected to accept
>                  -identifier and -name as queries. If both are  
> provided,
>                  they are implicitly intersected.
>
>        Example :
>        Returns : an array of zero or more Bio::Ontology::TermI objects
>        Args    : Named parameters. The following parameters should  
> be recognized
>                  by any implementations:
>
>                     -identifier    query by the given identifier
>                     -name          query by the given name
>
>
>
> I had been messing with this script for a few hours before posting for
> help and had tried various combinations of -identifier and -name. But
> neither -identifier => "GO:0000072" nor -name => "M phase specific
> microtubule process" work. I know that the GOid exists because I can
> find it in the obo file. There is something more fundamentally wrong  
> in
> my script than just the syntax. Like you suggested, below, I
> get_all_terms() but the list @allterms is empty.
>
> ### 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 @allterms = $ontology->get_all_terms();
> print(scalar(@allterms), "\n");
> my $limiter;
> foreach my $term (@allterms) {
> print($term->name(),"\n");
> print($term->definition(),"\n");
> if($limiter++ > 30) {last;}
> }
> exit;
> ### code ends ###
>
> ### output begins ###
> Bio::Ontology::Ontology
> 0
> ### output ends ###
>
> Given that the script works with the "go" format files (except
> process.ontology in which case it complains and exits) I suspect the  
> obo
> file but am surprised that Bio::OntologyIO->next_ontology() does not
> complain. Will it be asking for too much to request you to get the obo
> file I am trying to parse from
>
> ftp.geneontology.org/pub/go/ontology/obo_format_1_2/gene_ontology.1_2.obo
>
> and see if it works for you?
>
> Thanks
>
> Govind
>
>
>
>
>
> On Thu, 2008-06-19 at 10:50 -0400, Hilmar Lapp wrote:
>> On Jun 19, 2008, at 10:27 AM, Govind Chandra wrote:
>>
>>> I changed the line below
>>>
>>> my ($term)=$ontology->find_terms(-name => "GO:0000072");
>>>
>>> to
>>>
>>> my ($term)=$ontology->find_terms(-identifier => "GO:0000072");
>>
>> That's odd. Did you convince yourself that a term with this  
>> identifier
>> is indeed in the ontology? If you iterate over all terms (using e.g.
>> $ontology->get_all_terms()), is there a term with this identifier?
>>
>> E.g.: print join("\n", map { $_->identifier; }
>>                            (grep { $_->identifier =~ /0000072/; }
>>                                  $ontology->get_all_terms())),"\n";
>>
>> Does this print anything?
>>
>>> but it does not make any difference. From perldoc I gathered that -
>>> name
>>> and -identifier should do the same thing anyway.
>>
>>
>> I'm not sure where you gathered that from. Could you point me to the
>> location that says that?
>>
>> 	-hilmar

-- 
===========================================================
: Hilmar Lapp  -:-  Durham, NC  -:-  hlapp at gmx dot net :
===========================================================






More information about the Bioperl-l mailing list