de.jstacs.algorithms.alignment.cost
Class MatrixCosts

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

public class MatrixCosts
extends Object
implements Costs

Class for matrix costs, i.e., the cost of any match/mismatch is stored in a matrix allowing a huge degree of freedom.

Author:
Jens Keilwagen

Constructor Summary
MatrixCosts(double[][] matrix, double gap)
          Creates a new instance of MatrixCosts where the costs for mismatch and match are given in matrix.
 
Method Summary
 double getCostFor(Sequence s1, Sequence s2, int i, int j)
          Returns the costs for the alignment of s1(i) and s2(j).
 double getGapCosts()
          Returns the costs for a gap.
 
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 gap)
            throws CloneNotSupportedException
Creates a new instance of MatrixCosts where the costs for mismatch and match are given in matrix. Additionally, the costs for a gap can be specified.

Parameters:
matrix - the match and mismatch costs
gap - the cost for a gap
Throws:
CloneNotSupportedException - if matrix could not be cloned
Method Detail

getCostFor

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

Specified by:
getCostFor in interface Costs
Parameters:
s1 - the first sequence
s2 - the second sequence
i - the index in the first sequence
j - the index in the second sequence
Returns:
the costs
See Also:
Sequence.discreteVal(int)

getGapCosts

public double getGapCosts()
Description copied from interface: Costs
Returns the costs for a gap.

Specified by:
getGapCosts in interface Costs
Returns:
the costs for a gap