This class can compute the most simple form of alignment. More...
#include <musaline.hpp>
Public Types | |
typedef CostCalc | CostCalculator |
Public Member Functions | |
LinearAligner (CostCalculator ccal=CostCalculator()) | |
Constructor. More... | |
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. | |
This class can compute the most simple form of alignment.
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. This class shall be provided by the user and gives the benefit of matching one element with another one. If you can call the following function template with your cost calculator and sequences, you should be OK. More detailed requirements are listed after the function.
The classes Sequence0 and Sequence1 should fulfill the requirements for a boost Forward 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 forward iterators.
The CostCalculator class should have the following member functions:
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. gap_bft
. Returns the benefit for matching an element with a gap (nothing). The returned value should be negative, otherwise, the results are not guaranteed to be the optimal solution. preprocess
which takes two sequences as argument. This member function is guaranteed to be called before any call to 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 introductory page you can find a more gentle (and less precise) description of the requirements.
|
inline |
Constructor.
Alignment musaline::LinearAligner< 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::LinearAligner< 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::LinearAligner< 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::LinearAligner< 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::LinearAligner< 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::LinearAligner< 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::LinearAligner< 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.