gatb.core-API-1.4.2
Kmer< span >::KmerDirect Class Reference

Kmer type for the ModelDirect class. More...

#include <Model.hpp>

Public Member Functions

const Typevalue () const
 
const Typevalue (int which) const
 
void set (const Type &val)
 
bool isValid () const
 

Protected Member Functions

KmerDirect extract (const Type &mask, size_t size, Type *mmer_lut)
 

Protected Attributes

Type _value
 

Detailed Description

template<size_t span = KMER_DEFAULT_SPAN>
class gatb::core::kmer::impl::Kmer< span >::KmerDirect

Kmer type for the ModelDirect class.

Now, we need to define what is a kmer for each kind of model.

The simple case is KmerDirect, where only the value of the kmer is available as a method 'value' returning a Type object.

The second case is KmerCanonical, which is the same as KmerDirect, but with two other methods 'forward' and 'revcomp'

The third case is KmerMinimizer<Model> which allows to handle minimizers associated to a kmer. This class inherits from the Model::Kmer type and adds methods specific to minimizers, such as 'minimizer' itself (ie the Model::Kmer object holding the minimizer), 'position' giving the position of the minimizer whithin the kmer and 'hasChanged' telling whether a minimizer has changed during iteration of kmers from some data source (a sequence data for instance).This class represent direct kmers, ie. a mere Type value.

NOTE: this class is not intended to be used directly by end users. Instead, the typedef definition ModelDirect::Kmer should be preferred.

Example of use:

// We declare a kmer model with kmer size big enough to represent our sequence.
ModelDirect model (kmerSize);
// We compute the kmer for a given sequence
ModelDirect::Kmer kmer = model.codeSeed (seq, Data::ASCII);
std::cout << std::endl;
std::cout << "-------------------- DIRECT --------------------" << std::endl;
std::cout << "kmer value is: " << kmer.value() << std::endl;
std::cout << "kmer string is: " << model.toString(kmer.value()) << std::endl;

Member Function Documentation

KmerDirect extract ( const Type mask,
size_t  size,
Type mmer_lut 
)
inlineprotected

Extract a mmer from a kmer. This is done by using a mask on the kmer.

Parameters
[in]mask: mask to be applied to the current kmer
[in]size: shift size (needed for some kmer classes but not all)
[in]mmer_lut: lookup table of minimizers
Returns
the extracted kmer.
bool isValid ( ) const
inline

Tells whether the kmer is valid or not. It may be invalid if some unwanted nucleotides characters (like N) have been used to build it.

Returns
true if valid, false otherwise.
void set ( const Type val)
inline

Set the value of the kmer

Parameters
[in]val: value to be set.
const Type& value ( ) const
inline

Returns the value of the kmer.

Returns
the kmer value as a Type object.
const Type& value ( int  which) const
inline

This is a dummy function that always returns the value of the kmer in the forward direction, even when "which" is 1. it's provided for API compatibility with KmerCanonical We could compute revcomp(_value) when which=1, but KmerDirect doesn't know about its k-mer size.

Parameters
[in]whichdummy parameter
Returns
the kmer value as a Type object.

Member Data Documentation

Type _value
protected

Returns the reverse complement value of this canonical kmer.

Returns
the reverse complement value

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