43 if (exclamationMarkCountsAsGap)
53 if (!isIntInAlphabet(state1))
54 throw BadIntException(state1,
"RNA::isResolvedIn(int, int): Specified base unknown.",
this);
56 if (!isIntInAlphabet(state2))
57 throw BadIntException(state2,
"RNA::isResolvedIn(int, int): Specified base unknown.",
this);
59 if (isUnresolved(state2))
60 throw BadIntException(state2,
"RNA::isResolvedIn(int, int): Unresolved base.",
this);
78 throw BadIntException(state2,
"RNA::isResolvedIn : this should not happen",
this);
86 if (!isIntInAlphabet(state))
87 throw BadIntException(state,
"RNA::getAlias(int): Specified base unknown.",
this);
109 if (!isCharInAlphabet(locstate))
110 throw BadCharException(locstate,
"RNA::getAlias(int): Specified base unknown.",
this);
111 vector<int> vi = this->getAlias(this->charToInt(state));
113 for (
unsigned int i = 0; i < vi.size(); i++)
115 v.push_back(this->intToChar(vi[i]));
125 for (
size_t i = 0; i < states.size(); ++i)
127 if (!isIntInAlphabet(states[i]))
128 throw BadIntException(states[i],
"RNA::getGeneric(const vector<int>& states): Specified base unknown.",
this);
129 v |= getState(states[i]).getBinaryCode();
131 return getStateByBinCode(v).getNum();
139 for (
unsigned int i = 0; i < states.size(); ++i)
141 if (!isCharInAlphabet(states[i]))
142 throw BadCharException(states[i],
"DNA::getGeneric(const vector<string>& states): Specified base unknown.",
this);
143 vi.push_back(this->charToInt(states[i]));
145 return intToChar(getGeneric(vi));
An alphabet exception thrown when trying to specify a bad char to the alphabet.
An alphabet exception thrown when trying to specify a bad int to the alphabet.
This is the base class to describe states in a NucleicAlphabet.
int getBinaryCode() const
Get the state's binary representation.
int getGeneric(const std::vector< int > &states) const
Get the generic state that match a set of states.
bool isResolvedIn(int state1, int state2) const
Tells if a given (potentially unresolved) state can be resolved in another resolved state.
std::vector< int > getAlias(int state) const
Get all resolved states that match a generic state.
RNA(bool exclamationMarkCountsAsGap=false)
std::string toUpper(const std::string &s)
This alphabet is used to deal NumericAlphabet.