47 nuc1_(nuc1), nuc2_(nuc2), trans_()
72 nuc1_->intToChar(state);
78 int i = nuc1_->charToInt(state);
79 return nuc2_->intToChar(trans_[i]);
84 if (sequence.getAlphabet()->getAlphabetType() != getSourceAlphabet()->getAlphabetType())
87 for (
unsigned int i = 0; i < sequence.size(); i++)
89 tSeq->
addElement(translate(sequence.getValue(i)));
98 nuc2_->intToChar(state);
104 int i = nuc2_->charToInt(state);
105 return nuc1_->intToChar(trans_[i]);
110 if (sequence.getAlphabet()->getAlphabetType() != getTargetAlphabet()->getAlphabetType())
113 for (
unsigned int i = 0; i < sequence.size(); i++)
115 rSeq->
addElement(reverse(sequence.getValue(i)));
std::map< int, int > trans_
An alphabet exception thrown when trying to specify a bad char to the alphabet.
This alphabet is used to deal NumericAlphabet.
int translate(int state) const
Translate a given state coded as a int from source alphabet to target alphabet.
int reverse(int state) const
Translate a given state coded as a int from target alphabet to source alphabet.
virtual void addElement(const std::string &c)
Add a character to the end of the list.
A basic implementation of the Sequence interface.
An alphabet exception thrown when trying to specify a bad int to the alphabet.
Exception thrown when two alphabets do not match.
NucleicAcidsReplication(const NucleicAlphabet *nuc1, const NucleicAlphabet *nuc2)
The abstract base class for nucleic alphabets.