[Biojava-l] RichAnnotation
mark.schreiber at novartis.com
mark.schreiber at novartis.com
Sun Feb 19 21:39:52 EST 2006
Hello -
We recently had some questions on the list about getting information out
of a RichAnnotation. This would be one way to do it ...
RichAnnotation theAnnotation = (RichAnnotation)seq.getAnnotation();
Iterator notesIterator = theAnnotation.getNoteSet().iterator();
while (notesIterator.hasNext()) {
System.out.println();
Note note = (Note)notesIterator.next();
System.out.println(note);
}
All notes have a Term and a value. The value is a String and the Term is
an ontology term.
Term term = note.getTerm();
String value = note.getValue();
The term has a name which is also a String
String name = term.getName();
So to get the name, value pair of a note you would do this:
String name = note.getTerm().getName();
String value = note.getValue();
Which is pretty much what the Note toString() method does.
- Mark
Mark Schreiber
Research Investigator (Bioinformatics)
Novartis Institute for Tropical Diseases (NITD)
10 Biopolis Road
#05-01 Chromos
Singapore 138670
www.nitd.novartis.com
phone +65 6722 2973
fax +65 6722 2910
More information about the Biojava-l
mailing list