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 

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

[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
the extracted kmer.
const Type& forward ( ) const

Returns the forward value of this canonical kmer.

the forward value
bool isValid ( ) const

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.

true if valid, false otherwise.
bool operator< ( const KmerDirect t) const

Comparison operator between two instances.

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

Returns the reverse complement value of this canonical kmer.

the reverse complement value
void set ( const Type val)

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

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

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

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

Tells which strand is used.

the used strand.
const Type& value ( ) const

Returns the value of the kmer.

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

Returns the value of the kmer.

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

Tells which strand is used for the kmer.

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: