bpp-seq3
3.0.0
|
This is the base class to describe states in a NucleicAlphabet. More...
#include <Bpp/Seq/Alphabet/NucleicAlphabetState.h>
Public Member Functions | |
NucleicAlphabetState (int num, const std::string &letter, unsigned char code, const std::string &name) | |
virtual | ~NucleicAlphabetState () |
NucleicAlphabetState * | clone () const |
int | getBinaryCode () const |
Get the state's binary representation. More... | |
void | setBinaryCode (int code) |
Set the state's binary representation. More... | |
int | getNum () const |
Get the state's number. More... | |
void | setNum (int num) |
Set the state's number. More... | |
const std::string & | getLetter () const |
Get the letter(s) corresponding to the state. More... | |
void | setLetter (const std::string &letter) |
Set the letter(s) of the state. More... | |
const std::string & | getName () const |
Get the name of the state. More... | |
void | setName (const std::string &name) |
Set the name of the state. More... | |
bool | operator== (AlphabetState &l2) |
operator == More... | |
Private Attributes | |
int | binCode_ |
int | num_ |
std::string | letter_ |
std::string | name_ |
This is the base class to describe states in a NucleicAlphabet.
This class store a binary code for each state. This binary code is of length 4, one bit per nucleotid. For DNA alphabet, this code looks like this:
Letter | Binary code | int value |
---|---|---|
- | 0000 | 0 |
A | 0001 | 1 |
C | 0010 | 2 |
G | 0100 | 4 |
T | 1000 | 8 |
N | 1111 | 15 |
... | ||
M | 0011 | 3 |
W | 1001 | 9 |
... | ||
V | 0111 | 7 |
This notation allows the use of bitwize operations like:
The binary code is stored as a char because it's the smallest memory word that can be allocated. A char is 8 bits long allowing the use of this class with Alphabet of at least 8 resolved states (enough for known nucleic alphabets!).
Definition at line 52 of file NucleicAlphabetState.h.
|
inline |
Definition at line 58 of file NucleicAlphabetState.h.
Referenced by clone().
|
inlinevirtual |
Definition at line 62 of file NucleicAlphabetState.h.
|
inlinevirtual |
Reimplemented from bpp::AlphabetState.
Definition at line 65 of file NucleicAlphabetState.h.
References NucleicAlphabetState().
|
inline |
Get the state's binary representation.
Definition at line 74 of file NucleicAlphabetState.h.
References binCode_.
Referenced by bpp::DNA::getAlias(), bpp::RNA::getAlias(), bpp::DNA::isResolvedIn(), bpp::RNA::isResolvedIn(), and bpp::NucleicAlphabet::updateBinMaps_().
|
inlineinherited |
Get the letter(s) corresponding to the state.
The letter is a string because it may more than one char (for instance: codon).
Definition at line 63 of file AlphabetState.h.
References bpp::AlphabetState::letter_.
Referenced by bpp::CaseMaskedAlphabet::CaseMaskedAlphabet(), bpp::LexicalAlphabet::getAlphabetType(), bpp::AbstractAlphabet::getCharCodeAt(), bpp::RNY::intToChar(), bpp::LetterAlphabet::registerState(), bpp::LetterAlphabet::setState(), and bpp::AbstractAlphabet::updateMaps_().
|
inlineinherited |
Get the name of the state.
Definition at line 76 of file AlphabetState.h.
References bpp::AlphabetState::name_.
Referenced by bpp::CaseMaskedAlphabet::CaseMaskedAlphabet(), and bpp::WordAlphabet::getName().
|
inlineinherited |
Get the state's number.
Definition at line 47 of file AlphabetState.h.
References bpp::AlphabetState::num_.
Referenced by bpp::CaseMaskedAlphabet::CaseMaskedAlphabet(), bpp::AlphabetTools::checkAlphabetCodingSize(), bpp::AbstractAlphabet::getIntCodeAt(), bpp::NucleicAlphabet::getOverlap(), bpp::AlphabetState::operator==(), bpp::LetterAlphabet::registerState(), bpp::LetterAlphabet::setState(), bpp::NucleicAlphabet::subtract(), and bpp::AbstractAlphabet::updateMaps_().
|
inlineinherited |
operator ==
Comparison is done on state num
Definition at line 89 of file AlphabetState.h.
References bpp::AlphabetState::getNum().
|
inline |
Set the state's binary representation.
code | The state's binary representation. |
Definition at line 80 of file NucleicAlphabetState.h.
References binCode_.
|
inlineinherited |
Set the letter(s) of the state.
letter | The state's letter. |
Definition at line 69 of file AlphabetState.h.
References bpp::AlphabetState::letter_.
|
inlineinherited |
Set the name of the state.
name | The state's name |
Definition at line 82 of file AlphabetState.h.
References bpp::AlphabetState::name_.
|
inlineinherited |
Set the state's number.
num | The state's number. |
Definition at line 53 of file AlphabetState.h.
References bpp::AlphabetState::num_.
|
private |
Definition at line 55 of file NucleicAlphabetState.h.
Referenced by getBinaryCode(), and setBinaryCode().
|
privateinherited |
Definition at line 25 of file AlphabetState.h.
Referenced by bpp::AlphabetState::getLetter(), and bpp::AlphabetState::setLetter().
|
privateinherited |
Definition at line 26 of file AlphabetState.h.
Referenced by bpp::AlphabetState::getName(), and bpp::AlphabetState::setName().
|
privateinherited |
Definition at line 24 of file AlphabetState.h.
Referenced by bpp::AlphabetState::getNum(), and bpp::AlphabetState::setNum().