Question
You just got a position as a research assistant in Professor Threon's lab. Your first task is to write a program that finds locations of
You just got a position as a research assistant in Professor Threon's lab. Your first task is to write a program that finds locations of all the genes encoding Threonine.
To complete this task, you will need a DNA codon table. Your program needs to analyze the DNA strand and determine the locations of the triples that encode Threonine. Those triples are ACT, ACC, ACA, ACG.
Example:
Input DNA sequence: ATGACACGGAGTACGTAA
The locations of the triples encoding Threonine are: 3 (ACA) and 12 (ACG). Notice that the location 5 is not an answer, since every triple has to start on a multiple of three index (otherwise triples would overlap).
Error handling and output:
If the program is given an invalid strand (i.e., one that contains characters other that A, T, C, and G), it should print -1 and terminate.
If the program is given a valid strand that does not contain even one triple, the program should print -2 and terminate.
If the program is given a valid strand that contains one or more triples, it should print the indexes of the first character of the triple, one per line. In the above example, the output should be: 3 12
Note: You should assume that the input sequence is all in uppercase. You can treat any lowercase letters as invalid characters. The maximum length of the sequence that your program needs to handle is 9,999.
HINT: You might find the functions provided by the string library useful for solving this problem. You can learn more about them by reading the man page for string.h header file:
man string.h
Please use C to solve this
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started