gatb.core-API-0.0.0
|
#include <Model.hpp>
Public Types | |
typedef T | Kmer |
Public Member Functions | |
ModelAbstract (size_t sizeKmer=span-1) | |
size_t | getSpan () const |
size_t | getMemorySize () const |
size_t | getKmerSize () const |
const Type & | getKmerMax () const |
std::string | toString (const Type &kmer) const |
Type | reverse (const Type &kmer) const |
Kmer | getKmer (const tools::misc::Data &data, size_t startIndex=0) const |
template<typename Callback > | |
bool | iterate (tools::misc::Data &data, Callback callback) const |
Kmer | codeSeed (const char *seq, tools::misc::Data::Encoding_e encoding, size_t startIndex=0) const |
Kmer | codeSeedRight (const Kmer &kmer, char nucl, tools::misc::Data::Encoding_e encoding) const |
bool | build (tools::misc::Data &data, std::vector< Kmer > &kmersBuffer) const |
template<typename Functor > | |
void | iterateNeighbors (const Type &source, const Functor &fct, const std::bitset< 8 > &mask=0xFF) const |
template<typename Functor > | |
void | iterateOutgoingNeighbors (const Type &source, Functor &fct, const std::bitset< 4 > &mask=0x0F) const |
template<typename Functor > | |
void | iterateIncomingNeighbors (const Type &source, Functor &fct, const std::bitset< 4 > &mask=0x0F) const |
Public Member Functions inherited from SmartPointer | |
void | use () |
void | forget () |
Public Member Functions inherited from ISmartPointer | |
virtual | ~ISmartPointer () |
Protected Member Functions | |
template<typename Callback , typename Convert > | |
bool | iterate (const char *seq, size_t length, Callback callback) const |
Protected Member Functions inherited from SmartPointer | |
SmartPointer () | |
virtual | ~SmartPointer () |
Abstract class that provides kmer management.
This class is the base class for kmer management. It provides several services on this purpose like getting kmer information from some nucleotides sequence, or iterate kmers through such a sequence.
This class has two templates types :
1) ModelImpl : ModelAbstract is design for static polymorphism and ModelImpl is the implementation that must be provided to it 2) T : type of kmers handled by the class (ie KmerDirect, KmerCanonical...); I was not successful in trying to hide KmerXXX classes in the dedicated ModelXXX classes because of mutual dependencies while template specializations (maybe a solution one day)
End user will be given instances of Kmer class, delivering more or less information according to the specific type of ModelImpl
typedef T Kmer |
Type of kmers provided by the class. It can be KmerDirect, KmerCanonical or KmerMinimizer.
The simple way to get the value of the kmer is done with the 'value' method.
Note that, according to the true type of T, this Kmer typedef may have more or less methods.
|
inline |
(default) Constructor. The provided (runtime) kmer size must be coherent with the span (static) value.
[in] | sizeKmer | : size of kmers handled by the instance. |
|
inline |
Build a vector of successive kmers from a given sequence of nucleotides provided as a Data object.
[in] | data | : the sequence of nucleotides. |
[out] | kmersBuffer | : the successive kmers built from the data object. |
|
inline |
Compute the kmer given some nucleotide data. Note that we don't check if we have enough nucleotides in the provided data.
[in] | seq | : the sequence |
[in] | encoding | : encoding mode of the sequence |
[in] | startIndex | : index of the first nucleotide in the seq buffer |
|
inline |
Compute the next right kmer given a current kmer and a nucleotide.
[in] | kmer | : the current kmer as a starting point |
[in] | nucl | : the next nucleotide |
[in] | encoding | : encoding mode of the sequence |
|
inline |
Build a kmer from a Data object (ie a sequence of nucleotides), starting at an index in the nucleotides sequence. The result is a pair holding the built kmer and a boolean set to yes if the built kmer has to be understood in the forward sense, false otherwise.
[in] | data | : the data from which we extract a kmer |
[in] | startIndex | : start index in the data object (default to 0) |
|
inline |
Gives the maximum value of a kmer for the instance.
|
inline |
Gives the kmer size for this model.
|
inline |
Get the memory size (in bytes) of a Kmer<span>::Type object.
|
inline |
Returns the span of the model
|
inline |
Iteration of the kmers from a data object through a functor (so lambda expressions can be used). Note that the functor takes the currently iterated Kmer object and its index during the iteration.
Example of use:
[in] | data | : the sequence of nucleotides as a Data object. |
[in] | callback | : functor that handles one kmer |
|
inlineprotected |
Template method that iterates the kmer of a given sequence (provided as a buffer and its length). Note : we use static polymorphism here (http://en.wikipedia.org/wiki/Template_metaprogramming)
[in] | seq | : the sequence to be iterated |
[in] | length | : length of the sequence |
[in] | callback | : functor called on each found kmer in the sequence |
|
inline |
Iterate the neighbors of a given kmer; these neighbors are:
[in] | source | : the kmer from which we want neighbors. |
[in] | fct | : a functor called for each neighbor. |
[in] | mask | : mask of the neighbors to be used |
|
inline |
Iterate the neighbors of a given kmer; these neighbors are:
[in] | source | : the kmer from which we want neighbors. |
[in] | fct | : a functor called for each neighbor. |
[in] | mask | : holds 8 bits for each possible neighbor (1 means that the neighbor is computed) |
|
inline |
Iterate the neighbors of a given kmer; these neighbors are:
[in] | source | : the kmer from which we want neighbors. |
[in] | fct | : a functor called for each neighbor. |
[in] | mask | : mask of the neighbors to be used |
Compute the reverse complement of a kmer.
[in] | kmer | : the kmer to be reverse-completed. |
|
inline |
Returns an ascii representation of the kmer value.
[in] | kmer | : the kmer we want an ascii representation for |