gatb.core-API-0.0.0
Kmer< span >::KmerMinimizer< Model, Comparator > Class Template Reference

Kmer type for the ModelMinimizer class. More...

#include <Model.hpp>

Inherits Kmer.

Public Member Functions

const Model::Kmer & minimizer () const
 
int position () const
 
bool hasChanged () const
 

Detailed Description

template<size_t span = KMER_DEFAULT_SPAN>
template<class Model, class Comparator>
class gatb::core::kmer::impl::Kmer< span >::KmerMinimizer< Model, Comparator >

Kmer type for the ModelMinimizer class.

This class associates a kmer and its minimizer. It 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).

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

Example of use:

// We declare a kmer model with kmer size big enough to represent our sequence.
// Note that we give a second size, which is the size of the minimizers
ModelMinimizer model (kmerSize, 8);
// We get a reference on the minimizer model, which will be useful for dumping
// string value of a minimizer. Recall that 'model' is a model configured with
// 'kmerSize' but has also to deal with mmers of size kmerSize/2. The 'getMmersModel'
// method just provides access to this inner model.
const ModelCanonical& modelMinimizer = model.getMmersModel();
// We compute the kmer for a given sequence
ModelMinimizer::Kmer kmer = model.codeSeed (seq, Data::ASCII);
std::cout << std::endl;
std::cout << "-------------------- MINIMIZER --------------------" << std::endl;
std::cout << "kmer value is: " << kmer.value() << std::endl;
std::cout << "kmer string is: " << model.toString(kmer.value()) << std::endl;
// With this model, we have extra information.
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;
// We can also have information about minimizers.
// Note : kmer.minimizer() is of type ModelCanonical, ie the type provided as
// template argument of the ModelMinimizer class.
std::cout << "minimizer model size : " << modelMinimizer.getKmerSize() << std::endl;
std::cout << "minimizer value is : " << kmer.minimizer().value() << std::endl;
std::cout << "minimizer string is : " << modelMinimizer.toString(kmer.minimizer().value()) << std::endl;
std::cout << "minimizer position in kmer : " << kmer.position() << std::endl;
std::cout << "minimizer changed : " << kmer.hasChanged() << std::endl;

Member Function Documentation

bool hasChanged ( ) const
inline

Tells whether the minimizer has changed; useful while iterating kmers

Returns
true if changed, false otherwise
const Model::Kmer& minimizer ( ) const
inline

Returns the minimizer of the current kmer as a Model::Kmer object

Returns
the Model::Kmer instance
int position ( ) const
inline

Returns the position of the minimizer within the kmer. By convention, a negative value means that there is no minimizer inside the kmer.

Returns
the position of the minimizer.

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