MDA
|
A Library object stores pairwise matches and is able to do the consistency extension. More...
#include <Library.hpp>
Public Member Functions | |
Constructors & Destructors | |
Library (const DataType &data) | |
Constructor. More... | |
virtual | ~Library () |
Destructor. | |
Input & Output | |
void | add (unsigned int id1, unsigned int id2, unsigned int pos1, unsigned int pos2, float score=1.0) |
Adds a matching pare to the library. More... | |
void | get (size_t id1, size_t id2, std::map< Match, int > &match_points) const |
Calculates the scores for each residue pair. More... | |
template<typename GapFunc > | |
void | get (const std::vector< size_t > &ids1, const std::vector< size_t > &ids2, std::map< Match, int > &match_points, const GapFunc gap_func) const |
Calculates the scores for each residue pair. More... | |
void | reserve_add_memory (unsigned int id1, unsigned int id2, size_t n_entries) |
Reserves additional memory for a certain pair of elements. More... | |
Modify | |
template<typename RelaxFunc > | |
void | relax (RelaxFunc relax_function) |
Reweights the scores of each match according to its consistency with other sequences. More... | |
template<typename RelaxFunc > | |
void | relax (RelaxFunc relax_function, int n_threads) |
void | print () |
A Library object stores pairwise matches and is able to do the consistency extension.
DataType | DataType specifies the kind of data to be used as a base (e.g. SequenceSet). It has to support the functions size() and the access operator. The subelements have to support the size() function as well. |
The Library concept has been introduced by C. Notredame et al. ("T-Coffee: A novel method for fast and accurate multiple sequence alignment", J Mol Biol 302, 2000). It stores the matches produced by an alignment method and can produce extension (reweighting scores according to consistency using a third sequence).
MDAT::Library< DataType >::Library | ( | const DataType & | data | ) |
Constructor.
data | The basic data the Library is constructed for. |
void MDAT::Library< DataType >::add | ( | unsigned int | id1, |
unsigned int | id2, | ||
unsigned int | pos1, | ||
unsigned int | pos2, | ||
float | score = 1.0 |
||
) |
Adds a matching pare to the library.
If the pair does not exist yet in the library, the score will be set to 1. If the pair already exists, the score is increased by 1.
id1 | The sequence id of the first sequence. |
id2 | The sequence id of the second sequence. |
pos1 | The residue of sequence 1. |
pos2 | The residue of sequence 2. |
score | The score of the pair. |
void MDAT::Library< DataType >::get | ( | size_t | id1, |
size_t | id2, | ||
std::map< Match, int > & | match_points | ||
) | const |
Calculates the scores for each residue pair.
[in] | id1 | The id of sequence 1 |
[in] | id2 | The id of sequence 2 |
[out] | match_points | In this structure, the pairs with the scores will be saved. |
void MDAT::Library< DataType >::get | ( | const std::vector< size_t > & | ids1, |
const std::vector< size_t > & | ids2, | ||
std::map< Match, int > & | match_points, | ||
const GapFunc | gap_func | ||
) | const |
Calculates the scores for each residue pair.
This function compares the matching scores for two sets. The scores between every pair of elements from the different sets are computed and converted to fit the aligned sequences.
GapFunc | A function pointer or a functor. |
[in] | ids1 | The first alignment. |
[in] | ids2 | The second alignment. |
[in] | data | The data base data_set. |
[out] | match_points | In this structure, the pairs with the scores will be saved. |
[in] | gap_func | A simple function returning true if the element is a gap else false. |
void MDAT::Library< DataType >::relax | ( | RelaxFunc | relax_function | ) |
Reweights the scores of each match according to its consistency with other sequences.
This function checks the consistency of each pairwise match with every other sequence in the set. The higher the consistency the higher will be the final score of the match.
relax_function | The function to be used for the reweighting. |
void MDAT::Library< DataType >::reserve_add_memory | ( | unsigned int | id1, |
unsigned int | id2, | ||
size_t | n_entries | ||
) |
Reserves additional memory for a certain pair of elements.
id1 | The id of the first element. |
id2 | The id of the second element. |
n_entries | The number of additional matches that will be added. |