Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1. A DNA strand can be represented as a large string built with four character s

ID: 3639769 • Letter: 1

Question

1. A DNA strand can be represented as a large string built with four character symbols, namely A, T, G, and C. Each symbol represents an amino acid. The DNA has a double helix structure that consists of two such strands -- one is the compliment of the other. The symbols A and T are compliments of each other (these amino acids bind) -- similarly G and C are compliments of each other. A DNA strand is read in a particular direction. In the DNA the two complimentary strands are read in the opposite directions.

For example, the compliment of the DNA subsequence ATTTGCAATCCA is TGGATTGCAAAT. If we locate the compliment TGGATTGCAAAT in a given DNA strand, then we know that the original sequence ATTTGCAATCCA is present in the complimentary strand. When we search for a subsequence in a DNA, we can search only one of the strands, and use the compliment to determine whether the subsequence appears in the complimentary strand.

(a) Write a function:

DNAcompl( char x[20], char y[20], int n )

that finds the compliment of a DNA subsequence of length n in the string x and stores it in the string y.

(b) Write a program that does the following:

It reads a DNA subsequence, Z, of length at most 20.

It then uses the function DNAcompl( ) to find the compliment of the given subsequence.

It then reads a DNA sequence, Q, of arbitrary length terminated with the character X, and reports the
positions (indexes) from which the subsequence Z matches, either in the given strand, or in the complimentary strand.

(c) Write a function that takes a DNA subsequence as an argument and determines whether the subsequence is self complimentary. It returns 0 or 1.

(d) Use the function of part (c) in your main program to find self complimentary subsequences of length at most 10 in the DNA sequence, Q.


You have to submit one program only. It is advisable to do part (a), check whether it works, and then add part (b) into your program, check whether it works, and so on

Explanation / Answer

#include #include void DNAcompl(char x[21],char y[21],int n); main() { char Q[20],b[20],Z[20]; int k,i,j,c=0,m=0,n=0,o; printf(" Enter the DNA strand'Z'"); scanf("%s",Z); k=strlen(Z); printf(" "); DNAcompl(Z,b,k); printf(" Enter the Q dna strand"); scanf("%s",Q); abc: for(m=0;c