yat
0.11.3pre
|
Aligning two sequences. More...
#include <yat/utility/Aligner.h>
Public Types | |
enum | direction { none, right, down, diagonal } |
Public Member Functions | |
Aligner (double gap=0, double open_gap=0) | |
Constructor. | |
Aligner (double vertical_gap, double open_vertical_gap, double horizon_gap, double open_horizon_gap) | |
constructor | |
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 | |
const direction & | alignment (size_t i, size_t j) const |
Aligning two sequences.
General class aligning two sequences described in a dot-matrix, 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.
theplu::yat::utility::Aligner::Aligner | ( | double | gap = 0 , |
double | open_gap = 0 |
||
) |
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 |
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(i-1,j-1) + dot(i-1, j-1), in other words, element i-1 in first sequence was aligned with element j-1 in second sequence.
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.
double theplu::yat::utility::Aligner::smith_waterman | ( | const Matrix & | d | ) |
Initialize a score matrix with all elements equal to zero, align using operator().