42 #ifndef _NUCLEICALPHABET_H_ 43 #define _NUCLEICALPHABET_H_ 83 #ifndef NO_VIRTUAL_COV 97 throw Exception(
"NucleicAlphabet::registerState. Incorrect alphabet type.");
105 throw Exception(
"NucleicAlphabet::setState. Incorrect alphabet type.");
118 throw (IndexOutOfBoundsException) {
124 throw (IndexOutOfBoundsException) {
158 std::map<int, size_t>::const_iterator it =
binCodes_.find(code);
160 throw BadIntException(code,
"NucleicAlphabet::getState(unsigned char): Binary code not in alphabet",
this);
280 #endif // _NUCLEICALPHABET_H_ LetterAlphabet & operator=(const LetterAlphabet &bia)
This is the base class to describe states in an Alphabet.
int getUnknownCharacterCode() const
An alphabet exception thrown when trying to specify a bad char to the alphabet.
void updateBinMaps_(size_t pos, const NucleicAlphabetState &st)
NucleicAlphabet & operator=(const NucleicAlphabet &bia)
bool isUnresolved(const std::string &state) const
int getNum() const
Get the state's number.
unsigned int getNumberOfTypes() const
Get the number of distinct states in alphabet (e.g. return 15 for DNA alphabet). This is the number o...
This alphabet is used to deal NumericAlphabet.
int getBinaryCode() const
Get the state's binary representation.
const NucleicAlphabetState & getStateAt(size_t stateIndex) const
Get a state at a position in the alphabet_ vector.
virtual NucleicAlphabet * clone() const =0
void registerState(AlphabetState *st)
Add a state to the Alphabet.
std::string subtract(const std::string &s1, const std::string &s2) const
Subtract states.
Specialized partial implementation of Alphabet using single letters.
void setState(size_t pos, AlphabetState *st)
Set a state in the Alphabet.
const AlphabetState & getState(const std::string &letter) const
Get a state by its letter.
NucleicAlphabetState & getStateAt(size_t stateIndex)
Get a state at a position in the alphabet_ vector.
std::string getOverlap(const std::string &s1, const std::string &s2) const
Get the overlap between to states.
void registerState(AlphabetState *st)
Add a state to the Alphabet.
bool isUnresolved(int state) const
NucleicAlphabet(const NucleicAlphabet &bia)
unsigned int getSize() const
Get the number of resolved states in the alphabet (e.g. return 4 for DNA alphabet). This is the method you'll need in most cases.
This is the base class to describe states in a NucleicAlphabet.
std::map< int, size_t > binCodes_
int subtract(int s1, int s2) const
Subtract states.
void setState(size_t pos, AlphabetState *st)
Set a state in the Alphabet.
int getOverlap(int s1, int s2) const
Get the overlap between to states.
const NucleicAlphabetState & getState(const std::string &letter) const
Get a state by its letter.
virtual ~NucleicAlphabet()
An alphabet exception thrown when trying to specify a bad int to the alphabet.
virtual AlphabetState & getStateAt(size_t stateIndex)
Get a state at a position in the alphabet_ vector.
const NucleicAlphabetState & getStateByBinCode(int code) const
Get a state by its binary representation.
const NucleicAlphabetState & getState(int num) const
Get a state by its num.
The abstract base class for nucleic alphabets.
std::string intToChar(int state) const
Give the string description of a state given its int description.
unsigned int getNumberOfChars() const
Get the number of supported characters in this alphabet, including generic characters (e...
int charToInt(const std::string &state) const
Give the int description of a state given its string description.