edu.mssm.crover.representation
Class Alignment

java.lang.Object
  |
  +--edu.mssm.crover.representation.Alignment
All Implemented Interfaces:
BiologicalAlignment, RootObject, java.io.Serializable

public class Alignment
extends java.lang.Object
implements BiologicalAlignment, java.io.Serializable

Default implementation of BiologicalAlignment. Provides storage for an alignment of several BiologicalSequence.

Author:
Fabien Campagne
See Also:
BiologicalAlignment, Serialized Form

Constructor Summary
Alignment()
          Constructs an alignment with two sequences.
Alignment(BiologicalOrigin origin, BiologicalSequence[] seqs)
          Constructs a new alignment for a set of sequences and an origin.
 
Method Summary
 BiologicalSequence findGappedSequence(java.lang.String shortname)
          Finds a sequence by name.
 BiologicalSequence[] getGappedSequences()
          Returns the sequences with gaps.
 BiologicalOrigin getOrigin()
          Get the origin of this alignement.
 java.lang.String[] getPositions()
          Returns the positions of this alignment.
 BiologicalSequence[] getSequenceSet()
          Get the array of sequences that compose this alignment.
 java.lang.String getShortName()
          Returns the shortname of this alignment.
 int longer()
          Computes and returns the length of the longer sequence of this alignment.
 void removeSequence(BiologicalSequence seq)
          Removes the specified sequence from the alignment.
 void setOrigin(Origin x)
          Get the origin of this alignment.
 void setPositions(java.lang.String[] positions, BiologicalSequence[] sequences)
          Sets the alignment from an array of positions.
 void setSequenceSet(BiologicalSequence[] ss)
          Sets the array of sequences that compose this alignment.
 void setShortName(java.lang.String x)
          Sets the shortname of this alignment.
 java.lang.String toString()
          Format the alignment as text.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Alignment

public Alignment()
Constructs an alignment with two sequences. Primilarily intended for debugging purposes.


Alignment

public Alignment(BiologicalOrigin origin,
                 BiologicalSequence[] seqs)
Constructs a new alignment for a set of sequences and an origin. The objects passed in are referenced by the new Alignment, not duplicated.

Method Detail

getSequenceSet

public BiologicalSequence[] getSequenceSet()
Get the array of sequences that compose this alignment.

Specified by:
getSequenceSet in interface BiologicalAlignment

setSequenceSet

public void setSequenceSet(BiologicalSequence[] ss)
Sets the array of sequences that compose this alignment.

Specified by:
setSequenceSet in interface BiologicalAlignment

removeSequence

public void removeSequence(BiologicalSequence seq)
Removes the specified sequence from the alignment. The gap arrangement is not disturbed by this operation in the other gapped sequences.

Specified by:
removeSequence in interface BiologicalAlignment

longer

public int longer()
Computes and returns the length of the longer sequence of this alignment.

Specified by:
longer in interface BiologicalAlignment

findGappedSequence

public BiologicalSequence findGappedSequence(java.lang.String shortname)
Finds a sequence by name. Returns the first sequence of this alignment which name matches shortname (the search start by the last sequence an proceeds up to the first).

Specified by:
findGappedSequence in interface BiologicalAlignment
Returns:
The sequence, when found, or null.

getPositions

public java.lang.String[] getPositions()
Returns the positions of this alignment. A position is the string that contains all the residues and gaps present at a certain position of the alignment. For instance, given the following alignment,
 12345
 AS-FG
 ERTYI
 
Position 1 is defined to be "AE", position 2 to be "SR", position 3 to be "-T", etc.

Specified by:
getPositions in interface BiologicalAlignment
See Also:
String

setPositions

public void setPositions(java.lang.String[] positions,
                         BiologicalSequence[] sequences)
Sets the alignment from an array of positions. Sets the sequences of this alignment according to the positions given as an array of String. All the information contained in sequences, but the sequences of residues, are used to construct the new alignment (for cross-linking later use).

Parameters:
positions - The positions given as residue code Strings
sequences - Describes the origin, shortName, etc, of the positions inserted
See Also:
(definition of an alignment position).

getGappedSequences

public BiologicalSequence[] getGappedSequences()
Returns the sequences with gaps. The sequences that make up the alignment are returned with their gaps.

Specified by:
getGappedSequences in interface BiologicalAlignment

getShortName

public java.lang.String getShortName()
Returns the shortname of this alignment. This short string (less than 10 characters) is designed to be presented to the user for browsing purpose.

Specified by:
getShortName in interface BiologicalAlignment

setShortName

public void setShortName(java.lang.String x)
Sets the shortname of this alignment. This short string (less than 10 characters) is designed to be presented to the user for browsing purpose.

Specified by:
setShortName in interface BiologicalAlignment

getOrigin

public BiologicalOrigin getOrigin()
Get the origin of this alignement. How was it constructed ?


setOrigin

public void setOrigin(Origin x)
Get the origin of this alignment. How was it constructed ?


toString

public java.lang.String toString()
Format the alignment as text. Presents the state of this alignment as text for inspection during the debug process.

Overrides:
toString in class java.lang.Object


Copyright @ 2003 Mount Sinai School of Medicine. All Rights Reserved.