gatb.core-API-0.0.0
Kmer< span >::KmerCanonical Class Reference

Kmer type for the ModelCanonical class. More...

#include <Model.hpp>

Public Member Functions

const Typevalue () const
 
const Typevalue (int which) const
 
bool operator< (const KmerDirect &t) const
 
void set (const Type &val)
 
void set (const Type &forward, const Type &revcomp)
 
bool isValid () const
 
const Typeforward () const
 
const Typerevcomp () const
 
bool which () const
 
Strand strand () const
 

Protected Member Functions

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

Detailed Description

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

Kmer type for the ModelCanonical class.

This class represent canonical kmers, ie. a value that is the minimal value of the forward kmer and its reverse complement.

The implementation maintains a table of two Type objects, the first one for the forward kmer and the second one for the reverse complement.

We can know which object is the canonical one (ie. the minimum) by using the method value.* One can also retrieve the strand used for the canonical form with the method strand.

It is still possible to get the forward kmer with forward and the reverse complement with revcomp.

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

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 Function Documentation

KmerCanonical 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.
const Type& forward ( ) const
inline

Returns the forward value of this canonical kmer.

Returns
the forward value
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.
bool operator< ( const KmerDirect t) const
inline

Comparison operator between two instances.

Parameters
[in]t: object to be compared to
Returns
true if the values are the same, false otherwise.
const Type& revcomp ( ) const
inline

Returns the reverse complement value of this canonical kmer.

Returns
the reverse complement value
void set ( const Type val)
inline

Set the value of the kmer. IMPORTANT: Not really a forward/revcomp couple, but may be useful for the minimizer default value.

Parameters
[in]val: value to be set (set to both forward and reverse complement).
void set ( const Type forward,
const Type revcomp 
)
inline

Set the forward/revcomp attributes. The canonical form is computed here.

Parameters
[in]forward: forward value
[in]revcomp: reverse complement value.
Strand strand ( ) const
inline

Tells which strand is used.

Returns
the used strand.
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

Returns the value of the kmer.

Parameters
[in]whichforward or reverse strand
Returns
the kmer value as a Type object.
bool which ( ) const
inline

Tells which strand is used for the kmer.

Returns
true if the kmer value is the forward value, false if it is the reverse complement value

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