Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Part 1 : dna analysis.c main: You will write a main function which takes in a DNA sequence from the user, represented as a string
Part : dna analysis.c main:
You will write a main function which takes in a DNA sequence from the user, represented as a string of characters A T C and G and assigns it to a char array. The main function will validate that the string only contains valid DNA characters. If the string contains any character other than A T C or G your program will prompt the user to try again. The user is given up to tries to enter a correct DNA sequence. If all attempts are invalid, the program exits:
Please enter your DNA sequence: ATGCATC
Invalid input, try again...
Please enter your DNA sequence: ATZCTG
Invalid input, try again...
Please enter your DNA sequence: GTCTGAAA
Invalid input again. Exiting...
Once a correct DNA sequence is received, the main function then calls the dnaanalysis function see below and passes it the correct char array of DNA sequence it collected from the user, so that the dnaanalysis function can assume that it only contains valid DNA characters without needing to do any validating. dnaanalysis char inputI:
You will write a void return function called dnaanalysis which takes in a char array representing a DNA sequence. The function will analyze the sequence and print out the count of each nucleotide A T C G in the sequence, along with the total length of the sequence.
Example:
Please enter your DNA sequence: ATGCTAGC
Length of sequence:
A count:
I count:
C count:
Gcount:Part : Complementing DNA Sequences dnacomplement char inputil:
You will extend your code to include a function called dnacomplement which takes in a DNA sequence represented as a char array and computes its complement. The complement of a DNA sequence is obtained by replacing each nucleotide with its complement: A with T T with A C with G and G with C The function should print the complemented DNA sequence, not return it This function is also a void retum function.
Example:
Please enter your DNA sequence: ATGCTAGC
Complement of the sequence: TACGATCG
Part : Testing
Provide a testing document that tests all functions: main dnaanalysis, and dnacomplement.
Example Test Cases Table You are welcome to use this format:
Function input
Expected Result
Actual result
PassFail
if expected value and actual result is the same, the test is a pass.
main ATGCXATCG
and nd
tries
Invalid input, try again...
Invalid input, try again...
Pass
main ATGCXATC
try
Bad input again.
Exiting...
Invalid input, try again..
Fail
dnasequence
ATGCTAGC
Length of sequence:
T
count:
C
count:
count:
G count:
Length of sequence:
count:
T
count: count:
G
count t
Pass
dnacomplement
ATGCTAGC
TACGATCG
TACGATCG
Pass
When choosing test cases, think about what combinations a user may put in and also think about edge cases.
If your program doesn't pass a test, record this correctly in the PassFail column. You will notlose marks for testcase portion if it is recorded properly. You would only lose marks for not testing a case.
Be sure to test the main function as well as the dnaanalysis and dnacomplementfunctions Other notes:
Use scanf to read in the user input.
You are free to implement other helper functions if you choose to but this is not necessary
Do not use global variables! This is a rule for life, not just for this assignment :
Your submission should include dna.c and a testcases.pdf file in an assigl.zip file.
Your code should be well commented, and consistent see posted style guide
Do not use pointers! We haven't covered them, and they are not necessary. You will lose marks if you use pointers.
Do not include stdbool.h You can use s and s for True and False.
Do not use switch statements.
Note: Programs that do not compile will receive a grade of on the code.
Also, if you do not comply with the bolded notes above, you will receive a grade of
Compile like this: $ gcc Wall pedantic stdc dna.c o dna
Rubric Breakdown of marks :
Part
main attempts dnaanalysis
appropriate commenting say what your code does
file named dna.c
Part
dnacomplement
appropriatecommenting
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