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

All Superinterfaces:
Identifiable, MutableSequence, Sequence, SequenceEventProvider
All Known Subinterfaces:
ComplexEditableGappedSequence, ConsensusSequence, GappedComplexSequence
All Known Implementing Classes:
AbstractGappedSequence, DefaultConsensusSequence, DefaultGappedComplexSequence, EmptyGappedSequence

public interface GappedSequence
extends MutableSequence

GappedSequence.java Created: Wed Mar 1 18:28:44 2000

Version:
$Id: GappedSequence.java,v 1.5 2001/04/11 17:04:43 lord Exp $
Author:
Phillip Lord

Method Summary
 void deleteGapAt(int index)
          Delete the element at index.
 void deleteGapAt(int index, int length)
          Delete the elements starting at index for the specified length
 Element getGappedElementAt(int position)
           
 char getGappedElementAtAsChar(int position)
           
 int getGappedLength()
          Returns the gapped length of this sequence.
 int getGappedPositionOf(int index)
          Translate between the gapped index, and the ungapped index
 char[] getGappedSequenceAsChars()
           
 Element[] getGappedSequenceAsElements()
           
 GappedSequence getGappedSubSequence(int from, int length)
           
 int getUngappedPositionOf(int index)
          Translate between the gapped position and the ungapped position.
 void insertGapAt(int index)
           
 void insertGapAt(int index, int length)
          Inserts the elements at this position.
 
Methods inherited from interface uk.ac.man.bioinf.sequence.Sequence
getElementAt, getElementAtAsChar, getLength, getSequenceAsChars, getSequenceAsElements, getSequenceType, getSubSequence
 
Methods inherited from interface uk.ac.man.bioinf.sequence.identifier.Identifiable
getIdentifier
 
Methods inherited from interface uk.ac.man.bioinf.sequence.event.SequenceEventProvider
addSequenceListener, addVetoableSequenceListener, removeSequenceListener, removeVetoableSequenceListener
 

Method Detail

getGappedSubSequence

public GappedSequence getGappedSubSequence(int from,
                                           int length)

getGappedElementAt

public Element getGappedElementAt(int position)

getGappedElementAtAsChar

public char getGappedElementAtAsChar(int position)

getGappedSequenceAsElements

public Element[] getGappedSequenceAsElements()

getGappedSequenceAsChars

public char[] getGappedSequenceAsChars()

getGappedLength

public int getGappedLength()
Returns the gapped length of this sequence. That is the length of the sequence including its gaps. Conversely this means that the getLength method of the Sequence interface returns the length of the sequence ignoring the gaps.

Returns:
the length

getGappedPositionOf

public int getGappedPositionOf(int index)
Translate between the gapped index, and the ungapped index

Parameters:
index - the ungapped position
Returns:
the gapped position of the equivalent element

getUngappedPositionOf

public int getUngappedPositionOf(int index)
Translate between the gapped position and the ungapped position. I havent quite decided what to do at the moment if the index refers to a gap. One idea is to throw a NoSuchSequenceElementException which makes a certain amount of sense but isnt really that useful. Perhaps a better idea is to run -(insertion-point) where the insertion point is the nearest element before the current requested position which is not a gap. That way a value less than 0 would indicate a gap and would also return a useful value

Parameters:
index -
Returns:

insertGapAt

public void insertGapAt(int index)
                 throws NoSuchSequenceElementException,
                        SequenceVetoException
NoSuchSequenceElementException
SequenceVetoException

insertGapAt

public void insertGapAt(int index,
                        int length)
                 throws NoSuchSequenceElementException,
                        SequenceVetoException
Inserts the elements at this position. If the index is one longer than the length of the sequence the sequence will be extended.

Parameters:
index - the index at which to insert
Throws:
NoSuchSequenceElementException - if the element does not exist, which will be the case if index is less than 1 or greater than sequence length + 1
SequenceVetoException

deleteGapAt

public void deleteGapAt(int index)
                 throws NoGapAtThisPositionException,
                        NoSuchSequenceElementException,
                        SequenceVetoException
Delete the element at index.

Parameters:
index - the index to delete
Returns:
the element which has just been deleted
Throws:
NoSuchSequenceElementException - if index is less than 1 or greater than the length of the sequence
NoGapAtThisPositionException
SequenceVetoException

deleteGapAt

public void deleteGapAt(int index,
                        int length)
                 throws NoGapAtThisPositionException,
                        NoSuchSequenceElementException,
                        SequenceVetoException
Delete the elements starting at index for the specified length

Parameters:
index - the index to start at
length - the length to delete
Returns:
the elements just deleted
Throws:
NoSuchSequenceElementException - if the elements do not all exist, so if index is less than 1, or index + length is greater than the length of the sequence
NoGapAtThisPositionException
SequenceVetoException