[Bioperl-l] Bio::Ontology overhaul
Aaron J Mackey
ajm6q at virginia.edu
Thu Feb 27 18:09:57 EST 2003
Fantastic, code examples ... examining in more detail:
I. obtain an ontology term (and its parent ontology) from a seqfeature:
> my $seqin = Bio::SeqIO->new( -format => 'embl');
> while (my $seq = $seqin->next_seq()) ) {
> foreach my $sf ( $seq->get_all_SeqFeatures() ) {
> # unclear whether OntologyTermI's have an as_string method
> print "Ooooh. It has ontology term ",$sf->type->as_string," from
> ontology ",$sf->type->ontology->name,"\n";
> }
> }
Great. From this perspective, clearly an OntologyTermI has to somehow be
able to get to their parent OntologyI; Lincoln, how would a
OntologyHandleI help get around a "backref" to OntologyI from
OntologyTermI in this case?
II. Determine the "inheritance" of a term from another term (both obtained
via seqfeatures)
> if( $sf->type->is_child_of($anothersf->type) ) {
> # do something
> }
Presumably, this gets passed off to the OntologyEngineI:
sub OntologyTermI::is_child_of {
my $self = shift;
return $self->ontology->engine->is_child_of($self, @_)
}
Q. Does is_child_of do path traversal?
Q. Can is_child_of be given the "predicate" type [ i.e.
$termA->is_child_of($termB, "isa") ]
Q. If "predicate" isn't given, what is assumed?
Q. What about two terms that are related through differing "predicates"
(i.e A isa B, B partof C, what is the relationship between A and C?)
III. Same as II, but with an "anonymous" term:
> # this might not be the right class for this
> # Hilmar and Chris to agree
> $ontology = Bio::Ontology::Factory->new( -ontology => 'SO');
$gene = $ontology->get_term("gene");
# ...
if($sf->type->is_child_of($gene)) {
# do something
}
BTW, why didn't this start as:
$ontology = new Bio::Ontology 'SO';
or, if necessary:
$ontology = new Bio::Ontology -name => 'SO',
-factory => "MyFunkyOntologyFactory";
Q. Should "is_child_of" be better as "is_subject_of" to reflect the
subject/object/predicate ontology term paradigm?
Q. Does is_subject_of need to know ontology namespace as well as
applicable predicate term(s)?
-Aaron
--
Aaron J Mackey
Pearson Laboratory
University of Virginia
(434) 924-2821
amackey at virginia.edu
More information about the Bioperl-l
mailing list