LocARNA-1.9.2
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends
Classes | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes
LocARNA::AlignerN Class Reference

Implements SPARSE, next generation alignment algorithm for locarna. More...

#include <aligner_n.hh>

List of all members.

Classes

class  ModifiedScoringViewN
 Provides a modified view on the scoring. More...
class  UnmodifiedScoringViewN
 Provides the standard view on the scoring. More...

Public Types

typedef BasePairs__Arc Arc
 type for an arc a.k.a base pair
typedef
SparsificationMapper::ArcIdx 
ArcIdx
 type for arc index
typedef
SparsificationMapper::ArcIdxVec 
ArcIdxVec
 vector of arc indices
typedef
SparsificationMapper::matidx_t 
matidx_t
 type for a matrix position
typedef
SparsificationMapper::seq_pos_t 
seq_pos_t
 type for a sequence position
typedef
SparsificationMapper::index_t 
index_t
 type for an index
typedef ScoreMatrix M_matrix_t
 type of matrix M

Public Member Functions

 AlignerN (const AlignerN &a)
 copy constructor
 AlignerN (const AlignerParams &ap)
 Construct from parameters.
 ~AlignerN ()
 destructor
Alignment const & get_alignment () const
 return the alignment that was computed by trace()
infty_score_t align ()
 compute the alignment score
void trace ()
 offer trace as public method. Calls trace(def_scoring_view).

Static Public Member Functions

static AlignerNParams create ()
 create with named parameters

Protected Member Functions

template<class ScoringView >
void init_M_E_F (pos_type al, pos_type ar, pos_type bl, pos_type br, ScoringView sv)
 initialize matrices M
template<bool isA, class ScoringView >
void initGapCostMat (ScoringView sv)
 compute and stores score of aligning subsequences to gaps
template<bool isA>
infty_score_t getGapCostBetween (pos_type leftSide, pos_type rightSide)
 return score of aligning a subsequence to gaps
template<bool isA, class ScoringView >
infty_score_t compute_IX (pos_type xl, const Arc &arcY, pos_type i, ScoringView sv)
 compute IA/IB value of single element
void fill_IA_entries (pos_type al, Arc arcB, pos_type max_ar)
 fills all IA values using default scoring scheme
void fill_IB_entries (Arc arcA, pos_type bl, pos_type max_br)
 fills all IB values using default scoring scheme
template<class ScoringView >
infty_score_t compute_E_entry (index_t al, matidx_t i_index, matidx_t j_index, seq_pos_t i_seq_pos, seq_pos_t i_prev_seq_pos, ScoringView sv)
 compute E matrix value of single matrix element
template<class ScoringView >
infty_score_t compute_F_entry (index_t bl, matidx_t i_index, matidx_t j_index, seq_pos_t i_seq_pos, seq_pos_t i_prev_seq_pos, ScoringView sv)
 compute F matrix value of single matrix element
template<class ScoringView >
infty_score_t compute_M_entry (index_t al, index_t bl, matidx_t index_i, matidx_t index_j, ScoringView sv)
 compute M value of single matrix element
void fill_M_entries (pos_type al, pos_type ar, pos_type bl, pos_type br)
template<class ScoringView >
void trace_E (pos_type al, matidx_t i_index, pos_type bl, matidx_t j_index, bool top_level, ScoringView sv)
 trace back base deletion within a match of arcs
template<class ScoringView >
void trace_F (pos_type al, matidx_t i_index, pos_type bl, matidx_t j_index, bool top_level, ScoringView sv)
 trace back base insertion within a match of arcs
template<class ScoringView >
void trace_M (pos_type al, matidx_t i_index, pos_type bl, matidx_t j_index, bool tl, ScoringView sv)
 trace back within an arc match
template<class ScoringView >
void trace_M_noex (pos_type al, pos_type i, pos_type bl, pos_type j, bool top_level, ScoringView sv)
 standard cases in trace back (without handling of exclusions)
template<bool isA, class ScoringView >
void trace_IXD (const Arc &arcA, const Arc &arcB, ScoringView sv)
template<class ScoringView >
void trace_D (const Arc &arcA, const Arc &arcB, ScoringView sv)
template<bool isA, class ScoringView >
void trace_IX (pos_type xl, pos_type i, const Arc &arcY, ScoringView sv)
void align_D ()
void fill_D_entries (pos_type al, pos_type bl)
infty_score_tD (const ArcMatch &am)
template<bool isA>
infty_score_tD (const Arc &arcX, const Arc &arcY)
infty_score_tD (const Arc &arcA, const Arc &arcB)
template<bool isA>
infty_score_tIX (const pos_type i, const Arc &arc)
template<bool isA>
infty_score_tIXD (const Arc &arc1, const Arc &arc2)
infty_score_tIA (const pos_type i, const Arc &b)
infty_score_tIB (const Arc &a, const pos_type k)
template<class ScoringView >
void trace (ScoringView sv)

