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

Model that handles "canonical" kmers, ie the minimum value of the direct kmer and its reverse complement. More...

#include <Model.hpp>

Inheritance diagram for Kmer< span >::ModelCanonical:
Inheritance graph

Public Types

typedef Kmer< span >::KmerCanonical Kmer
 
- Public Types inherited from Kmer< span >::ModelAbstract< ModelCanonical, Kmer< span >::KmerCanonical >
typedef Kmer< span >::KmerCanonical Kmer
 

Public Member Functions

 ModelCanonical (size_t kmerSize=span-1)
 
template<class Convert >
int first (const char *seq, Kmer &value, size_t startIndex) const
 
template<class Convert >
void next (char c, Kmer &value, bool isValid) const
 
- Public Member Functions inherited from Kmer< span >::ModelAbstract< ModelCanonical, Kmer< span >::KmerCanonical >
 ModelAbstract (size_t sizeKmer=span-1)
 
size_t getSpan () const
 
size_t getMemorySize () const
 
size_t getKmerSize () const
 
const TypegetKmerMax () 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
 
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
 
void iterateNeighbors (const Type &source, const Functor &fct, const std::bitset< 8 > &mask=0xFF) const
 
void iterateOutgoingNeighbors (const Type &source, Functor &fct, const std::bitset< 4 > &mask=0x0F) const
 
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 ()
 

Additional Inherited Members

- Protected Member Functions inherited from Kmer< span >::ModelAbstract< ModelCanonical, Kmer< span >::KmerCanonical >
bool iterate (const char *seq, size_t length, Callback callback) const
 
- Protected Member Functions inherited from SmartPointer
 SmartPointer ()
 
virtual ~SmartPointer ()
 

Detailed Description

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

Model that handles "canonical" kmers, ie the minimum value of the direct kmer and its reverse complement.

Example of use:

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

Member Typedef Documentation

typedef Kmer<span>::KmerCanonical Kmer

Kmer type for this kind of model.

Constructor & Destructor Documentation

ModelCanonical ( size_t  kmerSize = span-1)
inline

Constructor.

Parameters
[in]kmerSize: size of the kmers handled by the model.

Member Function Documentation

int first ( const char *  seq,
Kmer value,
size_t  startIndex 
) const
inline

Computes a kmer from a buffer holding nucleotides encoded in some format. The way to interpret the buffer is done through the provided Convert template class.

Parameters
[in]seq: holds the nucleotides sequence from which the kmer has to be computed
[out]value: kmer as a result
[in]startIndex: index of the first nucleotide of the kmer to retrieve in the buffer
void next ( char  c,
Kmer value,
bool  isValid 
) const
inline

Computes a kmer in a recursive way, ie. from a kmer and the next nucleotide. The next nucleotide is computed from a buffer and the index of the nucleotide within the buffer. The way to interpret the buffer is done through the provided Convert template class.

Parameters
[in]c: next nucleotide
[out]value: kmer to be updated with the provided next nucleotide
[in]isValid: tells whether the updated kmer is valid or not

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