Alphabet convertor from one-letter character to integer index. More...
#include <kmers.hpp>
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. |
Alphabet convertor from one-letter character to integer index.
MGT::AbcConvCharToInt::AbcConvCharToInt | ( | const std::string & | abc, |
const std::string & | abcRevCompl | ||
) |
A constructor.
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). |
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.
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.
std::string MGT::AbcConvCharToInt::m_abcExt [protected] |
Extended alphabet, e.g.
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.