yat  0.10.4pre
Public Types | Public Member Functions
theplu::yat::utility::Aligner Class Reference

Aligning two sequences. More...

#include </scratch/bob/jari/tmp/pristine/yat-0.10.x/yat/utility/Aligner.h>

List of all members.

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 directionalignment (size_t i, size_t j) const
 access cigar element i, j

Detailed Description

Aligning two sequences.

General class aligning two sequences described in a dot-matrix, D, in which $ D(i,j) $ 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.

Since:
New in yat 0.9

Member Enumeration Documentation

Enum used to describe alignment.

See also:
alignment

Constructor & Destructor Documentation

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

  \param vertical_gap Penalty for extending a vertical gap

  \param open_vertical_gap Penalty for open a vertical gap. Total
  cost for a vertical gap is open_vertical_gap + N *
  vertical_gap.

  \param horizon_gap Penalty for extending a horizontal gap

  \param open_horizon_gap Penalty for open a horizontal
  gap. Total penalty for a horizontal gap is open_horizon_gap + N

horizon_gap.


Member Function Documentation

const direction& theplu::yat::utility::Aligner::alignment ( size_t  i,
size_t  j 
) const

access cigar element i, j

If, for example, cigar(i,j) returned Aligner::diagonal, implies that score(i,j) was maximized as score(i-1,j-1) + dot(i-1, j-1), which in turn implies that 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 $ S_{k,0} = - \textrm{open\_vertical\_gap} - k * \textrm{vertical\_gap} $ and $ S_{0,k} = - \textrm{open\_horizon\_gap} - k * \textrm{horizon\_gap} $ and align using operator().

Returns:
most lower right element of score matrix
void theplu::yat::utility::Aligner::operator() ( const Matrix dot,
Matrix score 
)

calculate score matrix based on the dot matrix

  The algorithm calculates a maximum \a score matrix as

$ S_{i,j} = \textrm{max} \{ S_{ij}; S_{i,j-1} - F(\textrm{gap}_V); S_{i-1,j-1} + D_{i-1,j-1}; S_{i-1,j} - F(\textrm{gap}_H) \} $

  where \form#383 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().

Returns:
max element in score matrix.

The documentation for this class was generated from the following file:

Generated on Mon Nov 11 2013 09:41:45 for yat by  doxygen 1.8.1