Protected Attributes

const AlignerNParamsparams
 the parameter for the alignment
const Scoringscoring
 the scores
Scoringmod_scoring
const SequenceseqA
 sequence A
const SequenceseqB
 sequence B
const SparsificationMappermapperA
 sparsification mapping for seq A
const SparsificationMappermapperB
 sparsification mapping for seq B
const ArcMatchesarc_matches
 the potential arc matches between A and B
const BasePairsbpsA
 base pairs of A
const BasePairsbpsB
 base pairs of B
AlignerRestriction r
 restriction of AlignerN
ScoreMatrix Dmat
 matrix indexed by the arc indices of rnas A and B
ScoreMatrix IAmat
ScoreMatrix IBmat
ScoreMatrix IADmat
ScoreMatrix IBDmat
ScoreMatrix Emat
 matrix for the affine gap cost model base deletion
ScoreMatrix Fmat
 matrix for the affine gap cost model base insertion
M_matrix_t M
 M matrix.
ScoreMatrix gapCostMatA
ScoreMatrix gapCostMatB
int min_i
 subsequence of A left end, not used in sparse
int min_j
 subsequence of B left end, not used in sparse
int max_i
 subsequence of A right end, not used in sparse
int max_j
 subsequence of B right end, not used in sparse
bool D_created
 flag, is D already created?
Alignment alignment
 resulting alignment
const UnmodifiedScoringViewN def_scoring_view
 Default scoring view.
ModifiedScoringViewN mod_scoring_view

Detailed Description

Implements SPARSE, next generation alignment algorithm for locarna.

Performs the alignment of two sequences and their associated sets of weighted basepairs

An object always knows about the two sequences and the two weighted base pair sets

usage: construct, align, trace, get_alignment

Todo:
implement noLP in sparse algorithm

Constructor & Destructor Documentation

Construct from parameters.

Parameters:
apparameter for aligner
Note:
ap is copied to allow reference to a temporary
for implicit type cast

Member Function Documentation

void LocARNA::AlignerN::align_D ( ) [protected]

create the entries in the D matrix This function is called by align() (unless D_created)

template<class ScoringView >
infty_score_t LocARNA::AlignerN::compute_E_entry ( index_t  al,
matidx_t  i_index,
matidx_t  j_index,
seq_pos_t  i_seq_pos,
seq_pos_t  i_prev_seq_pos,
ScoringView  sv 
) [protected]

compute E matrix value of single matrix element

Parameters:
al
i_indexposition in sequence A:
j_indexposition in sequence B:
i_seq_posposition in sequence A, for which score is computed
i_prev_seq_posposition in sequence A, first valid seq position before i_index
svthe scoring view to be used
Returns:
score of E(i,j)
template<class ScoringView >
infty_score_t LocARNA::AlignerN::compute_F_entry ( index_t  bl,
matidx_t  i_index,
matidx_t  j_index,
seq_pos_t  i_seq_pos,
seq_pos_t  i_prev_seq_pos,
ScoringView  sv 
) [protected]

compute F matrix value of single matrix element

Parameters:
bl
i_indexposition in sequence A:
j_indexposition in sequence B:
j_seq_posposition in sequence B, for which score is computed
j_prev_seq_posposition in sequence B, first valid seq position before i_index
svthe scoring view to be used
Returns:
score of E(i,j)
template<bool isA, class ScoringView >
infty_score_t LocARNA::AlignerN::compute_IX ( pos_type  xl,
const Arc arcY,
pos_type  i,
ScoringView  sv 
) [protected]

compute IA/IB value of single element

Parameters:
isAswitch to determine IX is IA/IB
xlposition in sequence A/B: left end of current arc match
arcYarc in sequence B/A, for which score is computed
iposition in sequence A/B, for which score is computed
svthe scoring view to be used
Returns:
score of IX(i,arcX) for the left end arc element i
template<class ScoringView >
infty_score_t LocARNA::AlignerN::compute_M_entry ( index_t  al,
index_t  bl,
matidx_t  index_i,
matidx_t  index_j,
ScoringView  sv 
) [protected]

compute M value of single matrix element

