[Biojava-l] circular sequences
Sun, 28 Jan 2001 20:53:48 +0000
On Mon, Jan 29, 2001 at 09:29:52AM +1300, Mark Schreiber wrote:
> I'll look into making a circular location.
> 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)?
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
- 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.
It'll be good to see this working -- I'm looking forward
to a really pretty java2d plasmid-drawing program :).