[Biojava-dev] Please help with Features and Annotations?

mark.schreiber at group.novartis.com mark.schreiber at group.novartis.com
Wed Sep 1 21:56:41 EDT 2004


Hi Michael -

The problem with the createDNASequence() method is that is creates a 
Sequence with an Annotation.EMPTY_ANNOTATION place holder for the 
annotation of the Sequence. This Annotation is empty (as the name 
suggests) and cannot be modified so any sequence made this way cannot be 
annotated. 
One way around this is to create a ViewSequence that wraps the Sequence 
and can have an Annotation added to it. If you read a sequence from a flat 
file (eg fasta) you can add an Annotation to it. Finally if you want to 
add Annotations another approach is to create a SimpleSequence and supply 
it with a SymbolList, Name, URN (can be "" or null) and an Annotation 
(which could be EMPTY_ANNOTATION or SimpleAnnotation or any implementation 
of Annotation). 

This is a good example of how the static XXXTools methods are convenient 
but don't expose the full flexibility of the biojava API. If you want to 
see how some of that flexibility can be used it can be good to look at the 
code behind the static methods. This reveals how the full API is used and 
shows areas where you can borrow that code and customize it to your needs. 
Eg it would be v simple to write a method for you program that borrows 
code from DNATools.createDNASequence() and takes an Annotation as an 
argument.

Finally, the Annotation and Feature examples on the BJIA page 
(http://www.biojava.org/docs/bj_in_anger/) may be useful. This link also 
shows how to make a program that views the Annotation and Feature 
structure in a JTree 
(http://www.biojava.org/docs/bj_in_anger/treeView.htm)

- Mark







Michael Griffith <mg at base-pair.com>
Sent by: biojava-dev-bounces at portal.open-bio.org
09/02/2004 06:57 AM

 
        To:     <biojava-dev at biojava.org>
        cc: 
        Subject:        [Biojava-dev] Please help with Features and Annotations?


Yikes! Is there a good explanation somewhere on Features and annotations? 
I
am creating a new Sequence using the DNATools.createDNASequence() method,
but I want to set some features on it like the GI # and the DEFINITION.  I
can't seem to figure out how this works.

Any help would be greatly appreciated!

MG

_______________________________________________
biojava-dev mailing list
biojava-dev at biojava.org
http://biojava.org/mailman/listinfo/biojava-dev





More information about the biojava-dev mailing list