[Biojava-l] Adapting org.biojava.bio.seq classes to an interface?

Thomas Down td2 at sanger.ac.uk
Thu Dec 16 09:54:30 EST 2004


On 16 Dec 2004, at 12:35, Christian Storm wrote:

> Is there a way of adapting org.biojava.bio.seq classes / interfaces to 
> an interface?
>
> I would like to add functionality to some of the interfaces in 
> org.biojava.bio.seq, i.e. sequence and feature, by adapting them to an 
> existing interface.
>
> I see two possibilites - a class adapter:
>
> OwnSequence extends SimpleSequence implements NewFunctionality
>
> or an object Adapter:
>
> OwnSequence implements Sequence, NewFunctionality
>
> Unfortunately both approaches would mean massive recoding of the 
> parsing /building process of sequence-objects, so that in essence it 
> would be simpler for me to write my own classes to handle sequences.

Hi Christian,

The BioJava sequence model was written with the possibility of dropping 
in new implementations in mind, and it certainly ought to be possible 
to do this -- whatever approach you choose to take -- without having to 
rewrite things like parsing code.  A good place to start looking is the 
SequenceBuilder interface, which receives events from the parsing 
framework and constructs Sequence objects.  By developing a new 
implementation of this, you'll be able to use any of the BioJava 
parsers.  Depending on the exact details of your new Sequence 
implementation, you'll quite possibly be able to get away with a very 
small subclass of SequenceBuilderBase.

          Thomas.



More information about the Biojava-l mailing list