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

java.lang.Object
  |
  +--uk.ac.man.bioinf.sequence.alignment.EmptySequenceAlignment
All Implemented Interfaces:
AlignmentEventProvider, EventListener, Identifiable, SequenceAlignment, SequenceEventProvider, SequenceListener, VetoableSequenceListener

public class EmptySequenceAlignment
extends Object
implements SequenceAlignment

EmptySequenceAlignment.java Created: Wed Apr 19 17:23:30 2000

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

Method Summary
 void addAlignmentListener(AlignmentListener listener)
          Add a listener specifically interested in events connected with the MSA.
 void addSequence(GappedSequence seq, int inset)
          Adds a sequence to the current alignment.
 void addSequenceListener(SequenceListener listener)
          Adds the specified sequence listener.
 void addVetoableAlignmentListener(VetoableAlignmentListener listener)
          Adds a listener interested in vetoing multiple sequence alignment specific events.
 void addVetoableSequenceListener(VetoableSequenceListener listener)
          Adds the specified vetoable sequence listener.
 void changeOccurred(SequenceEvent event)
          Method called when a change occurs
 Identifier getIdentifier()
           
 int getInset(int index)
          Returns the inset of sequence within the alignment.
static EmptySequenceAlignment getInstance()
           
 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 a, int b, int c, int d)
          Returns a sub-alignment, given the exact location in this alignment.
 SequenceAlignment getSubAlignment(SequenceAlignmentRectangle rect)
           
 void removeAlignmentListener(AlignmentListener listener)
          Removes a multiple sequence alignment listener.
 GappedSequence removeSequence(int seqIndex)
          Removes a sequence from the alignment.
 void removeSequenceListener(SequenceListener listener)
          Removes the specified sequence listener.
 void removeVetoableAlignmentListener(VetoableAlignmentListener listener)
          Removes a vetoable multiple sequence alignment listener.
 void removeVetoableSequenceListener(VetoableSequenceListener listener)
          Removes the specified vetoable sequence listener.
 void setInset(int seqIndex, int size)
          Sets the inset of a sequence within the alignment.
 void setInsetQuietly(int seqIndex, int inset)
           
 void setLengthQuietly(int length)
           
 void vetoableChangeOccurred(VetoableSequenceEvent event)
          Method signalled before a prospective change occurs
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static EmptySequenceAlignment getInstance()

getInset

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

Specified by:
getInset in interface SequenceAlignment
Parameters:
index - the sequence index
Returns:
the inset or preceeding number of gaps

getLength

public int getLength()
Description copied from interface: SequenceAlignment
Returns the length of the alignment (i.e: the longest sequence).

Specified by:
getLength in interface SequenceAlignment
Returns:
length of alignment

getNumberSequences

public int getNumberSequences()
Description copied from interface: SequenceAlignment
Returns the total number of sequences in the alignment.

Specified by:
getNumberSequences in interface SequenceAlignment
Returns:
the number of sequences

getSequenceAt

public GappedSequence getSequenceAt(int index)
Description copied from interface: SequenceAlignment
Provides the sequence at a particular location in the alignment. The indexing STARTS AT 1, and not 0.

Specified by:
getSequenceAt in interface SequenceAlignment
Parameters:
index - the index of the target sequence
Returns:
the sequence of interest

getSequenceIndex

public int getSequenceIndex(GappedSequence seq)
Description copied from interface: SequenceAlignment
Returns the index in the alignment of a provided sequence.

Specified by:
getSequenceIndex in interface SequenceAlignment
Parameters:
seq - the query sequence
Returns:
the index of the sequence, or -1 if not found

getSequenceType

public SequenceType getSequenceType()
Description copied from interface: SequenceAlignment
Returns the sequence type of the alignment (e.g: protein sequences).

Specified by:
getSequenceType in interface SequenceAlignment
Returns:
the sequence type

getSubAlignment

public SequenceAlignment getSubAlignment(int a,
                                         int b,
                                         int c,
                                         int d)
Description copied from interface: SequenceAlignment
Returns a sub-alignment, given the exact location in this alignment.

