#include <musaline.hpp>
Public Types | |
typedef CostCalc | CostCalculator |
Public Member Functions | |
ConsolidatingAligner (CostCalculator ccal=CostCalculator()) | |
Constructor. Takes a CostaCalculator object as parameter. | |
void | set_cost_calculator (CostCalculator ccal) |
Set a different CostCalculator object. | |
CostCalculator const & | get_cost_calculator () const |
Get a const reference to the current CostCalculator object. | |
template<class Sequence0 , class Sequence1 > | |
Alignment | global_align (Sequence0 const &seq0, Sequence1 const &seq1) const |
template<class Sequence0 , class Sequence1 > | |
Alignment | cut_one_end_off_align (Sequence0 const &seq0, Sequence1 const &seq1) const |
template<class Sequence0 , class Sequence1 > | |
Alignment | cut_one_begin_off_align (Sequence0 const &seq0, Sequence1 const &seq1) const |
template<class Sequence0 , class Sequence1 > | |
Alignment | initial_align (Sequence0 const &seq0, Sequence1 const &seq1) const |
template<class Sequence0 , class Sequence1 > | |
Alignment | end_align (Sequence0 const &seq0, Sequence1 const &seq1) const |
template<class Sequence0 , class Sequence1 > | |
Alignment | inside_align (Sequence0 const &seq0, Sequence1 const &seq1) const |
template<class Sequence0 , class Sequence1 > | |
Alignment | semi_align (Sequence0 const &seq0, Sequence1 const &seq1) const |
template<class Sequence0 , class Sequence1 > | |
Alignment | partial_align (Sequence0 const &seq0, Sequence1 const &seq1) const |
No requirement for start and end. | |
An element of a sequence can be aligned with an element of the other sequence or with a gap. The cost of aligning two elements or an element with a gap, does not depend on the context.
The class has several align functions which differ in what part of the sequences should be aligned. Details are provided with the individual align functions.
This class takes a CostCalculator class as a template parameter. The requirements are much like those for LinearAligner, except that gap_bft
is replaced by match_gap_with1
and match_gap_with2
, which take an element as parameter. Furthermore, there should be a member function1 match_range_with1
and match_range_with2
.
If you can call the following function template with your cost calculator and sequences without compilation errors, you should be OK. More detailed requirements are listed after the function.
The classes Sequence0 and Sequence1 should fulfill the requirements for a boost Bidirectional Range. See the documentation of the range library on http://www.boost.org for full details. A range can be thought of as a 'container light'. It should give access to a begin and end iterator, which should be bidirectional iterators. The CostCalculator class should have the following member functions: \li a copy constructor and an assignment operator. \li \c match which takes an element of seq0 and an element of seq1 and returns a double. This value is a measure for how well the two elements match. A good match should yield a (big) positive value. A bad match should yield a negative value. \li \c match_gap_with1. Takes an element of the first sequence as parameter. Returns the benefit for matching that element with a gap (nothing). The returned value should be negative, otherwise, the results are not guaranteed to be the optimal solution. \li \c match_gap_with2. Takes an element of the second sequence as parameter. Returns the benefit for matching that element with a gap (nothing). \li \c match_range_with1. Takes three parameters. The first is an element of the first sequence. The second and third are the begin and end iterator of a range of the second sequences. The result should be a vector of doubles. The resulting vector may have any length less than the size of the supplied range. The first element (if existant) contains the benefit of matching the last two elements of the range with the first parameter element. The second element of the result contains the benefit of matching the last three elements of the range with the first parameter element, etcetera. \li \c match_range_with2. Matches an element of the second sequence with a number of elements of the first sequence. \li \c preprocess which takes two sequences as argument. This member function is guaranteed to be called before any call to \c match for those sequences. This may be used to do some preprocessing of the sequences. For instance, say we want to compare two melodies, where a melody is a sequences of notes and a key. If one of the melodies is in C and the other one is in G, we might want to transpose the latter melody. This can be done in the preprocess step. In \ref sec_consol_require "introductory page" you can find a more gentle (and less precise) description of the requirements.
Alignment musaline::ConsolidatingAligner< CostCalc >::cut_one_begin_off_align | ( | Sequence0 const & | seq0, |
Sequence1 const & | seq1 | ||
) | const |
align one complete sequence with the end of the other sequence. end[0]==size of seq0, end[1]==size of seq1 and either start[0]==0 or start[1]==0.
Alignment musaline::ConsolidatingAligner< CostCalc >::cut_one_end_off_align | ( | Sequence0 const & | seq0, |
Sequence1 const & | seq1 | ||
) | const |
align one complete sequence with the start of the other sequence. start[0]==0, start[1]==0 and either end[0]==size of seq0 or end[1]==size of seq1.
Alignment musaline::ConsolidatingAligner< CostCalc >::end_align | ( | Sequence0 const & | seq0, |
Sequence1 const & | seq1 | ||
) | const |
align the end of the sequences. end[0]==size of seq0 and end[1]==size of seq1.
Alignment musaline::ConsolidatingAligner< CostCalc >::global_align | ( | Sequence0 const & | seq0, |
Sequence1 const & | seq1 | ||
) | const |
align both complete sequences. The resulting Alignment will have start[i]==0 and end[i]==size of seq i, for i==1 and 2.
Alignment musaline::ConsolidatingAligner< CostCalc >::initial_align | ( | Sequence0 const & | seq0, |
Sequence1 const & | seq1 | ||
) | const |
align the start of the sequences. start[0]==0 and start[1]==0.
Alignment musaline::ConsolidatingAligner< CostCalc >::inside_align | ( | Sequence0 const & | seq0, |
Sequence1 const & | seq1 | ||
) | const |
align seq0 inside seq1. start[0]==0 and end[0]==size of sequence 0.
Alignment musaline::ConsolidatingAligner< CostCalc >::semi_align | ( | Sequence0 const & | seq0, |
Sequence1 const & | seq1 | ||
) | const |
start[0]==0 or start[1]==0 end[0]==size of seq0 or end[1]==size of seq1.