bpp-seq3  3.0.0
DNAToRNA.cpp
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: The Bio++ Development Group
2 //
3 // SPDX-License-Identifier: CECILL-2.1
4 
5 #include "DNAToRNA.h"
6 
7 using namespace bpp;
8 using namespace std;
9 
10 /******************************************************************************/
11 
12 int DNAToRNA::translate(int state) const
13 {
14  dna_->intToChar(state);
15  return state;
16 }
17 
18 /******************************************************************************/
19 
20 string DNAToRNA::translate(const std::string& state) const
21 {
22  int i = dna_->charToInt(state);
23  return rna_->intToChar(i);
24 }
25 
26 /******************************************************************************/
27 
28 int DNAToRNA::reverse(int state) const
29 {
30  rna_->intToChar(state);
31  return state;
32 }
33 
34 /******************************************************************************/
35 
36 string DNAToRNA::reverse(const std::string& state) const
37 {
38  int i = rna_->charToInt(state);
39  return dna_->intToChar(i);
40 }
41 
42 /******************************************************************************/
int reverse(int state) const override
Translate a given state coded as a int from target alphabet to source alphabet.
Definition: DNAToRNA.cpp:28
int translate(int state) const override
Translate a given state coded as a int from source alphabet to target alphabet.
Definition: DNAToRNA.cpp:12
This alphabet is used to deal NumericAlphabet.