Public Member Functions | Protected Attributes

MGT::AbcConvCharToInt Class Reference

Alphabet convertor from one-letter character to integer index. More...

#include <kmers.hpp>

List of all members.

Public Member Functions

 AbcConvCharToInt (const std::string &abc, const std::string &abcRevCompl)
 A constructor.
INuc operator() (CNuc c) const
 Convert character code to integer code.
INuc toINuc (CNuc c) const
 Convert character code to integer code.
CNuc toCNuc (INuc i) const
 Convert integer code to character code.
int nAbc () const
 Return size of non-degenerate character alphabet.
int nCodes () const
 Return number of integer codes (with degenerate code).
INuc revCompl (INuc i) const
 Convert integer index of a nucleotide into integer index of a reverse-complement nucleotide.

Protected Attributes

CNuc m_CNucToINuc [g_maxCNuc]
 If abc is 'ACTG', then m_CNucToINuc['A'] => 1, m_CNucToINuc['C'] => 2 and so on.
std::string m_abcExt
 Extended alphabet, e.g.
int m_nAbc
 number of "real" alphabet symbols
int m_nCodes
 total number of encoded alphabet symbols (m_nAbc + 1)
INuc m_iNucRevCompl [g_maxINuc]
 maps INuc index into reverse-complement INuc index.

Detailed Description

Alphabet convertor from one-letter character to integer index.


Constructor & Destructor Documentation

MGT::AbcConvCharToInt::AbcConvCharToInt ( const std::string &  abc,
const std::string &  abcRevCompl 
)

A constructor.

Parameters:
abc- a sequence of allowed non-degenerate character alphabet symbols (such as ACGT), anything else that will be seen in the future sequence input will be treated as degenerate symbols, equal to each other. The index representation of degenerates is always 0.
abcRevCompl- a sequence of reverse-complement symbols for each element of abc (such as TGCA).

Member Function Documentation

int MGT::AbcConvCharToInt::nCodes (  ) const [inline]

Return number of integer codes (with degenerate code).

INuc MGT::AbcConvCharToInt::operator() ( CNuc  c ) const [inline]

Convert character code to integer code.

INuc MGT::AbcConvCharToInt::revCompl ( INuc  i ) const [inline]

Convert integer index of a nucleotide into integer index of a reverse-complement nucleotide.

Parameters:
i- integer index of a nucleotide. Must be in the valid range [0,g_maxINuc]. Degenerate entry is converted into degenerate.
CNuc MGT::AbcConvCharToInt::toCNuc ( INuc  i ) const [inline]

Convert integer code to character code.

INuc MGT::AbcConvCharToInt::toINuc ( CNuc  c ) const [inline]

Convert character code to integer code.


Member Data Documentation

std::string MGT::AbcConvCharToInt::m_abcExt [protected]

Extended alphabet, e.g.

  • 'NACGT'
CNuc MGT::AbcConvCharToInt::m_CNucToINuc[g_maxCNuc] [protected]

If abc is 'ACTG', then m_CNucToINuc['A'] => 1, m_CNucToINuc['C'] => 2 and so on.

0 is reserved for 'N'

INuc MGT::AbcConvCharToInt::m_iNucRevCompl[g_maxINuc] [protected]

maps INuc index into reverse-complement INuc index.


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