高手进来帮我改下程序,使其实现DNA的转录和翻译
#include <stdio.h>#include <stdlib.h>
#include <string.h>
int main(void)
{
char userDna[100];//用户输入的DNA序列
char oppsitDna[100];//对应的DNA序列
char mRna[100];//生成的mRNA序列
int i;
int length;//字符串的实际长度
int end;//小于等于字符串长度的3的最大倍数
enum Dtype{U = 0, C = 1, A = 2, G = 3, T = 4};
char TypeNames[5]={'U','C','A','G','T'}; //mark
int codeTable[4][4][4] = {
{{13,13,10,10},{15,15,15,15},{18,18,20,20},{4,4,20,17}}, //Uline
{{10,10,10,10},{14,14,14,14},{8,8,5,5},{1,1,1,1}}, //Cline
{{9,9,9,12},{16,16,16,16},{2,2,11,11},{15,15,1,1}}, //Aline
{{19,19,19,19},{0,0,0,0},{3,3,6,6},{7,7,7,7}} //Gline
};
char nameTable[21][9] = {"丙氨酸", "精氨酸", "天冬酰胺", "天冬氨酸", "半胱氨酸",
"谷氨酰胺", "谷氨酸", "甘氨酸", "组氨酸","异亮氨酸",
"亮氨酸", "赖氨酸", "甲硫氨酸", "苯丙氨酸", "脯氨酸",
"丝氨酸", "苏氨酸", "色氨酸", "酪氨酸", "缬氨酸", "终止" };
printf("请输入DNA单链序列:\n");
scanf("%s",userDna);
length = strlen(userDna);
printf("输入的DNA序列为: -");
for(i = 0; i < length; i++)
{ printf("%c", userDna[i]);
printf("-");
}
printf("\n\n");
for(i = 0;i < length; i++)
{ switch(userDna[i])
{
case 'A':oppsitDna[i] = T;
mRna[i] = U;
break;
case 'T':oppsitDna[i] = A;
mRna[i] = A;
break;
case 'C':oppsitDna[i] = G;
mRna[i] = G;
break;
case 'G':oppsitDna[i] = C;
mRna[i] = C;
break;
default:break;
}
}
printf("对应的DNA单链为: -");
for(i = 0; i < length; i++)
{
printf("%c", oppsitDna[TypeNames[i]]); //mark
printf("-");
}
printf("\n\n");
printf("转录生成mRNA为: -");
for(i = 0; i < length; i++)
{
printf("%c", mRna[TypeNames[i]]); //mark
printf("-");
}
printf("\n\n");
printf("翻译合成的蛋白质的氨基酸序列为: \n\n-");
end = length / 3 * 3;
for(i = 0;i != end;i += 3)
{
printf("%s", nameTable[codeTable[mRna[i]][mRna[i + 1]][mRna[i + 2]]]);
}
return 0;
}