de.jstacs.algorithms.alignment.cost
Class MatrixCosts

java.lang.Object
  extended by de.jstacs.algorithms.alignment.cost.AffineCosts
      extended by de.jstacs.algorithms.alignment.cost.MatrixCosts
All Implemented Interfaces:
Costs

public class MatrixCosts
extends AffineCosts

Class for matrix costs, i.e., the cost of any match/mismatch is stored in a matrix allowing a huge degree of freedom. Additionally, the class used affine gap costs. The costs start to start a new gap, and the costs elong to elongate a gap by one position.

Author:
Jens Keilwagen

Nested Class Summary
 
Nested classes/interfaces inherited from interface de.jstacs.algorithms.alignment.cost.Costs
Costs.Direction
 
Constructor Summary
MatrixCosts(double[][] matrix, double start, double elong)
          Creates a new instance of matrix costs where the costs for mismatch and match are given in matrix.
 
Method Summary
 double getCostFor(Sequence s1, Sequence s2, int i, int j, Costs.Direction from)
          Returns the costs for the alignment if s1(i) and s2(j) coming from from.
 
Methods inherited from class de.jstacs.algorithms.alignment.cost.AffineCosts
getElongateCosts, getGapCostsFor
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MatrixCosts

public MatrixCosts(double[][] matrix,
                   double start,
                   double elong)
            throws CloneNotSupportedException
Creates a new instance of matrix costs where the costs for mismatch and match are given in matrix. Additionally, costs start to start a new gap, and costs elong to elongate a gap by one position.

Parameters:
matrix - the match and mismatch costs
start - the costs to start a gap
elong - the costs to elongate a gap
Throws:
CloneNotSupportedException - if matrix could not be cloned
Method Detail

getCostFor

public double getCostFor(Sequence s1,
                         Sequence s2,
                         int i,
                         int j,
                         Costs.Direction from)
Description copied from interface: Costs
Returns the costs for the alignment if s1(i) and s2(j) coming from from.

Parameters:
s1 - the first sequence
s2 - the second sequence
i - the index in the first sequence
j - the index in the second sequence
from - the direction within the DP-matrix
Returns:
the costs