Parameters:
alposition in sequence A: left end of current arc match
blposition in sequence B: left end of current arc match
index_iindex position in sequence A, for which score is computed
index_jindex position in sequence B, for which score is computed
svthe scoring view to be used
Returns:
score of M(i,j) for the arcs left ended by al, bl
static AlignerNParams LocARNA::AlignerN::create ( ) [inline, static]

create with named parameters

Returns:
parameter object
infty_score_t& LocARNA::AlignerN::D ( const ArcMatch am) [inline, protected]

Read/Write access to D matrix

Parameters:
amArc match
Returns:
entry of D matrix for am
template<bool isA>
infty_score_t& LocARNA::AlignerN::D ( const Arc arcX,
const Arc arcY 
) [inline, protected]

Read/Write access to D matrix

Parameters:
arcXarc in A/B determined by isA
arcYarc in B/A determined by isA
isAswap arcX/Y parameters
Returns:
D matrix entry for match of arcX<->arcY
infty_score_t& LocARNA::AlignerN::D ( const Arc arcA,
const Arc arcB 
) [inline, protected]

Read/Write access to D matrix

Parameters:
arcAarc in sequence A
arcBarc in sequence B
Returns:
entry of D matrix for match of arcA and arcB
void LocARNA::AlignerN::fill_D_entries ( pos_type  al,
pos_type  bl 
) [protected]

fill in D the entries with left ends al,bl

Parameters:
alposition in sequence A: left end of current arc match
blposition in sequence A: left end of current arc match
void LocARNA::AlignerN::fill_IA_entries ( pos_type  al,
Arc  arcB,
pos_type  max_ar 
) [protected]

fills all IA values using default scoring scheme

Parameters:
alposition in sequence A: left end of current arc match
arcBarc in sequence B, for which score is computed
max_arrightmost possible for an arc starting with the left end al in sequence A: maximum right end of current arc match
void LocARNA::AlignerN::fill_IB_entries ( Arc  arcA,
pos_type  bl,
pos_type  max_br 
) [protected]

fills all IB values using default scoring scheme

Parameters:
arcAarc in sequence A, for which score is computed
blposition in sequence B: left end of current arc match
max_brrightmost possible for an arc with the left end of bl in sequence B: maximum right end of current arc match
void LocARNA::AlignerN::fill_M_entries ( pos_type  al,
pos_type  ar,
pos_type  bl,
pos_type  br 
) [protected]

align the loops closed by arcs (al,ar) and (bl,br). in structure local alignment, this allows to introduce exclusions

Parameters:
alleft end of arc a
arright end of arc a
blleft end of arc b
brright end of arc b
allow_exclusionwhether to allow exclusions, not supported by sparse
Precondition:
arc-match (al,ar)~(bl,br) valid due to constraints and heuristics
template<bool isA>
infty_score_t LocARNA::AlignerN::getGapCostBetween ( pos_type  leftSide,
pos_type  rightSide 
) [inline, protected]

return score of aligning a subsequence to gaps

Parameters:
leftSidesequence position before left side of the subsequence
rightSidesequence position after right side of the subsequence
isAa switch to determine the target sequence A or B
infty_score_t& LocARNA::AlignerN::IA ( const pos_type  i,
const Arc b 
) [inline, protected]

Read/Write access to IA matrix

Parameters:
irightside position in seqA
barc in B
Returns:
IA matrix entry for position i of a and arc b
infty_score_t& LocARNA::AlignerN::IB ( const Arc a,
const pos_type  k 
) [inline, protected]

Read/Write access to IB matrix

Parameters:
aarc in A
krightside position in seqB
Returns:
IB matrix entry for arc a and position k in b
template<class ScoringView >
void LocARNA::AlignerN::init_M_E_F ( pos_type  al,
pos_type  ar,
pos_type  bl,
pos_type  br,
ScoringView  sv 
) [protected]

initialize matrices M

initialize first column and row of matrices M for the alignment below of arc match (a,b). First row/column means the row al and column bl.

Parameters:
alleft end of arc a
arright end of arc a
blleft end of arc b
brright end of arc b
svScoring view
template<bool isA, class ScoringView >
void LocARNA::AlignerN::initGapCostMat ( ScoringView  sv) [protected]

compute and stores score of aligning subsequences to gaps

Parameters:
isAa switch to determine the target sequence A or B
svthe scoring view to be used
Returns:
writes gap costs into gapCost{A,B}mat (depending on isA)
template<bool isA>
infty_score_t& LocARNA::AlignerN::IX ( const pos_type  i,
const Arc arc 
) [inline, protected]

Read/Write access to IAorIB matrix

