Map the nt enum to and from character representation.
authorDariusz Murakowski <murakdar@mit.edu>
Fri, 24 Apr 2015 08:03:35 +0000 (04:03 -0400)
committerDariusz Murakowski <murakdar@mit.edu>
Fri, 24 Apr 2015 08:03:35 +0000 (04:03 -0400)
seqTools.cpp
seqTools.h

index 1d86b21..97ec730 100644 (file)
@@ -95,6 +95,14 @@ const str2codon_map str2codon = {
     {"GGT", cod_GGT}, {"GGC", cod_GGC}, {"GGA", cod_GGA}, {"GGG", cod_GGG},
 };
 
+const nt2str_map nt2str = {
+    {nt_T,'T'}, {nt_C,'C'}, {nt_A,'A'}, {nt_G,'G'},
+};
+
+const str2nt_map str2nt = {
+    {'T',nt_T}, {'C',nt_C}, {'A',nt_A}, {'G',nt_G},
+};
+
 
 
 // Load each line of a *-seq2state.dat file into a vector of characters.
index 0b475cb..05514ef 100644 (file)
@@ -32,6 +32,8 @@ typedef std::unordered_map<aa,char> aa2str_map;
 typedef std::unordered_map<char,aa> str2aa_map;
 typedef std::unordered_map<codon,std::string> codon2str_map;
 typedef std::unordered_map<std::string,codon> str2codon_map;
+typedef std::unordered_map<nt,char> nt2str_map;
+typedef std::unordered_map<char,nt> str2nt_map;
 
 namespace std {
     template<> struct hash<aa> {
@@ -58,6 +60,8 @@ extern const aa2str_map aa2str;
 extern const str2aa_map str2aa;
 extern const codon2str_map codon2str;
 extern const str2codon_map str2codon;
+extern const nt2str_map nt2str;
+extern const str2nt_map str2nt;
 
 /*
 template <typename from, typename to>