ppALIGN API documentation
Alphabet Class Reference
#include <alphabet.hpp>
Classes | |
| class | InvalidCharacter |
| class | InvalidCharacterCode |
| class | MatchError |
Public Member Functions | |
| size_t | Size () const |
| size_t | BaseSize () const |
| const int & | Gap () const |
| const char & | GapChar () const |
| const int & | Encode (const char &ch) const |
| const int & | ValidEncode (const char &ch) const |
| const char & | Decode (const int &i) const |
| const char & | Decode (const unsigned int &i) const |
| const char & | Decode (const long &i) const |
| const char & | Decode (const unsigned long &i) const |
| const std::set< int > & | IupacSet (int i) const |
| virtual const char * | Name () const =0 |
| bool | Probe (int letter, int mask) const |
Static Public Member Functions | |
| static Alphabet & | GetAlphabet (const std::string &str) |
| static void | Match (const Alphabet &a, const Alphabet &b) |
Protected Member Functions | |
| Alphabet (size_t base_size, const char *str) | |
Protected Attributes | |
| size_t | n_basic_letters |
| std::map< char, int > | letterToInt |
| std::vector< char > | intToLetter |
| std::vector< std::set< int > > | intToSet |
Friends | |
| class | Encoder |
Detailed Description
A base class for alphabets.
Definition at line 51 of file alphabet.hpp.
Constructor & Destructor Documentation
| Alphabet::Alphabet | ( | size_t | base_size, | |
| const char * | str | |||
| ) | [protected] |
allocate the memory of all vectors and setup the default non-UIPAC encoded letters
Member Function Documentation
| size_t Alphabet::BaseSize | ( | ) | const [inline] |
Size of the basic alphabet. This is 4 in the case of DNA.
Definition at line 135 of file alphabet.hpp.
| const char& Alphabet::Decode | ( | const int & | i | ) | const [inline] |
convert a letter code to character
Definition at line 158 of file alphabet.hpp.
| const int& Alphabet::Encode | ( | const char & | ch | ) | const [inline] |
convert a character to letter code without validating (i.e. it is faster than ValidEncode(char c))
Definition at line 146 of file alphabet.hpp.
| const int& Alphabet::Gap | ( | ) | const [inline] |
code for gap symbol
- Returns:
- code for the gap symbol of the alphabet
Definition at line 140 of file alphabet.hpp.
| static Alphabet& Alphabet::GetAlphabet | ( | const std::string & | str | ) | [static] |
returns a reference to the dna or protein alphabet
- Parameters:
-
if dna or nucl return dnaAlphabet, if protein or aa return proteinAlphabet
| const std::set<int>& Alphabet::IupacSet | ( | int | i | ) | const [inline] |
The set of basic letters for the UIPAC extension. A set of size one is returned if the letter code is from the basic alphabet. Otherwise the UIPAC set is returned, for example if A->0, C->1, G->2, T->3, and R=(A or G) and R->4, then IntToSet(0)-> {0} and IntToSet(4)-> {0,2}.
Definition at line 174 of file alphabet.hpp.
| bool Alphabet::Probe | ( | int | letter, | |
| int | mask | |||
| ) | const |
Probe whether the type of the letter
- See also:
- Sequence::operator/= and Sequence::operatpr /
- Parameters:
-
mask or'ed combination of SubAlphabetMask letter encoded character
- Returns:
- true if Letter matches the mask.
| size_t Alphabet::Size | ( | ) | const [inline] |
Size of the complete alphabet. including the UIPAC extension and the gap symbol
Definition at line 129 of file alphabet.hpp.
Member Data Documentation
std::vector<char> Alphabet::intToLetter [protected] |
lookuptable for conversion from an encoded letter to the original one. Entries 0 ... (n_basic_letter-1) are letters from the basic alphabet, i.e. AGCT for the DNA alphabet.
Definition at line 81 of file alphabet.hpp.
std::vector<std::set<int> > Alphabet::intToSet [protected] |
lookuptable for ecoded IUPAC letters to a set of letters from the basic alphabet.
Definition at line 86 of file alphabet.hpp.
std::map<char,int> Alphabet::letterToInt [protected] |
lookuptable for conversions from a letter to the encoded int value.
Definition at line 74 of file alphabet.hpp.
size_t Alphabet::n_basic_letters [protected] |
number of letters in the basic alphabet (without gap-symbol and UIPAC extensions. (4 in the case of the DNA alphabet).
Definition at line 69 of file alphabet.hpp.
The documentation for this class was generated from the following file:
- src/alphabet.hpp