yat
0.18pre

Aligning two sequences. More...
#include <yat/utility/Aligner.h>
Classes  
class  Cigar 
Compact Idiosyncratic Gapped Alignment Report. More...  
Public Types  
enum  direction { none, right, down, diagonal } 
Public Member Functions  
Aligner (double gap=0, double open_gap=0)  
Constructor. More...  
Aligner (double vertical_gap, double open_vertical_gap, double horizon_gap, double open_horizon_gap)  
constructor More...  
double  needleman_wunsch (const Matrix &d) 
double  smith_waterman (const Matrix &d) 
void  operator() (const Matrix &dot, Matrix &score) 
calculate score matrix based on the dot matrix More...  
const direction &  alignment (size_t i, size_t j) const 
const Cigar  cigar (size_t i, size_t j) const 
Aligning two sequences.
General class aligning two sequences described in a dotmatrix, D, in which describes how similar element i
in the first sequence is with element j
in the second sequence. A path through this matrix corresponds to an alignment of the two sequences, in which a diagonal step correspoinds to a match between corresponding sequence elements, and a vertical or horizontal step correspond correspond to inserting a gap into one of the sequences.
Enum used to describe alignment.

explicit 
Constructor.
Same as Aligner(gap, open_gap, gap, open_gap)
theplu::yat::utility::Aligner::Aligner  (  double  vertical_gap, 
double  open_vertical_gap,  
double  horizon_gap,  
double  open_horizon_gap  
) 
constructor
vertical_gap  Penalty for extending a vertical gap. A vertical gap means alignment consumes an element in second element and not, in the first element, i.e., an element has been inserted to the second element or equivalently an element has been deleted in first sequence. 
open_vertical_gap  Penalty for open a vertical gap. Total cost for a vertical gap is open_vertical_gap + N * vertical_gap. 
horizon_gap  Penalty for extending a horizontal gap 
open_horizon_gap  Penalty for open a horizontal gap. Total penalty for a horizontal gap is open_horizon_gap + N horizon_gap. 
const direction& theplu::yat::utility::Aligner::alignment  (  size_t  i, 
size_t  j  
)  const 
If, for example, alignment(i,j) returns Aligner::diagonal, implies that score(i,j) was maximized as score(i1,j1) + dot(i1, j1), in other words, element i1 in first sequence was aligned with element j1 in second sequence.
const Cigar theplu::yat::utility::Aligner::cigar  (  size_t  i, 
size_t  j  
)  const 
double theplu::yat::utility::Aligner::needleman_wunsch  (  const Matrix &  d  ) 
Initialize a score matrix with and and align using operator().
calculate score matrix based on the dot matrix
The algorithm calculates a maximum score matrix as
where is gap if there was already a gap, and gap + open_gap otherwise.
To get the CIGAR to behave as expected, the each row in dot corresponds to an element in reference sequence and each row in dot corresponds to an element in query reference. If that is transposed, insertions and deletions are swapped in CIGAR.
The score matrix must have one column more than the dot matrix and one more row than the dot matrix.
double theplu::yat::utility::Aligner::smith_waterman  (  const Matrix &  d  ) 
Initialize a score matrix with all elements equal to zero, align using operator().