1 #ifndef LOCARNA_ALIGNER_N_HH 2 #define LOCARNA_ALIGNER_N_HH 9 #include "basepairs.hh" 10 #include "sparsification_mapper.hh" 11 #include "arc_matches.hh" 12 #include "alignment.hh" 19 #include "aligner_restriction.hh" 225 : alignerN_(alignerN),lambda_(0) {}
254 -lambda_*(arc_length(a)+arc_length(b));
267 -lambda_*(arc_length(am.
arcA())+arc_length(am.
arcB()));
292 template <
class ScoringView>
302 template <
class ScoringView>
327 template<
class ScoringView>
361 template<
class ScoringView>
362 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);
375 template<
class ScoringView>
376 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);
388 template<
class ScoringView>
416 template<
class ScoringView>
429 template<
class ScoringView>
443 template<
class ScoringView>
456 template <
class ScoringView>
469 template <
class ScoringView>
470 void trace_IXD(
const Arc &arcA,
const Arc &arcB,
bool isA, ScoringView sv);
479 template <
class ScoringView>
480 void trace_D(
const Arc &arcA,
const Arc &arcB, ScoringView sv);
498 template <
class ScoringView>
616 template <
class ScoringView>
617 void trace(ScoringView sv);
657 #endif // LOCARNA_ALIGNER_N_HH void fill_IB_entries(Arc arcA, pos_type bl, pos_type max_br)
fills all IB values using default scoring scheme
Definition: aligner_n.cc:533
size_t left() const
Definition: basepairs.hh:72
M_matrix_t M
M matrix.
Definition: aligner_n.hh:96
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
Definition: aligner_n.cc:270
SparsificationMapper::index_t index_t
type for an index
Definition: aligner_n.hh:44
size_t right() const
Definition: basepairs.hh:80
~AlignerN()
destructor
Definition: aligner_n.cc:105
AlignerRestriction r
restriction of AlignerN
Definition: aligner_n.hh:70
const BasePairs & bpsA
base pairs of A
Definition: aligner_n.hh:66
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
Definition: aligner_n.cc:1253
void trace()
offer trace as public method. Calls trace(def_scoring_view).
Definition: aligner_n.cc:1623
const Scoring * scoring() const
Definition: aligner_n.hh:146
infty_score_t getGapCostBetween(pos_type leftSide, pos_type rightSide, bool isA)
return score of aligning a subsequence to the gap
Definition: aligner_n.cc:151
const AlignerN * alignerN_
aligner object for that the view is provided
Definition: aligner_n.hh:199
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)
Definition: aligner_n.cc:1291
int max_i
subsequence of A right end, not used in sparse
Definition: aligner_n.hh:111
infty_score_t & IX(const pos_type i, const Arc &arc, bool isA)
Definition: aligner_n.hh:563
size_type pos_type
type of a sequence position
Definition: aux.hh:97
UnmodifiedScoringViewN(const AlignerN *alignerN)
Definition: aligner_n.hh:139
pos_type seq_pos_t
type for a sequence position
Definition: sparsification_mapper.hh:41
ModifiedScoringViewN(const AlignerN *alignerN)
Definition: aligner_n.hh:224
Alignment const & get_alignment() const
return the alignment that was computed by trace()
Definition: aligner_n.hh:643
SparsificationMapper::matidx_t matidx_t
type for a matrix position
Definition: aligner_n.hh:42
int min_j
subsequence of B left end, not used in sparse
Definition: aligner_n.hh:110
const Arc & arcA() const
Definition: arc_matches.hh:66
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
Definition: aligner_n.cc:230
ScoreMatrix Fmat
matrix for the affine gap cost model base insertion
Definition: aligner_n.hh:89
parameters for AlignerN
Definition: params.hh:319
infty_score_t & D(const ArcMatch &am)
Definition: aligner_n.hh:522
void set_lambda(score_t lambda)
Definition: aligner_n.hh:233
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
Definition: aligner_n.cc:1557
Maintains the relevant arc matches and their scores.
Definition: arc_matches.hh:112
const ArcMatches & arc_matches
the potential arc matches between A and B
Definition: aligner_n.hh:64
Provides the standard view on the scoring.
Definition: aligner_n.hh:128
const Sequence & seqA
sequence A
Definition: aligner_n.hh:58
infty_score_t align()
compute the alignment score
Definition: aligner_n.cc:843
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
Definition: aligner_n.cc:249
Provides a modified view on the scoring.
Definition: aligner_n.hh:197
bool D_created
flag, is D already created?
Definition: aligner_n.hh:114
std::vector< ArcIdx > ArcIdxVec
vector of arc indices
Definition: sparsification_mapper.hh:39
Definition: aligner.cc:17
ScoreMatrix gapCostAmat
Definition: aligner_n.hh:101
ModifiedScoringViewN mod_scoring_view
Modified scoring view for normalized alignment.
Definition: aligner_n.hh:273
infty_score_t compute_IX(pos_type xl, const Arc &arcY, pos_type i, bool isA, ScoringView sv)
compute IA/IB value of single element
Definition: aligner_n.cc:166
const Scoring * scoring() const
Definition: aligner_n.hh:242
size_t index_t
type for an index
Definition: sparsification_mapper.hh:49
infty_score_t D(const ArcMatch &am) const
Definition: aligner_n.hh:183
infty_score_t & D(const Arc &arcA, const Arc &arcB)
Definition: aligner_n.hh:550
Scoring * mod_scoring
used in normalized scoring, when we need to modify the scoring
Definition: aligner_n.hh:57
Alignment alignment
resulting alignment
Definition: aligner_n.hh:116
infty_score_t & IB(const Arc &a, const pos_type k)
Definition: aligner_n.hh:607
SparsificationMapper::ArcIdx ArcIdx
type for arc index
Definition: aligner_n.hh:40
void trace_IX(pos_type xl, pos_type i, const Arc &arcY, bool isA, ScoringView sv)
Definition: aligner_n.cc:909
const Sequence & seqB
sequence B
Definition: aligner_n.hh:59
void fill_M_entries(pos_type al, pos_type ar, pos_type bl, pos_type br)
Definition: aligner_n.cc:564
Represents the mapping for sparsification.
Definition: sparsification_mapper.hh:34
void align_D()
Definition: aligner_n.cc:735
score_t lambda_
factor for modifying scoring
Definition: aligner_n.hh:201
int max_j
subsequence of B right end, not used in sparse
Definition: aligner_n.hh:112
void fill_IA_entries(pos_type al, Arc arcB, pos_type max_ar)
fills all IA values using default scoring scheme
Definition: aligner_n.cc:510
ScoreMatrix gapCostBmat
Definition: aligner_n.hh:106
infty_score_t D(const Arc &a, const Arc &b) const
Definition: aligner_n.hh:252
ScoreMatrix Emat
matrix for the affine gap cost model base deletion
Definition: aligner_n.hh:87
int min_i
subsequence of A left end, not used in sparse
Definition: aligner_n.hh:109
Definition: infty_int.hh:344
SparsificationMapper::seq_pos_t seq_pos_t
type for a sequence position
Definition: aligner_n.hh:43
BasePairs__Arc Arc
type for an arc a.k.a base pair
Definition: aligner_n.hh:39
pos_type matidx_t
type for a matrix position
Definition: sparsification_mapper.hh:40
const Arc & arcB() const
Definition: arc_matches.hh:74
infty_score_t D(const Arc &arcX, const Arc &arcY, bool isA)
Definition: aligner_n.hh:169
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
Definition: aligner_n.cc:1215
const AlignerN * alignerN_
aligner object for that the view is provided
Definition: aligner_n.hh:130
const UnmodifiedScoringViewN def_scoring_view
Default scoring view.
Definition: aligner_n.hh:272
Implements SPARSE, next generation alignment algorithm for locarna.
Definition: aligner_n.hh:37
Parameter for alignment by Aligner.
Definition: params.hh:101
void trace_IXD(const Arc &arcA, const Arc &arcB, bool isA, ScoringView sv)
Definition: aligner_n.cc:1040
const SparsificationMapper & mapperA
sparsification mapping for seq A
Definition: aligner_n.hh:61
const SparsificationMapper & mapperB
sparsification mapping for seq B
Definition: aligner_n.hh:62
SparsificationMapper::ArcIdxVec ArcIdxVec
vector of arc indices
Definition: aligner_n.hh:41
void init_M_E_F(pos_type al, pos_type ar, pos_type bl, pos_type br, ScoringView sv)
initialize matrices M
Definition: aligner_n.cc:437
infty_score_t D(const ArcMatch &am) const
Definition: aligner_n.hh:265
static AlignerNParams create()
create with named parameters
Definition: aligner_n.hh:636
AlignerN(const AlignerN &a)
copy constructor
Definition: aligner_n.cc:27
Represents a structure-annotated sequence alignment.
Definition: alignment.hh:87
infty_score_t & IXD(const Arc &arc1, const Arc &arc2, bool isA)
Definition: aligner_n.hh:580
Represents a base pair.
Definition: basepairs.hh:40
ScoreMatrix Dmat
matrix indexed by the arc indices of rnas A and B
Definition: aligner_n.hh:73
const BasePairs & bpsB
base pairs of B
Definition: aligner_n.hh:67
infty_score_t & D(const Arc &arcX, const Arc &arcY, bool isA)
Definition: aligner_n.hh:535
Provides methods for the scoring of alignments.
Definition: scoring.hh:285
size_t arc_length(const Arc &a) const
Definition: aligner_n.hh:211
ScoreMatrix M_matrix_t
type of matrix M
Definition: aligner_n.hh:49
ScoreMatrix IADmat
matrix indexed by positions of elements of the seqA positions and the arc indices of RNA B ...
Definition: aligner_n.hh:82
size_t idx() const
Definition: basepairs.hh:88
const AlignerNParams * params
the parameter for the alignment
Definition: aligner_n.hh:54
infty_score_t & IA(const pos_type i, const Arc &b)
Definition: aligner_n.hh:596
size_t ArcIdx
type of arc index
Definition: sparsification_mapper.hh:38
Describes sequence and structure ensemble of an RNA.
Definition: basepairs.hh:107
void computeGapCosts(bool isA, ScoringView sv)
compute and stores score of aligning subsequences to the gap
Definition: aligner_n.cc:114
long int score_t
type of the locarna score as defined by the class Scoring
Definition: scoring_fwd.hh:13
"Sequence View" of multiple alignment as array of column vectors
Definition: sequence.hh:29
ScoreMatrix IBmat
matrix indexed by positions of elements of the seqB positions and the arc indices of RNA A ...
Definition: aligner_n.hh:78
Represents a match of two base pairs (arc match)
Definition: arc_matches.hh:35
Restricts range of an alignment in Aligner.
Definition: aligner_restriction.hh:26
ScoreMatrix IAmat
matrix indexed by positions of elements of the seqA positions and the arc indices of RNA B ...
Definition: aligner_n.hh:76
ScoreMatrix IBDmat
matrix indexed by positions of elements of the seqB positions and the arc indices of RNA A ...
Definition: aligner_n.hh:84
void trace_D(const Arc &arcA, const Arc &arcB, ScoringView sv)
Definition: aligner_n.cc:1102
const Scoring * scoring
the scores
Definition: aligner_n.hh:56
infty_score_t D(const Arc &a, const Arc &b) const
Definition: aligner_n.hh:156
void fill_D_entries(pos_type al, pos_type bl)
Definition: aligner_n.cc:611