I am trying to make a program that can take Template DNA and show the amino acid sequence that is formed after transcription and translation
It works, but only for 3 bases. I would like it to work for as many bases as possible.
This is what I have:
What I have tried:
#include <iostream>
#include
#include <string>
using namespace std;
typedef std::map<std::string, std::string> TStrStrMap;
typedef std::pair<std::string, std::string> dnaTemplatePair;
int main(int argc, char *argv[])
{
TStrStrMap oMap;
oMap.insert(dnaTemplatePair("TTT", "Phe"));
oMap.insert(dnaTemplatePair("TTC", "Phe"));
oMap.insert(dnaTemplatePair("TTA", "Leu"));
oMap.insert(dnaTemplatePair("TTG", "Leu"));
oMap.insert(dnaTemplatePair("TCT", "Ser"));
oMap.insert(dnaTemplatePair("TCC", "Ser"));
oMap.insert(dnaTemplatePair("TCA", "Ser"));
oMap.insert(dnaTemplatePair("TCG", "Ser"));
oMap.insert(dnaTemplatePair("TAT", "Tyr"));
oMap.insert(dnaTemplatePair("TAC", "Tyr"));
oMap.insert(dnaTemplatePair("TAA", "STOP"));
oMap.insert(dnaTemplatePair("TAG", "STOP"));
oMap.insert(dnaTemplatePair("TGT", "Cys"));
oMap.insert(dnaTemplatePair("TGC", "Cys"));
oMap.insert(dnaTemplatePair("TGA", "STOP"));
oMap.insert(dnaTemplatePair("TGG", "Trp"));
oMap.insert(dnaTemplatePair("CTT", "Leu"));
oMap.insert(dnaTemplatePair("CTC", "Leu"));
oMap.insert(dnaTemplatePair("CTA", "Leu"));
oMap.insert(dnaTemplatePair("CTG", "Leu"));
oMap.insert(dnaTemplatePair("CCT", "Pro"));
oMap.insert(dnaTemplatePair("CCC", "Pro"));
oMap.insert(dnaTemplatePair("CCA", "Pro"));
oMap.insert(dnaTemplatePair("CCG", "Pro"));
oMap.insert(dnaTemplatePair("CAT", "His"));
oMap.insert(dnaTemplatePair("CAC", "His"));
oMap.insert(dnaTemplatePair("CAA", "Gln"));
oMap.insert(dnaTemplatePair("CAG", "Gln"));
oMap.insert(dnaTemplatePair("CGU", "Arg"));
oMap.insert(dnaTemplatePair("CGC", "Arg"));
oMap.insert(dnaTemplatePair("CGA", "Arg"));
oMap.insert(dnaTemplatePair("CGG", "Arg"));
oMap.insert(dnaTemplatePair("ATT", "Ile"));
oMap.insert(dnaTemplatePair("ATC", "Ile"));
oMap.insert(dnaTemplatePair("ATA", "Ile"));
oMap.insert(dnaTemplatePair("ATG", "Met"));
oMap.insert(dnaTemplatePair("ACT", "Thr"));
oMap.insert(dnaTemplatePair("ACC", "Thr"));
oMap.insert(dnaTemplatePair("ACA", "Thr"));
oMap.insert(dnaTemplatePair("ACG", "Thr"));
oMap.insert(dnaTemplatePair("AAT", "Asn"));
oMap.insert(dnaTemplatePair("AAC", "Asn"));
oMap.insert(dnaTemplatePair("AAA", "Lys"));
oMap.insert(dnaTemplatePair("AAG", "Lys"));
oMap.insert(dnaTemplatePair("AGT", "Ser"));
oMap.insert(dnaTemplatePair("AGC", "Ser"));
oMap.insert(dnaTemplatePair("AGA", "Arg"));
oMap.insert(dnaTemplatePair("AGG", "Arg"));
oMap.insert(dnaTemplatePair("GTT", "Val"));
oMap.insert(dnaTemplatePair("GTC", "Val"));
oMap.insert(dnaTemplatePair("GTA", "Val"));
oMap.insert(dnaTemplatePair("GTG", "Val"));
oMap.insert(dnaTemplatePair("GCT", "Ala"));
oMap.insert(dnaTemplatePair("GCC", "Ala"));
oMap.insert(dnaTemplatePair("GCA", "Ala"));
oMap.insert(dnaTemplatePair("GCG", "Ala"));
oMap.insert(dnaTemplatePair("GAT", "Asp"));
oMap.insert(dnaTemplatePair("GAC", "Asp"));
oMap.insert(dnaTemplatePair("GAA", "Glu"));
oMap.insert(dnaTemplatePair("GAG", "Glu"));
oMap.insert(dnaTemplatePair("GGT", "Gly"));
oMap.insert(dnaTemplatePair("GGC", "Gly"));
oMap.insert(dnaTemplatePair("GGA", "Gly"));
oMap.insert(dnaTemplatePair("GGG", "Gly"));
std::string dnaTemplate;
std:: cout << "Enter DNA Template: " << std::endl;;
std:: cin >> dnaTemplate;
std::string strValue = oMap[dnaTemplate];
if(strValue!="")
{
std::cout << "The Amino Acid Sequence will be: " << strValue << endl;
}
else
{
TStrStrMap::iterator p;
bool bFound=false;
for(p = oMap.begin(); p!=oMap.end(); ++p)
{
std::string strKey;
strValue = dnaTemplate;
strKey= p->second;
if( strValue == strKey)
{
std::cout << "The Amino Acid Sequence will be: " << p->first << std::endl;
bFound = true;
}
}
if(!bFound)
{
std::cout << "Look at your DNA Template again, and try again." << std::endl;
}
}
return 0;
}