Codon is translated into protein.
Because DNA strings are so long, you can not translate all the DNA strings into protein manually.
So I've set an c++ program function source.
Function argument (parameter) is a string which consists of 3 char of base.
If the length of string is more then 4, The first 3 DNA nodes are only translated into one Amino acid.
char translation(string input){
char RET;
switch(input[0]){
case 'A':
switch(input[1]){
case 'A'://AA
switch(input[2]){
case 'A':
case 'G':
RET='K';
break;
case 'C':
case 'T':
RET='N';
break;
}
break;
case 'C'://AC
switch(input[2]){
case 'A':
case 'G':
case 'C':
case 'T':
RET='T';
break;
}
break;
case 'G'://AG
switch(input[2]){
case 'A':
case 'G':
RET='R';
break;
case 'C':
case 'T':
RET='S';
break;
}
break;
case 'T'://AU
switch(input[2]){
case 'G':
RET='M';
break;
case 'A':
case 'C':
case 'T':
RET='I';
break;
}
}
/////////////////////
break;
case 'C':
switch(input[1]){
case 'A': //CA
;
switch(input[2]){
case 'A':
case 'G':
RET='Q';
break;
case 'C':
case 'T':
RET='H';
break;
}
break;
case 'C': //CC
switch(input[2]){
case 'A':
case 'C':
case 'G':
case 'T':
RET='P';
break;
}
break;
case 'G': //CG
switch(input[2]){
case 'A':
case 'C':
case 'G':
case 'T':
RET='R';
break;
}
break;
case 'T': //CU
switch(input[2]){
case 'A':
case 'C':
case 'G':
case 'T':
RET='L';
break;
}
}
break;
case 'G':
switch(input[1]){
case 'A': //GA
switch(input[2]){
case 'A':
case 'G':
RET='E';
break;
case 'C':
case 'T':
RET='D';
break;
}
break;
case 'G': //GG
switch(input[2]){
case 'A':
case 'G':
case 'C':
case 'T':
RET='G';
break;
}
break;
case 'C': //GC
switch(input[2]){
case 'A':
case 'G':
case 'C':
case 'T':
RET='A';
break;
}
break;
case 'T': //GU
switch(input[2]){
case 'A':
case 'G':
case 'C':
case 'T':
RET='V';
break;
}
break;
}
break;
case 'T':
switch(input[1]){
case 'A': //UA
switch(input[2]){
case 'A':
case 'G':
RET='0';
break;
case 'C':
case 'T':
RET='Y';
break;
}
break;
case 'G': //UG
switch(input[2]){
case 'A':
RET='0';
break;
case 'G':
RET='W';
break;
case 'C':
case 'T':
RET='C';
break;
}
break;
case 'C': //UC
switch(input[2]){
case 'A':
case 'G':
case 'C':
case 'T':
RET='S';
break;
}
break;
case 'T': //UU
switch(input[2]){
case 'A':
case 'G':
RET='L';
break;
case 'C':
case 'T':
RET='F';
break;
}
break;
}
}
return RET;
}
No comments:
Post a Comment