de.jstacs.algorithms.alignment
Class Alignment

java.lang.Object
  extended by de.jstacs.algorithms.alignment.Alignment

public class Alignment
extends Object

Class for computing optimal alignments using Needleman-Wunsch algorithm of for affine gap costs Gotohs algorithm. The class also provides the possibility of specifying the number of off-diagonals. In this case, the current implementation helps to reduce the runtime but not the memory consumption.

Author:
Jan Grau, Jens Keilwagen
See Also:
AffineCosts

Nested Class Summary
static class Alignment.AlignmentType
           
 
Constructor Summary
Alignment(Alignment.AlignmentType type, Costs costs)
          Creates a new Alignment instance that aligns the sequences s1 and s2 using the costs defined in costs.
Alignment(Alignment.AlignmentType type, Costs costs, int offDiagonal)
          Creates a new Alignment instance that aligns the sequences s1 and s2 using the costs defined in costs and a banded version of the alignment algorithm.
 
Method Summary
 PairwiseStringAlignment getAlignment(Sequence s1, int startS1, int endS1, Sequence s2, int startS2, int endS2)
          Computes and returns the alignment of s1 and s2 (Alignment(AlignmentType, Costs)).
 PairwiseStringAlignment getAlignment(Sequence s1, Sequence s2)
          Computes and returns the alignment of s1 and s2 (Alignment(AlignmentType, Costs)).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Alignment

public Alignment(Alignment.AlignmentType type,
                 Costs costs)
Creates a new Alignment instance that aligns the sequences s1 and s2 using the costs defined in costs.

Parameters:
type - the type of the alignment
costs - the costs

Alignment

public Alignment(Alignment.AlignmentType type,
                 Costs costs,
                 int offDiagonal)
Creates a new Alignment instance that aligns the sequences s1 and s2 using the costs defined in costs and a banded version of the alignment algorithm. If the alignment is performed for Sequences of different length, the number of secondary diagonals must be at least as large as the difference of the lengths.

Parameters:
type - the type of the alignment
costs - the costs
offDiagonal - the number of secondary diagonals at both sides of the diagonal
Method Detail

getAlignment

public PairwiseStringAlignment getAlignment(Sequence s1,
                                            Sequence s2)
Computes and returns the alignment of s1 and s2 (Alignment(AlignmentType, Costs)).

Parameters:
s1 - the first sequence
s2 - the second sequence
Returns:
the alignment

getAlignment

public PairwiseStringAlignment getAlignment(Sequence s1,
                                            int startS1,
                                            int endS1,
                                            Sequence s2,
                                            int startS2,
                                            int endS2)
Computes and returns the alignment of s1 and s2 (Alignment(AlignmentType, Costs)).

Parameters:
s1 - the first sequence
startS1 - the start position in the first sequence
endS1 - the end position in the first sequence
s2 - the second sequence
startS2 - the start position in the second sequence
endS2 - the end position in the second sequence
Returns:
the alignment