From: Dariusz Murakowski Date: Fri, 24 Apr 2015 08:03:35 +0000 (-0400) Subject: Map the nt enum to and from character representation. X-Git-Url: http://src.murakowski.org/?a=commitdiff_plain;h=00c24a0229699dc09a735e8d2868c8fb75a59918;p=VirEvoDyn.git Map the nt enum to and from character representation. --- diff --git a/seqTools.cpp b/seqTools.cpp index 1d86b21..97ec730 100644 --- a/seqTools.cpp +++ b/seqTools.cpp @@ -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. diff --git a/seqTools.h b/seqTools.h index 0b475cb..05514ef 100644 --- a/seqTools.h +++ b/seqTools.h @@ -32,6 +32,8 @@ typedef std::unordered_map aa2str_map; typedef std::unordered_map str2aa_map; typedef std::unordered_map codon2str_map; typedef std::unordered_map str2codon_map; +typedef std::unordered_map nt2str_map; +typedef std::unordered_map str2nt_map; namespace std { template<> struct hash { @@ -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