MDA
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups
Classes | List of all members
MDAT::Library< DataType > Class Template Reference

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 ()
 

Detailed Description

template<typename DataType>
class MDAT::Library< DataType >

A Library object stores pairwise matches and is able to do the consistency extension.

Template Parameters
DataTypeDataType 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).

Constructor & Destructor Documentation

template<typename DataType >
MDAT::Library< DataType >::Library ( const DataType &  data)

Constructor.

Parameters
dataThe basic data the Library is constructed for.

Member Function Documentation

template<typename DataType >
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.

Parameters
id1The sequence id of the first sequence.
id2The sequence id of the second sequence.
pos1The residue of sequence 1.
pos2The residue of sequence 2.
scoreThe score of the pair.
template<typename DataType >
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.

Parameters
[in]id1The id of sequence 1
[in]id2The id of sequence 2
[out]match_pointsIn this structure, the pairs with the scores will be saved.
template<typename DataType >
template<typename GapFunc >
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.

Template Parameters
GapFuncA function pointer or a functor.
Parameters
[in]ids1The first alignment.
[in]ids2The second alignment.
[in]dataThe data base data_set.
[out]match_pointsIn this structure, the pairs with the scores will be saved.
[in]gap_funcA simple function returning true if the element is a gap else false.
See Also
get
template<typename DataType >
template<typename RelaxFunc >
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.

Attention
The original scores will be replaced, so that this function should only be called once every matches have been added.
Parameters
relax_functionThe function to be used for the reweighting.
template<typename DataType >
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.

Parameters
id1The id of the first element.
id2The id of the second element.
n_entriesThe number of additional matches that will be added.