Musaline
 All Classes Namespaces Functions Variables Pages
Public Types | Public Member Functions | List of all members
musaline::AffineAligner< CostCalc > Class Template Reference

This class can compute a form of alignment with a slightly more complicated cost function than LinearAligner. More...

#include <musaline.hpp>

Public Types

typedef CostCalc CostCalculator
 

Public Member Functions

 AffineAligner (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 inside_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 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.
 

Detailed Description

template<class CostCalc>
class musaline::AffineAligner< CostCalc >

This class can compute a form of alignment with a slightly more complicated cost function than LinearAligner.

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 does not depend on the context, but the cost of extending a gap can be different from starting a gap.

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.

#include "boost/range.hpp"
template <class CostCalculator, class Sequence0, class Sequence1>
void affine_usage(CostCalculator const &ccal,
Sequence0 const &seq0, Sequence1 const &seq1)
{
// Copy constructor
CostCalculator ccal_copy(ccal);
// assignment operator
ccal_copy = ccal;
ccal.preprocess(seq0, seq1);
double d = ccal.gap_bft();
d = ccal.ext_bft();
size_t sz0 = boost::distance(seq0);
size_t sz1 = boost::distance(seq1);
auto s0cur = boost::const_begin(seq0);
for (size_t i=0; i!=sz0; ++i) {
auto s1cur = boost::const_begin(seq1));
for (size_t j=0; j!=sz1; ++j) {
double benefit = ccal.match(*s0cur, *s1cur);
++s1cur;
}
++s0cur;
}
}

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 has the same requirements as the CostCalculator for the LinearAligner class, plus one extra required member function:

Constructor & Destructor Documentation

template<class CostCalc >
musaline::AffineAligner< CostCalc >::AffineAligner ( CostCalculator  ccal = CostCalculator())
inline

Constructor.

Member Function Documentation

template<class CostCalc >
template<class Sequence0 , class Sequence1 >
Alignment musaline::AffineAligner< 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.

template<class CostCalc >
template<class Sequence0 , class Sequence1 >
Alignment musaline::AffineAligner< 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.

template<class CostCalc >
template<class Sequence0 , class Sequence1 >
Alignment musaline::AffineAligner< 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.

template<class CostCalc >
template<class Sequence0 , class Sequence1 >
Alignment musaline::AffineAligner< 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.

template<class CostCalc >
template<class Sequence0 , class Sequence1 >
Alignment musaline::AffineAligner< CostCalc >::initial_align ( Sequence0 const &  seq0,
Sequence1 const &  seq1 
) const

align the start of the sequences. start[0]==0 and start[1]==0.

template<class CostCalc >
template<class Sequence0 , class Sequence1 >
Alignment musaline::AffineAligner< CostCalc >::inside_align ( Sequence0 const &  seq0,
Sequence1 const &  seq1 
) const

align seq0 inside seq1. start[0]==0 and end[0]==size of sequence 0.

template<class CostCalc >
template<class Sequence0 , class Sequence1 >
Alignment musaline::AffineAligner< 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.


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