Specified by:
getSubAlignment in interface SequenceAlignment
Parameters:
a - the start position for the sub-alignment (i.e: x1)
b - the length of the sub alignment
c - 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)
Specified by:
getSubAlignment in interface SequenceAlignment

setInset

public void setInset(int seqIndex,
                     int size)
Description copied from interface: SequenceAlignment
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).

Specified by:
setInset in interface SequenceAlignment
Parameters:
seqIndex - the index of the sequence
size - the size of the inset

setInsetQuietly

public void setInsetQuietly(int seqIndex,
                            int inset)

addSequence

public void addSequence(GappedSequence seq,
                        int inset)
Description copied from interface: SequenceAlignment
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).

Specified by:
addSequence in interface SequenceAlignment
Parameters:
seq - the sequence to be added
inset - the sequence inset

removeSequence

public GappedSequence removeSequence(int seqIndex)
Description copied from interface: SequenceAlignment
Removes a sequence from the alignment. It requires the knowledge of the sequence location in the alignment.

Specified by:
removeSequence in interface SequenceAlignment
Parameters:
seqIndex - the index of the sequence
Returns:
the sequence

setLengthQuietly

public void setLengthQuietly(int length)

addAlignmentListener

public void addAlignmentListener(AlignmentListener listener)
Description copied from interface: AlignmentEventProvider
Add a listener specifically interested in events connected with the MSA.

Specified by:
addAlignmentListener in interface AlignmentEventProvider
Parameters:
listener - a multiple sequence alignment listener

removeAlignmentListener

public void removeAlignmentListener(AlignmentListener listener)
Description copied from interface: AlignmentEventProvider
Removes a multiple sequence alignment listener.

Specified by:
removeAlignmentListener in interface AlignmentEventProvider
Parameters:
listener - the listener to be removed

addVetoableAlignmentListener

public void addVetoableAlignmentListener(VetoableAlignmentListener listener)
Description copied from interface: AlignmentEventProvider
Adds a listener interested in vetoing multiple sequence alignment specific events.

Specified by:
addVetoableAlignmentListener in interface AlignmentEventProvider
Parameters:
listener - a vetoable multiple sequence alignment listener

removeVetoableAlignmentListener

public void removeVetoableAlignmentListener(VetoableAlignmentListener listener)
Description copied from interface: AlignmentEventProvider
Removes a vetoable multiple sequence alignment listener.

Specified by:
removeVetoableAlignmentListener in interface AlignmentEventProvider
Parameters:
listener - the listener to be removed

vetoableChangeOccurred

public void vetoableChangeOccurred(VetoableSequenceEvent event)
Description copied from interface: VetoableSequenceListener
Method signalled before a prospective change occurs

Specified by:
vetoableChangeOccurred in interface VetoableSequenceListener
Parameters:
event - the event

changeOccurred

public void changeOccurred(SequenceEvent event)
Description copied from interface: SequenceListener
Method called when a change occurs

Specified by:
changeOccurred in interface SequenceListener
Parameters:
event -

addSequenceListener

public void addSequenceListener(SequenceListener listener)
Description copied from interface: SequenceEventProvider
Adds the specified sequence listener.

Specified by:
addSequenceListener in interface SequenceEventProvider
Parameters:
listener - the sequence listener

addVetoableSequenceListener

public void addVetoableSequenceListener(VetoableSequenceListener listener)
Description copied from interface: SequenceEventProvider
Adds the specified vetoable sequence listener.

Specified by:
addVetoableSequenceListener in interface SequenceEventProvider
Parameters:
listener - the vetoable sequence listener

removeSequenceListener

public void removeSequenceListener(SequenceListener listener)
Description copied from interface: SequenceEventProvider
Removes the specified sequence listener.

Specified by:
removeSequenceListener in interface SequenceEventProvider
Parameters:
listener - the sequence listener

removeVetoableSequenceListener

public void removeVetoableSequenceListener(VetoableSequenceListener listener)
Description copied from interface: SequenceEventProvider
Removes the specified vetoable sequence listener.

Specified by:
removeVetoableSequenceListener in interface SequenceEventProvider
Parameters:
listener - the vetoable sequence listener

getIdentifier

public Identifier getIdentifier()
Specified by:
getIdentifier in interface Identifiable