[Biojava-l] MergeAnnotation question

Karin Lagesen karin.lagesen at labmed.uio.no
Wed Feb 19 10:15:38 EST 2003


I try to use a MergeAnnotation object to merge the annotation of two
features. This I do like this:

   MergeAnnotation mergeAnn = new MergeAnnotation();
   mergeAnn.addAnnotation(before.getAnnotation());
   mergeAnn.addAnnotation(after.getAnnotation());

This mergeAnn object is then used in a SequenceFactory to make a
feature of the sequence in between two sequences.

I have however come across a curious problem. When I try to list all
the features in this MergeAnnotation like this:

   Annotation seqAn = f.getAnnotation();
   for (Iterator it = seqAn.keys().iterator(); it.hasNext();) {
      Object key = it.next();
      Object value = seqAn.getProperty(key);
      annotation += (key.toString() + ": " + value.toString());
   }       

I get this error message:

Exception in thread "main" java.util.NoSuchElementException: Can't
find property [description_line, description] 
at org.biojava.bio.MergeAnnotation.getProperty(MergeAnnotation.java:110)
at no.uio.labmed.intergene.ProcessFiles.process(Unknown Source)
at no.uio.labmed.InterGene.main(Unknown Source)

When I do a tostring on the key, I get this:

Key [description_line, description]


It seems like in a MergeAnnotation object the key becomes composed
of both the key and the property of that key. Is this how it is
supposed to be, am I misunderstanding things, or is this a bug?

TIA,


Karin
-- 
Karin Lagesen, PhD student
karin.lagesen at labmed.uio.no


More information about the Biojava-l mailing list