45 #include <Bpp/Text/TextTools.h> 46 #include <Bpp/Utils/MapTools.h> 81 if (exclamationMarkCountsAsGap)
91 if (!isIntInAlphabet(state))
92 throw BadIntException(state,
"DNA::getAlias(int): Specified base unknown.");
113 string locstate = TextTools::toUpper(state);
114 if(!isCharInAlphabet(locstate))
throw BadCharException(locstate,
"DNA::getAlias(int): Specified base unknown.");
115 vector<int> vi = this->getAlias(this->charToInt(state));
117 for (
unsigned int i = 0 ; i < vi.size() ; i++)
118 v.push_back(this->intToChar(vi[i]));
127 for (
size_t i = 0 ; i < states.size() ; ++i) {
128 if (!isIntInAlphabet(states[i]))
throw BadIntException(states[i],
"DNA::getGeneric(const vector<int>& states): Specified base unknown.");
129 v |= getState(states[i]).getBinaryCode();
131 return getStateByBinCode(v).getNum();
139 for (
unsigned int i = 0 ; i < states.size() ; ++i) {
140 if (!isCharInAlphabet(states[i]))
throw BadCharException(states[i],
"DNA::getGeneric(const vector<string>& states): Specified base unknown.");
141 vi.push_back(this->charToInt(states[i]));
143 return intToChar(getGeneric(vi));
DNA(bool exclamationMarkCountsAsGap=false)
An alphabet exception thrown when trying to specify a bad char to the alphabet.
int getGeneric(const std::vector< int > &states) const
Get the generic state that match a set of states.
This alphabet is used to deal NumericAlphabet.
int getBinaryCode() const
Get the state's binary representation.
This is the base class to describe states in a NucleicAlphabet.
An alphabet exception thrown when trying to specify a bad int to the alphabet.
std::vector< int > getAlias(int state) const
Get all resolved states that match a generic state.