DNA Programs

advertisement
Computer Programming I
DNA Programs
Program #1. Write a program to translate a DNA coding sequence from the user input
into a protein sequence.
Your program should read in an input of DNA coding sequence from the user and
translate it into a protein sequence. However, before you can translate the sequence, you
must test to see if it is a valid/complete coding sequence. If a DNA coding sequence does
not satisfy all the following three criteria, it is an incomplete/invalid coding sequence.
The three criteria are:
1) The length of the coding sequence is divisible by 3;
2) The coding sequence starts with a start codon (ATG);
3) The coding sequence ends with a stop codon (TAG, TAA or TGA).
If any of these three criteria are not met, an appropriate error message should be
displayed, and the program should stop trying to translate the input string.
Example Input #1: ATGAAAGGGATGTGA
Example Output #1:
DNA coding sequence: ATGAAAGGGATGTGA
Protein sequence: MKGM
Example Input #2: ATCAAAGGGATGTGA
Example Output #2:
Error: No start codon
Example Input #3: ATGAAAGGGATGTGA
Example Output #3:
Error: Incorrect number of bases
The table below will be useful in your translation:
1
Program #2. Genetic mutations occur when a DNA base changes. For example, an A
might get changed to a G. Sometimes this causes a problem because it creates a different
protein sequence, but sometimes the proteins created remain the same. Modify your
Program #1 so that it converts not only the string that is input by the user, but also 2
mutations described below.
Mutation #1: the second occurrence of the base A is changed to a G.
Mutation #2: the third occurrence of the base G is changed to a C.
After all three sequences are converted and displayed, indicate which, if either, of the
mutations resulted in a different protein sequence.
2
Download