[Biojava-l] circular sequences

Mark Schreiber mark_s@sanger.otago.ac.nz
Mon, 29 Jan 2001 10:10:12 +1300 (NZDT)


On Sun, 28 Jan 2001, Thomas Down wrote:

> On Mon, Jan 29, 2001 at 09:29:52AM +1300, Mark Schreiber wrote:
> > 
> > I'll look into making a circular location.
> 
> Great.
> 
> > So far I have started making a subclass of ViewSequence to act as a view
> > onto a linear SymbolList. Can anyone see problems with this?
> >
> > I am a little uncomfortable with the fact that all added features will not
> > be added to the underlying sequence so the view and sequence must always
> > be kept together (as long as they are circular anyhow).
> 
> What functionality do you want to re-use from ViewSequence
> (which is a kind-of misleading name, FeatureOverlaySequence
> would be more descriptive)?
>

Ok I may have gone a bit astray here but I think it would still work.
 
> As I see it, the functions of CircularSequence are:
>   
>   - Offer a circularized view onto a SymbolList
>   - Act as a holder for Features with CircularLocations
>   - (As with all Sequences) hold an Annotation
> 
> In Biojava, a sequence is really just the intersection of
> SymbolList, FeatureHolder, and Annotatable (plus a couple
> of methods for fetching an ID).  If you take a look at
> SimpleSequence, you'll see is implements almost all it's
> functionality by delegation to:
> 
>   - An arbitrary SymbolList
>   - SimpleAnnotation
>   - SimpleFeatureHolder
>   - The default in-memory FeatureRealizer.
> 
> There's almost no `real' code in SimpleSequence at all.
> 
> The only difference in CircularSequence is that you need
> to circularize the SymbolList.
> 
> I'd be inclined to implment this without any subclassing
> at all -- my recent experience in Java has almost always been
> that subclassing is something of a blunt instrument, and 
> delegation is a neater way to get the job done.
>

OK now i'm confused... why not just subclass simple sequence then since
the only thing that needs changing is the view onto the symbol list. All
other functionality is the same and doesn't need to be rewritten even if
it is minimal? I can't see how the delegation makes the job neater.

 
> Anyway, end-of-hand-waving-design-philosophy-thingumybob...
> 
> It'll be good to see this working -- I'm looking forward
> to a really pretty java2d plasmid-drawing program :).
> 
>     Thomas.
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Mark Schreiber			Ph: 64 3 4797875
Rm 218				email mark_s@sanger.otago.ac.nz
Department of Biochemistry	email m.schreiber@clear.net.nz
University of Otago		
PO Box 56
Dunedin
New Zealand
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~