uk.ac.man.bioinf.sequence.alignment
Interface SequenceAlignment

All Superinterfaces:
AlignmentEventProvider, EventListener, Identifiable, SequenceEventProvider, SequenceListener, VetoableSequenceListener
All Known Implementing Classes:
AbstractSequenceAlignment, EmptySequenceAlignment, GroupSequenceAlignment

public interface SequenceAlignment
extends SequenceEventProvider, VetoableSequenceListener, AlignmentEventProvider, Identifiable

SequenceAlignment.java This interface is designed to mimic a biological sequence alignment. As a consequence, the sequences contained within should be GappedSequence.

Version:
$Id: SequenceAlignment.java,v 1.17 2001/04/11 17:04:43 lord Exp $
Author:
J Selley
See Also:
Created: Tue Feb 15 16:24:23 2000

Method Summary
 void addSequence(GappedSequence seq, int inset)
          Adds a sequence to the current alignment.
 int getInset(int seqIndex)
          Returns the inset of sequence within the alignment.
 int getLength()
          Returns the length of the alignment (i.e: the longest sequence).
 int getNumberSequences()
          Returns the total number of sequences in the alignment.
 GappedSequence getSequenceAt(int index)
          Provides the sequence at a particular location in the alignment.
 int getSequenceIndex(GappedSequence seq)
          Returns the index in the alignment of a provided sequence.
 SequenceType getSequenceType()
          Returns the sequence type of the alignment (e.g: protein sequences).
 SequenceAlignment getSubAlignment(int startPos, int length, int startSeq, int numSeqs)
          Returns a sub-alignment, given the exact location in this alignment.
 SequenceAlignment getSubAlignment(SequenceAlignmentRectangle rect)
           
 GappedSequence removeSequence(int seqIndex)
          Removes a sequence from the alignment.
 void setInset(int seqIndex, int size)
          Sets the inset of a sequence within the alignment.
 
Methods inherited from interface uk.ac.man.bioinf.sequence.event.SequenceEventProvider
addSequenceListener, addVetoableSequenceListener, removeSequenceListener, removeVetoableSequenceListener
 
Methods inherited from interface uk.ac.man.bioinf.sequence.event.VetoableSequenceListener
vetoableChangeOccurred
 
Methods inherited from interface uk.ac.man.bioinf.sequence.event.SequenceListener
changeOccurred
 
Methods inherited from interface uk.ac.man.bioinf.sequence.alignment.event.AlignmentEventProvider
addAlignmentListener, addVetoableAlignmentListener, removeAlignmentListener, removeVetoableAlignmentListener
 
Methods inherited from interface uk.ac.man.bioinf.sequence.identifier.Identifiable
getIdentifier
 

Method Detail

getSubAlignment

public SequenceAlignment getSubAlignment(int startPos,
                                         int length,
                                         int startSeq,
                                         int numSeqs)
Returns a sub-alignment, given the exact location in this alignment.

Parameters:
startPos - the start position for the sub-alignment (i.e: x1)
length - the length of the sub alignment
startSeq - the first sequence in the current alignment to be included in the sub-alignment (i.e: y1)
Returns:
the sub-alignment

getSubAlignment

public SequenceAlignment getSubAlignment(SequenceAlignmentRectangle rect)

addSequence

public void addSequence(GappedSequence seq,
                        int inset)
                 throws AlignmentVetoException
Adds a sequence to the current alignment. If listeners are listening to the alignment, they will be able to veto the add (thats the idea atleast).

Parameters:
seq - the sequence to be added
inset - the sequence inset
Throws:
veto - to the addition
AlignmentVetoException

removeSequence

public GappedSequence removeSequence(int seqIndex)
                              throws AlignmentVetoException
Removes a sequence from the alignment. It requires the knowledge of the sequence location in the alignment.

Parameters:
seqIndex - the index of the sequence
Returns:
the sequence
Throws:
veto - to the removal
AlignmentVetoException

setInset

public void setInset(int seqIndex,
                     int size)
              throws AlignmentVetoException
Sets the inset of a sequence within the alignment. An inset of zero will mean that the first element starts at the left most position of the alignment.

Special N.B.: This was put into the interface because it was felt that there would not be any instances when you would not wish to do this (apart from a read-only alignment, in which case there are ways and means).

Parameters:
seqIndex - the index of the sequence
size - the size of the inset
Throws:
veto - to setting
AlignmentVetoException

getInset

public int getInset(int seqIndex)
Returns the inset of sequence within the alignment. A inset of 0 means that the first element means that the Sequence starts at the left most position of the alignment

Parameters:
seqIndex - the sequence index
Returns:
the inset or preceeding number of gaps

getSequenceType

public SequenceType getSequenceType()
Returns the sequence type of the alignment (e.g: protein sequences).

Returns:
the sequence type

getSequenceAt

public GappedSequence getSequenceAt(int index)
                             throws NoSuchSequenceException
Provides the sequence at a particular location in the alignment. The indexing STARTS AT 1, and not 0.

Parameters:
index - the index of the target sequence
Returns:
the sequence of interest
Throws:
if - index < 1 or index > getNumberSequences()
NoSuchSequenceException

getSequenceIndex

public int getSequenceIndex(GappedSequence seq)
Returns the index in the alignment of a provided sequence.

Parameters:
seq - the query sequence
Returns:
the index of the sequence, or -1 if not found

getNumberSequences

public int getNumberSequences()
Returns the total number of sequences in the alignment.

Returns:
the number of sequences

getLength

public int getLength()
Returns the length of the alignment (i.e: the longest sequence).

Returns:
length of alignment