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

java.lang.Object
  |
  +--uk.ac.man.bioinf.sequence.alignment.AbstractSequenceAlignment
        |
        +--uk.ac.man.bioinf.sequence.alignment.DefaultSequenceAlignment
All Implemented Interfaces:
AlignmentEventProvider, EventListener, Identifiable, SequenceAlignment, SequenceEventProvider, SequenceListener, VetoableSequenceListener
Direct Known Subclasses:
SingleSequenceAlignment

public class DefaultSequenceAlignment
extends AbstractSequenceAlignment

DefaultSequenceAlignment.java A class to model the multiple sequence alignment. NB: Sequence numbering starts at 1 NOT 0. Created: Mon Feb 21 13:51:11 2000

Version:
$Id: DefaultSequenceAlignment.java,v 1.24 2001/04/11 17:04:43 lord Exp $
Author:
J Selley

Constructor Summary
DefaultSequenceAlignment(Element[][] seqs, SequenceType type)
           
DefaultSequenceAlignment(GappedSequence[] seqs, SequenceType type)
           
DefaultSequenceAlignment(GappedSequence[] seqs, SequenceType type, int[] inset)
           
DefaultSequenceAlignment(GappedSequence[] seqs, SequenceType type, int[] inset, Identifier ident)
           
DefaultSequenceAlignment(SequenceAlignment msa, SequenceType type)
           
DefaultSequenceAlignment(SequenceType type)
           
DefaultSequenceAlignment(SequenceType type, Identifier ident)
           
 
Method Summary
protected  void addSequenceQuietly(GappedSequence seq, int inset)
          Adds a sequence quietly to the alignment (i.e., without notifying listeners - it should really only be done from it's parent procedure addSequence).
 Identifier getIdentifier()
           
 int getInset(int seqIndex)
          Returns the inset of a particular sequence in the alignment.
 int getLength()
          Returns the length of the multiple sequence alignment.
 int getNumberSequences()
          Returns the total number of sequences in the multiple sequence alignment.
 GappedSequence getSequenceAt(int index)
          Returns the sequence, given a specific location in the MSA.
 int getSequenceIndex(GappedSequence seq)
          Returns the location of a sequence, in the multiple sequence alignment.
 SequenceType getSequenceType()
          Returns the sequence type for the alignment (e.g: Protien Sequence).
 SequenceAlignment getSubAlignment(int startPos, int length, int startSeq, int numSeqs)
          Returns a sub-alignment, given the exact location in this alignment.
protected  void init(GappedSequence[] seqs, SequenceType type, int[] inset, Identifier ident)
           
protected  GappedSequence removeSequenceQuietly(int seqIndex)
          Removes a sequence from the alignment, quietly, i.e., without notifying any listeners.
protected  void setInsetQuietly(int seqIndex, int inset)
          Sets the inset (or preceeding number of gaps) for a sequence in the alignment.
protected  void setLengthQuietly(int length)
           
 
Methods inherited from class uk.ac.man.bioinf.sequence.alignment.AbstractSequenceAlignment
addAlignmentListener, addSequence, addSequence, addSequenceListener, addVetoableAlignmentListener, addVetoableSequenceListener, changeOccurred, fireAlignmentEvent, fireVetoableAlignmentEvent, getSubAlignment, removeAlignmentListener, removeSequence, removeSequenceListener, removeVetoableAlignmentListener, removeVetoableSequenceListener, setInset, vetoableChangeOccurred
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultSequenceAlignment

public DefaultSequenceAlignment(SequenceType type)

DefaultSequenceAlignment

public DefaultSequenceAlignment(SequenceType type,
                                Identifier ident)

DefaultSequenceAlignment

public DefaultSequenceAlignment(Element[][] seqs,
                                SequenceType type)

DefaultSequenceAlignment

public DefaultSequenceAlignment(GappedSequence[] seqs,
                                SequenceType type,
                                int[] inset,
                                Identifier ident)

DefaultSequenceAlignment

public DefaultSequenceAlignment(GappedSequence[] seqs,
                                SequenceType type,
                                int[] inset)

DefaultSequenceAlignment

public DefaultSequenceAlignment(GappedSequence[] seqs,
                                SequenceType type)

DefaultSequenceAlignment

public DefaultSequenceAlignment(SequenceAlignment msa,
                                SequenceType type)
Method Detail

init

protected void init(GappedSequence[] seqs,
                    SequenceType type,
                    int[] inset,
                    Identifier ident)

getSubAlignment

public SequenceAlignment getSubAlignment(int startPos,
                                         int length,
                                         int startSeq,
                                         int numSeqs)
Returns a sub-alignment, given the exact location in this alignment. NB: Sequencing numbering and alignment numbering start at 1 NOT 0.

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)
numSeqs - the number of sequences to be included in the sub-alignment
Returns:
the sub-MSA

getSequenceType

public SequenceType getSequenceType()
Returns the sequence type for the alignment (e.g: Protien Sequence).

Returns:
the sequence type

getSequenceAt

public GappedSequence getSequenceAt(int index)
Returns the sequence, given a specific location in the MSA. NB: Alignment sequence numbering begins at 1 NOT 0.

Parameters:
index - the location in the MSA of the target sequence
Returns:
the sequence

getSequenceIndex

public int getSequenceIndex(GappedSequence seq)
Returns the location of a sequence, in the multiple sequence alignment. NB:

Parameters:
seq - the sequence of interest
Returns:
the location (-1 if sequence not found)

setLengthQuietly

protected void setLengthQuietly(int length)
Specified by:
setLengthQuietly in class AbstractSequenceAlignment

addSequenceQuietly

protected void addSequenceQuietly(GappedSequence seq,
                                  int inset)
Adds a sequence quietly to the alignment (i.e., without notifying listeners - it should really only be done from it's parent procedure addSequence).

Specified by:
addSequenceQuietly in class AbstractSequenceAlignment
Parameters:
seq - the sequence
inset - the sequence inset in the alignment

removeSequenceQuietly

protected GappedSequence removeSequenceQuietly(int seqIndex)
Removes a sequence from the alignment, quietly, i.e., without notifying any listeners. This procedure ought only to be called from its "parent", removeSequence (unless you really know what you are doing - hence the public nature of the function).

Specified by:
removeSequenceQuietly in class AbstractSequenceAlignment
Parameters:
seqIndex - the sequence index
Returns:
the removed sequence

setInsetQuietly

protected void setInsetQuietly(int seqIndex,
                               int inset)
Sets the inset (or preceeding number of gaps) for a sequence in the alignment.

Specified by:
setInsetQuietly in class AbstractSequenceAlignment
Parameters:
seqIndex - the sequence index for the inset to be added to
inset - the inset

getInset

public int getInset(int seqIndex)
Returns the inset of a particular sequence in the alignment.

Parameters:
seqIndex - the sequence index
Returns:
the inset

getNumberSequences

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

Returns:
the total number of sequences

getLength

public int getLength()
Returns the length of the multiple sequence alignment.

Returns:
the length

getIdentifier

public Identifier getIdentifier()