rna_transcription: iteration 1

This commit is contained in:
Dmitry Kokorin 2016-03-02 15:03:38 +03:00
parent 0658b6a066
commit 1e2dd2cf99
2 changed files with 37 additions and 0 deletions

View file

@ -0,0 +1,25 @@
#include "rna_transcription.h"
#include <algorithm>
#include <unordered_map>
namespace transcription {
using namespace std;
char to_rna(char c)
{
static const unordered_map<char, char> nucleotide_map =
{{'C', 'G'}, {'G', 'C'}, {'A', 'U'}, {'T', 'A'}};
return nucleotide_map.at(c);
}
string to_rna(string str)
{
transform(str.begin(), str.end(), str.begin(),
static_cast<char (*)(char)>(&to_rna));
return str;
}
}