org.jscience.biology.alignment
Class OutMatrix

java.lang.Object
  extended by org.jscience.biology.alignment.OutMatrix
All Implemented Interfaces:
Matrix

public class OutMatrix
extends java.lang.Object
implements Matrix

Implements an interface to the OUT matrix of a block. This class is used by the CrochemoreLandauZivUkelson and subclasses to enconde the OUT matrix from the input border and DIST matrix of an AlignmentBlock.

The OUT matrix defined as OUT[i,j] = I[i] + DIST[i,j] where I is the input border array and DIST is the DIST matrix.

The output border of a block is computed from the OUT matrix by taking the maximum value of each column. Note that this class does not compute the OUT matrix, it just stores the necessary information to retrieve a value at any position of the matrix.

It implements the Matrix interface so that the SMAWK algorithm can be used to compute its column maxima.

For more information on how this class is used, please refer to the specification of the CrochemoreLandauZivUkelson and its subclasses.

See Also:
CrochemoreLandauZivUkelson, CrochemoreLandauZivUkelsonGlobalAlignment, CrochemoreLandauZivUkelsonLocalAlignment, AlignmentBlock, Smawk

Field Summary
protected  int dim
          The dimension of the OUT matrix.
protected  int[][] dist
          The DIST matrix of a block.
protected  int[] input_border
          The input border of a block.
protected  int lc
          The number of columns of the block.
protected  int max_length
          The length of the longest sequence (number of characters) being aligned.
protected  int max_score
          The maximum absolute score that the current scoring scheme can return.
 
Constructor Summary
OutMatrix()
           
 
Method Summary
 void init(int max_length, int max_score)
          Initialised this OUT matrix interface.
 int numColumns()
          Returns the number of columns of this OUT matrix.
 int numRows()
          Returns the number of rows of this OUT matrix.
 void setData(int[][] dist, int[] input_border, int dim, int lc)
          Sets this interface's data to represent an OUT matrix for a block.
 int valueAt(int row, int col)
          Returns the value at a given position of the matrix.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

max_length

protected int max_length
The length of the longest sequence (number of characters) being aligned. It needs to be set only once per alignment.


max_score

protected int max_score
The maximum absolute score that the current scoring scheme can return. It needs to be set only once per alignment.


dist

protected int[][] dist
The DIST matrix of a block.


input_border

protected int[] input_border
The input border of a block.


dim

protected int dim
The dimension of the OUT matrix.


lc

protected int lc
The number of columns of the block.

Constructor Detail

OutMatrix

public OutMatrix()
Method Detail

init

public void init(int max_length,
                 int max_score)
Initialised this OUT matrix interface. This method needs to be executed only once per alignment.

Parameters:
max_length - the length of the longest sequence (number of characters) being aligned
max_score - the maximum absolute score that the current scoring scheme can return

setData

public void setData(int[][] dist,
                    int[] input_border,
                    int dim,
                    int lc)
Sets this interface's data to represent an OUT matrix for a block. This method is typically executed once for each block being aligned.

Parameters:
dist - the DIST matrix
input_border - the input border
dim - the dimension of the OUT matrix
lc - the number of columns of the block

valueAt

public int valueAt(int row,
                   int col)
Returns the value at a given position of the matrix. In general it returns the value of DIST[col][row] + input_border[row]. However, special cases occur for its upper right and lower left triangular parts.

Specified by:
valueAt in interface Matrix
Parameters:
row - row index
col - column index
Returns:
the value at row row, column col of this OUT matrix

numRows

public int numRows()
Returns the number of rows of this OUT matrix.

Specified by:
numRows in interface Matrix
Returns:
the number of rows of this OUT matrix

numColumns

public int numColumns()
Returns the number of columns of this OUT matrix.

Specified by:
numColumns in interface Matrix
Returns:
the number of columns of this OUT matrix