[Biojava-l] Alignments

David Waring dwaring@u.washington.edu
Tue, 14 May 2002 12:03:16 -0700


I will soon be adding a bunch of classes related to Alignments. I should
have these ready today or tomorrow. I hate naming things so if anyone can
come up with better names especially for ARAlignment I am open to
suggestions.

Interface UnequalLengthAlignment (allows having sequences of different
lengths)
Interface ARAlignment (allows adding and removing sequences)
Interface EditableAlignment (allows editing, and shifting bases)
Class FlexibleAlignment (implements all 3 of the above)
Interface AlignedElement (holds label, SymbolList, location)
Class SimpleAlignedElement
Abstract Class AbstractULAlignment
Class IllegalAlignmentEditException
Interface QualitativeAlignment (handles SymbolList that implement
Qualitative)

May I suggest a few other things

Interface SequenceAlignment (extends Alignment)
I think this could help in the recently discussed issues about
SequencePanel. Anyone up for defining this one?

In addition I REALLY think that we need an interface for a GappedSymbolList.
Since this name is already taken I guess we could call it GappedList or
something. This way GappedPhredSequence or other classes could implement
this interface.


I have some questions about how to best implement change support for
EditableAlignment. Particularly how should changes that cascade be handled.
Let me first define the function 'shift'. This will move bases in one
direction or the other, filling in gaps on one side and adding gaps on the
other. Of course shifting cannot delete bases only gaps. In the case of an
UnequalLengthAlignment shifting bases that include the first or last base
should not add gaps at the ends, rather it changes the location of the
sequence withing the alignment. So there are two types of changes, adding
removing gaps, and changing location. In addition if a sequence is shifted
such that it extends the overall alignment, it will change the size of the
alignment. Finally if a sequence at the begining of an alignment is sifted
to the left, the whole alignment will shift so as to make the first base in
the alignment = 1 again. In this cases all of the sequences in the alignment
must be changed. The same is true if an sequence is added to the alignment
that extends the alignment to the left.

Now how should changes be signaled to listeners. Should each change be sent
with a FirePreChangeEvent/FirePostChangeEvent. Or should I just come up with
a global ChangeEvent, that holds all the information? If each change, gets
sent individually, it seems that there is a possiblity (although it should
not happen) that a one of the events gets vetoed, and I'd have to do a
rollback. I know this sort of things has been discussed before but I don't
know what the conclusion is. I would like to send ChangeEvents that will let
the listeners know what sequences have been changed, and the overall range
of the change so that, for instance, some Rendering object would know what
it had to redraw without having to figure it all out for itself. Any
suggestion would be appreciated

David