Parameters:
irightside position in seqA/B
arcarc in A/B
isAswitch to determine IA/IB
Returns:
IA/IB matrix entry for position k and arc
template<bool isA>
infty_score_t& LocARNA::AlignerN::IXD ( const Arc arc1,
const Arc arc2 
) [inline, protected]

Read/Write access to IAD orIBD matrix

Parameters:
irightside position in seqA/B
aracarc in A/B
isAswitch to determine IA/IB
Returns:
IA/IB matrix entry for position k and arc
template<class ScoringView >
void LocARNA::AlignerN::trace ( ScoringView  sv) [protected]

do the trace back through the alignment matrix with partial recomputation pre: call align() to fill the top-level matrix

template<class ScoringView >
void LocARNA::AlignerN::trace_D ( const Arc arcA,
const Arc arcB,
ScoringView  sv 
) [protected]

trace D matrix

Parameters:
arcAthe corresponding arc in A which defines the D element
arcBthe corresponding arc in B which defines the D element
svscoring view
template<class ScoringView >
void LocARNA::AlignerN::trace_E ( pos_type  al,
matidx_t  i_index,
pos_type  bl,
matidx_t  j_index,
bool  top_level,
ScoringView  sv 
) [protected]

trace back base deletion within a match of arcs

Parameters:
alleft end of arc in A
iright end of subsequence in A
blleft end of arc in B
jright end of subsequence in B
top_levelwhether alignment is on top level
svscoring view
template<class ScoringView >
void LocARNA::AlignerN::trace_F ( pos_type  al,
matidx_t  i_index,
pos_type  bl,
matidx_t  j_index,
bool  top_level,
ScoringView  sv 
) [protected]

trace back base insertion within a match of arcs

Parameters:
alleft end of arc in A
iright end of subsequence in A
blleft end of arc in B
jright end of subsequence in B
top_levelwhether alignment is on top level
svscoring view
template<bool isA, class ScoringView >
void LocARNA::AlignerN::trace_IX ( pos_type  xl,
pos_type  i,
const Arc arcY,
ScoringView  sv 
) [protected]

trace D matrix

Parameters:
amthe corresponding arcs which defines the D element
svscoring view trace IA/IB matrix
xlposition in sequence A/B: left end of current arc match
iposition in sequence A/B, for which score is computed
arcYarc in sequence B/A, for which score is computed
isAswitch to determine IA/IB
svthe scoring view to be used
template<bool isA, class ScoringView >
void LocARNA::AlignerN::trace_IXD ( const Arc arcA,
const Arc arcB,
ScoringView  sv 
) [protected]

trace IAD IBD matrix

Parameters:
arcAthe corresponding arc in A which defines the IAD/IBD element
arcBthe corresponding arc in B which defines the IAD/IBD element
svscoring view
template<class ScoringView >
void LocARNA::AlignerN::trace_M ( pos_type  al,
matidx_t  i_index,
pos_type  bl,
matidx_t  j_index,
bool  tl,
ScoringView  sv 
) [protected]

trace back within an arc match

Parameters:
alleft end of arc in A
i_indexindex for right end of subsequence in A
blindex for left end of arc in B
j_indexright end of subsequence in B
tlwhether alignment is on top level
svscoring view
template<class ScoringView >
void LocARNA::AlignerN::trace_M_noex ( pos_type  al,
pos_type  i,
pos_type  bl,
pos_type  j,
bool  top_level,
ScoringView  sv 
) [protected]

standard cases in trace back (without handling of exclusions)

Parameters:
alleft end of arc in A
iright end of subsequence in A
blleft end of arc in B
jright end of subsequence in B
top_levelwhether alignment is on top level
svscoring view

Member Data Documentation

matrix to store cost of deleting/inserting a subsequence of sequence A, indexed by neighboring positions of the range; the cost does not take into account whether the gap is compatible with constraints

matrix to store cost of deleting/inserting a subsequence of sequence B, indexed by neighboring positions of the range; the cost does not take into account whether the gap is compatible with constraints

matrix indexed by positions of elements of the seqA positions and the arc indices of RNA B

matrix indexed by positions of elements of the seqA positions and the arc indices of RNA B

matrix indexed by positions of elements of the seqB positions and the arc indices of RNA A

matrix indexed by positions of elements of the seqB positions and the arc indices of RNA A

M matrix.

use only one M matrix (unlike in Aligner), since we don't handle structure locality

used in normalized scoring, when we need to modify the scoring

Modified scoring view for normalized alignment


The documentation for this class was generated from the following files:
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends