de.jstacs.algorithms.alignment
Class StringAlignment

java.lang.Object
  extended by de.jstacs.algorithms.alignment.StringAlignment
All Implemented Interfaces:
Comparable<StringAlignment>
Direct Known Subclasses:
PairwiseStringAlignment

public class StringAlignment
extends Object
implements Comparable<StringAlignment>

Class for the representation of an alignment of Strings. It contains the Strings that were aligned and expanded by gap-symbols, and the edit-costs according to the employed Costs instance.

Author:
Jan Grau, Jens Keilwagen

Constructor Summary
StringAlignment(double cost, String... strings)
          This constructor creates an instance storing the aligned Strings and the costs of the alignment.
StringAlignment(double cost, String[] strings, Result res)
          This constructor creates an instance storing the aligned Strings and the costs of the alignment.
 
Method Summary
 int compareTo(StringAlignment o)
           
 String getAlignedString(int index)
          Returns the aligned String with index index.
 Result getAnnotationResult()
          Returns the annotation result.
 double getCost()
          Returns the costs.
 int getLength()
          This method return the length of the alignment.
 int getNumberOfAlignedSequences()
          Returns the number of sequences in this alignment.
 String toString()
           
 String toString(int chunkSize, int simplifyIdx, List<String> annot)
          This method returns a String representation of the alignment with a given chunk size.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

StringAlignment

public StringAlignment(double cost,
                       String... strings)
This constructor creates an instance storing the aligned Strings and the costs of the alignment.

Parameters:
cost - the cost of the alignment
strings - the aligned and expanded Strings

StringAlignment

public StringAlignment(double cost,
                       String[] strings,
                       Result res)
This constructor creates an instance storing the aligned Strings and the costs of the alignment.

Parameters:
cost - the cost of the alignment
strings - the aligned and expanded Strings
res - a result describing the alignment
Method Detail

getAnnotationResult

public Result getAnnotationResult()
Returns the annotation result.

Returns:
the annotation result

getCost

public double getCost()
Returns the costs.

Returns:
the costs

getNumberOfAlignedSequences

public int getNumberOfAlignedSequences()
Returns the number of sequences in this alignment.

Returns:
the number of sequences in this alignment.

getAlignedString

public String getAlignedString(int index)
Returns the aligned String with index index.

Parameters:
index - the index of the String
Returns:
the aligned String with index index

toString

public String toString()
Overrides:
toString in class Object

toString

public String toString(int chunkSize,
                       int simplifyIdx,
                       List<String> annot)
This method returns a String representation of the alignment with a given chunk size. I.e. all aligned sequence will be split each chunkSize symbols.

Parameters:
chunkSize - the size of the chunks
simplifyIdx - if non-negative the alignment is given relative to the sequence with the corresponding index; i.e. match is represented by "." and mismatch by the corresponding symbol
annot - a list of annotations for the aligned Strings, can be null
Returns:
a String representation of the alignment

getLength

public int getLength()
This method return the length of the alignment.

Returns:
the length of the alignment

compareTo

public int compareTo(StringAlignment o)
Specified by:
compareTo in interface Comparable<StringAlignment>