uk.ac.man.bioinf.sequence.alignment
Class DefaultGappedSequence

java.lang.Object
  |
  +--uk.ac.man.bioinf.sequence.AbstractSequence
        |
        +--uk.ac.man.bioinf.sequence.AbstractMutableSequence
              |
              +--uk.ac.man.bioinf.sequence.alignment.AbstractGappedSequence
                    |
                    +--uk.ac.man.bioinf.sequence.alignment.DefaultGappedSequence
All Implemented Interfaces:
GappedSequence, Identifiable, MutableSequence, Sequence, SequenceEventProvider

public class DefaultGappedSequence
extends AbstractGappedSequence

DefaultGappedSequence.java Created: Sat Mar 4 12:28:57 2000

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

Field Summary
protected  Sequence sequence
           
protected  IntArrayList toGappedMap
           
 
Constructor Summary
  DefaultGappedSequence(Element[] elements, SequenceType type)
           
  DefaultGappedSequence(Element[] elements, SequenceType type, Identifier ident)
          A new gapped sequence, with no gaps in it!
protected DefaultGappedSequence(Element[] elements, SequenceType type, IntArrayList toGappedMap, Identifier ident)
           
protected DefaultGappedSequence(Sequence seq, IntArrayList toGappedMap)
           
 
Method Summary
 void debugScreenDump()
           
protected  void deleteGapAtQuietly(int index)
           
 Element getElementAt(int index)
          Returns an element at a given location.
static GappedSequence getElementsAsGappedSequence(Element[] elements, SequenceType type)
           
static GappedSequence getElementsAsGappedSequence(Element[] elements, SequenceType type, Identifier ident)
           
static IntArrayList getGapModelForElements(Element[] elements)
           
 Element getGappedElementAt(int index)
           
 int getGappedLength()
          Returns the gapped length of this sequence.
 int getGappedPositionOf(int index)
          Translate between the gapped index, and the ungapped index
 Element[] getGappedSequenceAsElements()
           
 GappedSequence getGappedSubSequence(int position, int length)
           
 Identifier getIdentifier()
           
 int getLength()
          Returns the length of the sequence.
 Element[] getSequenceAsElements()
          Returns the sequence as an array of elements.
 int getUngappedPositionOf(int index)
          Translate between the gapped position and the ungapped position.
protected  void insertGapAtQuietly(int index)
           
static Residue[] stripGapsFromElements(Element[] elements, int size)
           
 
Methods inherited from class uk.ac.man.bioinf.sequence.alignment.AbstractGappedSequence
checkGappedRange, checkGappedRangeForInsert, deleteGapAt, deleteGapAt, getGappedElementAtAsChar, getGappedSequenceAsChars, getGappedSequenceIndexException, insertGapAt, insertGapAt
 
Methods inherited from class uk.ac.man.bioinf.sequence.AbstractMutableSequence
addSequenceListener, addVetoableSequenceListener, fireSequenceEvent, fireVetoableSequenceEvent, hasListeners, removeSequenceListener, removeVetoableSequenceListener
 
Methods inherited from class uk.ac.man.bioinf.sequence.AbstractSequence
checkRange, checkSequenceType, checkSequenceType, getElementAtAsChar, getSequenceAsChars, getSequenceIndexException, getSequenceType, getSequenceTypeException, getSubSequence
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface uk.ac.man.bioinf.sequence.Sequence
getElementAtAsChar, getSequenceAsChars, getSequenceType, getSubSequence
 
Methods inherited from interface uk.ac.man.bioinf.sequence.event.SequenceEventProvider
addSequenceListener, addVetoableSequenceListener, removeSequenceListener, removeVetoableSequenceListener
 

Field Detail

sequence

protected Sequence sequence

toGappedMap

protected IntArrayList toGappedMap
Constructor Detail

DefaultGappedSequence

protected DefaultGappedSequence(Sequence seq,
                                IntArrayList toGappedMap)

DefaultGappedSequence

protected DefaultGappedSequence(Element[] elements,
                                SequenceType type,
                                IntArrayList toGappedMap,
                                Identifier ident)

DefaultGappedSequence

public DefaultGappedSequence(Element[] elements,
                             SequenceType type,
                             Identifier ident)
A new gapped sequence, with no gaps in it!

Parameters:
elements -
type -

DefaultGappedSequence

public DefaultGappedSequence(Element[] elements,
                             SequenceType type)
Method Detail

deleteGapAtQuietly

protected void deleteGapAtQuietly(int index)
Specified by:
deleteGapAtQuietly in class AbstractGappedSequence

insertGapAtQuietly

protected void insertGapAtQuietly(int index)
Specified by:
insertGapAtQuietly in class AbstractGappedSequence

getGappedElementAt

public Element getGappedElementAt(int index)

getGappedSequenceAsElements

public Element[] getGappedSequenceAsElements()

getGappedLength

public int getGappedLength()
Description copied from interface: GappedSequence
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

getUngappedPositionOf

public int getUngappedPositionOf(int index)
Description copied from interface: GappedSequence
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:

getGappedPositionOf

public int getGappedPositionOf(int index)
Description copied from interface: GappedSequence
Translate between the gapped index, and the ungapped index

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

getGappedSubSequence

public GappedSequence getGappedSubSequence(int position,
                                           int length)

getLength

public int getLength()
Description copied from interface: Sequence
Returns the length of the sequence.

Returns:
the length of the sequence

getIdentifier

public Identifier getIdentifier()

getSequenceAsElements

public Element[] getSequenceAsElements()
Description copied from interface: Sequence
Returns the sequence as an array of elements.

Returns:
the sequence

getElementAt

public Element getElementAt(int index)
Description copied from interface: Sequence
Returns an element at a given location.

Parameters:
index - the location of the target element
Returns:
the element

getElementsAsGappedSequence

public static GappedSequence getElementsAsGappedSequence(Element[] elements,
                                                         SequenceType type)

getElementsAsGappedSequence

public static GappedSequence getElementsAsGappedSequence(Element[] elements,
                                                         SequenceType type,
                                                         Identifier ident)

stripGapsFromElements

public static Residue[] stripGapsFromElements(Element[] elements,
                                              int size)

getGapModelForElements

public static IntArrayList getGapModelForElements(Element[] elements)

debugScreenDump

public void debugScreenDump()