The sequential converter program
THe sequential converter program..
#include< iostream >
#include < string >
using namespace std;
int main()
{
// Key for converting DNA sequence to amino acid sequence.
// string codons[64] = { "UUU","UUC","UUA","UUG","UCU","UCC","UCA","UCG","UAU","UAC","UAA","UAG","UGU","UGC","UGA","UGG",
//"CUU","CUC","CUA","CUG","CCU","CCC","CCA","CCG","CAU","CAC","CAA","CAG","CGU","CGC","CGA","CGG",
//"AUU","AUC","AUA","AUG","ACU","ACC","ACA","ACG","AAU","AAC","AAA","AAG","AGU","AGC","AGA","AGG",
//"GUU","GUC","GUA","GUG","GCU","GCC","GCA","GCG","GAU","GAC","GAA","GAG","GGU","GGC","GGA","GGG" };
// string aminoAcids[64] = { "Phe(F)","Phe(F)","Leu(L)","Leu(L)", "Ser(S)","Ser(S)","Ser(S)","Ser(S)","Tyr(Y)","Tyr(Y)", "Stop()","Stop()", "Cys(C)","Cys(C)","Stop(*)", "Trp(W)",
// "Leu(L)","Leu(L)","Leu(L)","Leu(L)","Pro(P)","Pro(P)","Pro(P)","Pro(P)","His(H)","His(H)","Gln(Q)","Gln(Q)","Arg(R)","Arg(R)","Arg(R)","Arg(R)",
//"Ile(I)","Ile(I)","Ile(I)","Met(M)","Thr(T)","Thr(T)","Thr(T)","Thr(T)","Asn(N)","Asn(N)","Lys(K)","Lys(K)","Ser(S)","Ser(S)","Arg(R)","Arg(R)",
//"Val(V)","Val(V)","Val(V)","Val(V)","Ala(A)","Ala(A)","Ala(A)","Ala(A)","Asp(D)","Asp(D)","Glu(E)","Glu(E)","Gly(G)","Gly(G)","Gly(G)","Gly(G)" };
// Variable declaration.
string DNA_string;
string AA_string1[100];
string AA_string3[100];
// User inputs DNA sequence.
cout << "Enter DNA sequence here: " << endl;
cin >> DNA_string;
cout << "\n";
// Preparing for sequence conversion.
int dnaLength = DNA_string.length();
int numberofCodons = dnaLength / 3;
int i = 0;
int j = 0;
int baseError;
string baseCorrect;
bool isCorrect = 0;
// Enters codons into the amino acid string array.
j = 0;
while (j <= numberofCodons)
{
for (i = 0; i < dnaLength - 3; i += 3)
{
AA_string1[j] = DNA_string.substr(i, 3);
j += 1;
}
}
cout<<"----------------------------------------------"<<endl;
for (i = 0; i <= numberofCodons; i++)
{
cout << AA_string1[i] << " ";
}
cout<<"----------------------------------------------"<<endl;
// Displays the DNA sequence as sets of codons.
for (i = 0; i <= numberofCodons; i++)
{
// cout << AA_string1[i] << " ";
// Indicates base position.
// if ((i + 1) % 10 == 0)
// {
// cout << ((i + 1) * 3) << " "<<endl;
// Switch Statment start
if(AA_string1[i]=="TTC" || AA_string1[i]=="TTT")
{
cout<<"F";
}
else if(AA_string1[i]=="TCA" || AA_string1[i]=="TCC" || AA_string1[i]=="TCG" || AA_string1[i]=="TCT" || AA_string1[i]=="AGT" || AA_string1[i]=="AGC"){
cout<<"S";
}
else if(AA_string1[i]=="TTA" || AA_string1[i]=="TTG"){
cout<<"L";
}
else if(AA_string1[i]=="TAC" || AA_string1[i]=="TAT"){
cout<<"Y";
}
else if(AA_string1[i]=="TAA" || AA_string1[i]=="TAG" || AA_string1[i]=="TGA"){
cout<<"_";
}
else if(AA_string1[i]=="TGC" || AA_string1[i]=="TGT"){
cout<<"C";
}
else if(AA_string1[i]=="TGG"){
cout<<"W";
}
else if(AA_string1[i]=="CTA" || AA_string1[i]=="CTC" || AA_string1[i]=="CTG" || AA_string1[i]=="CTT"){
cout<<"L";
}
else if(AA_string1[i]=="CCA" || AA_string1[i]=="CCC" || AA_string1[i]=="CCG" || AA_string1[i]=="CCT"){
cout<<"P";
}
else if(AA_string1[i]=="CAC" || AA_string1[i]=="CAT"){
cout<<"H";
}
else if(AA_string1[i]=="CAA" || AA_string1[i]=="CAG"){
cout<<"Q";
}
else if(AA_string1[i]=="CGA" || AA_string1[i]=="CGC" || AA_string1[i]=="CGG" || AA_string1[i]=="CGT"){
cout<<"R";
}
else if(AA_string1[i]=="ATA" || AA_string1[i]=="ATC" || AA_string1[i]=="ATT"){
cout<<"I";
}
else if(AA_string1[i]=="ATG"){
cout<<"M";
}
else if(AA_string1[i]=="ACA" || AA_string1[i]=="ACC" || AA_string1[i]=="ACG" || AA_string1[i]=="ACT"){
cout<<"T";
}
else if(AA_string1[i]=="AAC" || AA_string1[i]=="AAT"){
cout<<"N";
}
else if(AA_string1[i]=="AAA" || AA_string1[i]=="AAG"){
cout<<"K";
}
else if(AA_string1[i]=="AGA" || AA_string1[i]=="AGG"){
cout<<"R";
}
else if(AA_string1[i]=="GTA" || AA_string1[i]=="GTC" || AA_string1[i]=="GTG" || AA_string1[i]=="GTT"){
cout<<"V";
}
else if(AA_string1[i]=="GCA" || AA_string1[i]=="GCC" || AA_string1[i]=="GCG" || AA_string1[i]=="GCT"){
cout<<"A";
}
else if(AA_string1[i]=="GAC" || AA_string1[i]=="GAT"){
cout<<"D";
}
else if(AA_string1[i]=="GAA" || AA_string1[i]=="GAG"){
cout<<"E";
}
else if(AA_string1[i]=="GGA" || AA_string1[i]=="GGC" || AA_string1[i]=="GGG" || AA_string1[i]=="GGT"){
cout<<"G";
}
else{
cout<<"/n";
cout<<"You Have Enter Invalid Sequence";
}
// Switch Statment End
// }
}
}
I learn some coding from your post thanks for sharing
thanks for visiting my post my freind
yea we do
great post
Thanks for visiting
My friend
I am proud of you and I hope we will build team with one missiin one goal
Your work inspires all of us
Thanks for your nice words @flysky sure we will work together and we will win together. thanks for visiting my post.
You should review the formatting.