DIAlign
DIAlign::AffineAlignment Namespace Reference

Includes functions for the affine-alignment through a score-matrix using gap-opening and gap-closing penalties. More...

Functions

void doAffineAlignment (AffineAlignObj &, const SimMatrix &s, double go, double ge, bool OverlapAlignment)
 Performs affine alignment on similarity-score matrix DIAlign::SimMatrix and fills M, A, B and corresponding Traceback matrices in AffineAlignObj. More...
 
void getAffineAlignedIndices (AffineAlignObj &affineAlignObj, int bandwidth=0)
 Calculates aligned indices for source signal A and B, additionaly, builds an alignment path matrix with true-hot encoding. More...
 
double getOlapAffineAlignStartIndices (double *MatrixM, double *MatrixA, double *MatrixB, int ROW_SIZE, int COL_SIZE, int &OlapStartRow, int &OlapStartCol, Traceback::tbJump &MatrixName)
 Calculates the start indices and matrix for the alignment path and returns associated score. More...
 
void fillSimPath (bool *simPath, int bandwidth, int ROW_IDX, int COL_IDX, int ROW_SIZE, int COL_SIZE)
 Not needed will be removed.
 
double getForwardSim (const SimMatrix &s, bool *simPath)
 Not needed will be removed.
 

Detailed Description

Includes functions for the affine-alignment through a score-matrix using gap-opening and gap-closing penalties.

Function Documentation

void DIAlign::AffineAlignment::doAffineAlignment ( AffineAlignObj ,
const SimMatrix s,
double  go,
double  ge,
bool  OverlapAlignment 
)

Performs affine alignment on similarity-score matrix DIAlign::SimMatrix and fills M, A, B and corresponding Traceback matrices in AffineAlignObj.

Affine alignment uses gap-opening and gap-extension penalties to control number of consecutive gaps. It uses three cumulative score matrices M, A and B. At start, the first row and column of these matrices are initialized. Afterward, remaining cells of the matrices are filled using method described in [Paste the link to the main page with equations.] As cumulative score is calculated for each cell, movement is captured in Traceback with its direction (Top, Left, Diagonal) and the source matrix (M, A, B).

Parameters
affineAlignObjAn object of class AffineAlignObj. It must be initialized with appropriate ROW_SIZE and COL_SIZE.
ssimilarity score matrix must be of size (ROW_SIZE - 1) * (COL_SIZE - 1).
gogap opening penalty in alignment path.
gegap extension penalty in alignment path.
OverlapAlignmentIf true, end gaps are not penalized. For a global-alignment, OverlapAlignment is set false which penalizes end-gaps as regular gaps.
void DIAlign::AffineAlignment::getAffineAlignedIndices ( AffineAlignObj affineAlignObj,
int  bandwidth = 0 
)

Calculates aligned indices for source signal A and B, additionaly, builds an alignment path matrix with true-hot encoding.

For finding the alignment path it uses cumulative scores and Traceback matrices. For non-overlap alignment, cell with the highest score is identified across rightmost cells of M, A and B. For overlap alignment, last column and row of the matrices are searched for the highest score cell. After identifying highest-score cell, Traceback is used to find the path. Simultaneously, number of gaps are calculated and path matrix is filled with true-hot encoding.

Parameters
affineAlignObjAn object of class AffineAlignObj. Must have been operated by doAffineAlignment() function before.
bandwidthNot needed. Will be removed.

Overlap Alignment

Maximum score and corresponding indices along the last column and last row is searched across all three matrices. Matrix name and maximum score indices are passed by reference.

double DIAlign::AffineAlignment::getOlapAffineAlignStartIndices ( double *  MatrixM,
double *  MatrixA,
double *  MatrixB,
int  ROW_SIZE,
int  COL_SIZE,
int &  OlapStartRow,
int &  OlapStartCol,
Traceback::tbJump MatrixName 
)

Calculates the start indices and matrix for the alignment path and returns associated score.

Initially, the maximum score is searched along the last row and column of the three matrices. The highest-scoring cell is passed-by-reference.

Parameters
MatrixMpointer for matrix of type AffineAlignObj::M.
MatrixApointer for matrix of type AffineAlignObj::A.
MatrixBpointer for matrix of type AffineAlignObj::B.
ROW_SIZEnumber of rows in each matrix.
COL_SIZEnumber of columns in each matrix.
OlapStartRowrow-index of the start-cell.
OlapStartColcolumn-index of the start-cell.
MatrixNameName of the matrix from which start-cell is selected.
Returns
The start-cell score that serves as the cumulative score of the alignment.
Note
MatrixM, MatrixA and MatrixB should have the same number of rows and columns.