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