Answered step by step
Verified Expert Solution
Link Copied!

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 1: 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 3 tries to enter a correct DNA sequence. If all 3 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 dna_analysis function (see below) and passes it the correct char array of DNA sequence it collected from the user, so that the dna_analysis function can assume that it only contains valid DNA characters without needing to do any validating. dna_analysis (char inputI:
You will write a void return function called dna_analysis 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: 8
A count: 2
I count: 2
C count:2
Gcount:2Part 2: Complementing DNA Sequences dna_complement (char inputil):
You will extend your code to include a function called dna_complement 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 3: Testing
Provide a testing document that tests all 3 functions: main, dna_analysis, and dna_complement.
Example Test Cases Table (You are welcome to use this format):
Function / input
Expected Result
Actual result
Pass/Fail
(if expected value and actual result is the same, the test is a pass.
main ()/ ATGCXATCG
(1* and 2nd
tries
Invalid input, try again...
Invalid input, try again...
Pass
main ()/ ATGCXATC
(3* try)
Bad input again.
Exiting...
Invalid input, try again..
Fail
dna_sequence ()
ATGCTAGC
/Length of sequence:
T
count:
2
C
count:
2
count: 2
G count:
2
Length of sequence:
8
count:
T
2
count: count:
G
2
count t
Pass
dna_complement
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 Pass/Fail 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 dna_analysis and dna_complementfunctions Other notes:
1. Use scanf() to read in the user input.
2. You are free to implement other helper functions if you choose to, but this is not necessary
3. Do not use global variables! This is a rule for life, not just for this assignment :-)
4.
5.
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).
6. Do not use pointers! We haven't covered them, and they are not necessary. You will lose marks if you use pointers.
7. Do not include stdbool.h. You can use 1's and 0's for True and False.
8. Do not use switch statements.
Note: Programs that do not compile will receive a grade of 0 on the code.
Also, if you do not comply with the bolded notes above, you will receive a grade of 0.
Compile like this: $ gcc -Wall -pedantic -std=c90 dna.c -o dna
Rubric (Breakdown of marks -40):
Part 1
main (3 attempts) dna_analysis
*appropriate commenting (say what your code does)
file named dna.c
15
4
5
5
2
Part 2
dna_complement
*appropriatecommenting

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database And Expert Systems Applications 19th International Conference Dexa 2008 Turin Italy September 2008 Proceedings Lncs 5181

Authors: Sourav S. Bhowmick ,Josef Kung ,Roland Wagner

2008th Edition

3540856536, 978-3540856535

More Books

Students also viewed these Databases questions