[Biojava-l] SimpleRichAnnotation

James Procter jimp at compbio.dundee.ac.uk
Sun Dec 7 07:56:30 UTC 2008


Hello.

I'm going to re-itereate Augusto's question here - and plead (if not
grovel) for some kind of answer:
Augusto Fernandes Vellozo wrote:
> I am having problems with the class SimpleRichAnnotation.
> I have one term t of ontology o and I put one note n (with the term t)
> in an SimpleRichAnnotation object a, but in the moment i call the
> method
> a.getProperties(t) it didn't return the note n.
I have this same problem - but in this case its when I'm trying to get
at anything from a bioSQL backed database.

> I saw in the code of Biojava that the method getProperties imports the
> term t into of the ontology default before to do the search. Because
> this it doesn't return the correct note.
> 
> Please, someone knows why is this method changing the ontology?
.. and if it 'should be' changing the ontology, why doesn't the
getOrImport method work properly ?

Here are my observations:

After my initial failing to get my feature annotation properties by the
obvious means: via the Feauture's getAnnotation("note name"); I thought
that it was due to the default ontology namespace not matching the
BioSQL ontology namespace (that is, the ontology name prefix didn't
match). I therefore created a new ontology with a matching namespace,
thinking that would be sufficient. However, looking at the
implementation of the biojavax SimpleRichAnnotation 'contains' method, I
think I'm on a hiding to nothing, since I made the same observation as
Augusto: it always calls the default ontology import or create term
function to make a local instance of the Term passed as argument.

Logically, this sounds fine, although messy and not thread-safe since
the RichObjectFactory holds a single static instance of the default
Ontology - except that it completely breaks in more ways than I thought
possible. The reason this doesn't work is that the as far as I can tell,
the Term equivalence relationship is implemented by object reference
equivalence, rather than by equals method equivalence. That is, Terms
can only be equal if they come from the same ComparableOntology object
instance, and have the same string constant reference. That means terms
can never be compared from different instances of the same ontology
(such as would be returned from two independent sources - ie a
persistence framework and an external ontology resource).

I note that in the deprecated org.biojava.bio.seq.db.biosql
implementation, there are methods to handle the BioSQL ontology index.
These are, however, deprecated, and so there is currently no way to
retrieve a singleton instance of the Biosql database's ontology, and
therefore no way that the above equivalence method is ever going to
retrieve the corresponding Note for a particular named property... even
if I could set the RichSequenceObjectFactory's default ontology to be
the one retrieved from the BioSQL database back end!

sorry to be long winded... but it would be nice to know if I've missed
something completely here!

thanks
Jim.

-- 
-------------------------------------------------------------------
J. B. Procter  (ENFIN/VAMSAS)  Barton Bioinformatics Research Group
Phone/Fax:+44(0)1382 388734/345764  http://www.compbio.dundee.ac.uk
The University of Dundee is a Scottish Registered Charity, No. SC015096.



More information about the Biojava-l mailing list