COMP IV PS3: DNA Sequence Alignment Dr. Rykalova This assignment is based on © XXXXXXXXXX, Robert Sedgewick and Kevin Wayne. PS3: DNA Sequence Alignment Global Sequence Alignment The goals of this...

Assignment is ps3, we're using c++ and virtual box.


COMP IV PS3: DNA Sequence Alignment Dr. Rykalova This assignment is based on © 1999-2010, Robert Sedgewick and Kevin Wayne. PS3: DNA Sequence Alignment Global Sequence Alignment The goals of this assignment are to solve a fundamental problem in computational biology and to learn about a powerful programming paradigm known as dynamic programming. On this assignment, you are encouraged (but not required) to work with a partner* provided you practice pair programming. Pair programming "is a practice in which two programmers work side-by- side at one computer, continuously collaborating on the same design, algorithm, code, or test." One partner is driving (designing and typing the code) while the other is navigating (reviewing the work, identifying bugs, and asking questions). The two partners switch roles every 30-40 minutes, and on demand, brainstorm. *Note: If you are working with a partner you should remember • The code is yours and yours only (you have a complete responsibility for the code submitted) • You should clearly identify your partner in readme file • It is your responsibility to submit Assignment (not your partner) We will:  Write a program to compute the optimal sequence alignment of two DNA strings. This program will introduce you to the field of computational biology in which computers are used to do research on biological systems. Further, you will be introduced to a powerful algorithmic design paradigm known as dynamic programming.  install Valgrind, a memory analysis tool  measure and report the space and time performance of the implementation Average time to complete assignment ~5 hours. Understanding the Problem Biology review A genetic sequence is a string formed from a four-letter alphabet {Adenine (A), Thymine (T), Guanine (G), Cytosine (C)} of biological macromolecules referred to together as the DNA bases. A gene is a genetic sequence that contains the information needed to construct a protein. All of your genes taken together are referred to as the human genome, a blueprint for the parts needed to construct the proteins that form your cells. Each new cell produced by your body receives a copy of the genome. This copying process, as well as natural wear and tear, introduces a small number of changes into the sequences of many genes. Among the most common changes are the substitution of one base for another and the deletion of a substring of bases; such changes are generally referred to as point mutations. As a result of these point mutations, the same gene sequenced from closely related organisms will have slight differences. The problem Through your research you have found the following sequence of a gene in a previously unstudied organism. A A C A G T T A C C What is the function of the protein that this gene encodes? You could begin a series of uninformed experiments in the lab to determine what role this gene plays. However, there is a good chance that it is a variant of a known gene in a previously studied organism. Since biologists and computer scientists have laboriously determined (and published) the genetic sequence of many organisms (including humans), you would like to leverage this information to your advantage. We'll compare the above genetic sequence with one which has already been sequenced and whose function is well understood. COMP IV PS3: DNA Sequence Alignment Dr. Rykalova This assignment is based on © 1999-2010, Robert Sedgewick and Kevin Wayne. T A A G G T C A If the two genetic sequences are similar enough, we might expect them to have similar functions. We would like a way to quantify "similar enough." Edit-distance In this assignment we will measure the similarity of two genetic sequences by their edit distance, a concept first introduced in the context of coding theory, but which is now widely used in spell checking, speech recognition, plagiarism detection, file revisioning, and computational linguistics. We align the two sequences, but we are permitted to insert gaps in either sequence (e.g., to make them have the same length). We pay a penalty for each gap that we insert and also for each pair of characters that mismatch in the final alignment. Intuitively, these penalties model the relative likeliness of point mutations arising from deletion/insertion and substitution. We produce a numerical score according to the following table, which is widely used in biological applications: operation cost insert a gap 2 align two characters that mismatch 1 align two characters that match 0 Here are two possible alignments of the strings x = "AACAGTTACC" and y = "TAAGGTCA": x y cost A T 1 A A 0 C A 1 A G 1 G G 0 T T 0 T C 1 A A 0 C ̶ 2 C ̶ 2 --- 8 x y cost A T 1 A A 0 C ̶ 2 A A 0 G G 0 T G 1 T T 0 A ̶ 2 C C 0 C A 1 --- 7 The first alignment has a score of 8, while the second one has a score of 7. The edit-distance is the score of the best possible alignment between the two genetic sequences over all possible alignments. In this example, the second alignment is in fact optimal, so the edit-distance between the two strings is 7. Computing the edit-distance is a nontrivial computational problem because we must find the best alignment among exponentially many possibilities. For example, if both strings are 100 characters long, then there are more than 1075 possible alignments. A recursive solution is an elegant approach. However, it is far too inefficient because it recalculates each subproblem over and over. Once we have defined the recursive definition we can redefine the solution using a dynamic programming approach which calculates each subproblem once. A recursive solution We will calculate the edit-distance between the two original strings x and y by solving many edit- distance problems on smaller suffixes of the two strings. We use the notation x[i] to refer to character i of the string. We also use the notation x[i..M] to refer to the suffix of x consisting of the characters x[i], x[i+1], ..., x[M-1]. Finally, we use the notation opt[i][j] to denote the edit distance of x[i..M] and y[j..N]. For example, consider the two strings x = "AACAGTTACC" and y = "TAAGGTCA" of length M = 10 and N = 8, respectively. Then, x[2] is 'C', x[2..M] is "CAGTTACC", and y[8..N] is the empty string. The edit distance of x and y is opt[0][0]. Now we describe a recursive scheme for computing the edit distance of x[i..M] and y[j..N]. Consider the first pair of characters in an optimal alignment of x[i..M] with y[j..N]. There are three possibilities: COMP IV PS3: DNA Sequence Alignment Dr. Rykalova This assignment is based on © 1999-2010, Robert Sedgewick and Kevin Wayne. 1. The optimal alignment matches x[i] up with y[j]. In this case, we pay a penalty of either 0 or 1, depending on whether x[i] equals y[j], plus we still need to align x[i+1..M] with y[j+1..N]. What is the best way to do this? This subproblem is exactly the same as the original sequence alignment problem, except that the two inputs are each suffixes of the original inputs. Using our notation, this quantity is opt[i+1][j+1]. 2. The optimal alignment matches the x[i] up with a gap. In this case, we pay a penalty of 2 for a gap and still need to align x[i+1..M] with y[j..N]. This subproblem is identical to the original sequence alignment problem, except that the first input is a proper suffix of the original input. 3. The optimal alignment matches the y[j] up with a gap. In this case, we pay a penalty of 2 for a gap and still need to align x[i..M] with y[j+1..N]. This subproblem is identical to the original sequence alignment problem, except that the second input is a proper suffix of the original input. The key observation is that all of the resulting subproblems are sequence alignment problems on suffixes of the original inputs. To summarize, we can compute opt[i][j] by taking the minimum of three quantities: opt[i][j] = min { opt[i+1][j+1] + 0/1, opt[i+1][j] + 2, opt[i][j+1] + 2 } This equation works assuming i < m="" and="" j="">< n. aligning an empty string with another string of length k requires inserting k gaps, for a total cost of 2k. thus, in general we should set opt[m][j] = 2(n-j) and opt[i][n] = 2(m-i). for our example, the final matrix is: 0 1 2 3 4 5 6 7 8 x\y t a a g g t c a ̶ 0 a 7 8 10 12 13 15 16 18 20 1 a 6 6 8 10 11 13 14 16 18 2 c 6 5 6 8 9 11 12 14 16 3 a 7 5 4 6 7 9 11 12 14 4 g 9 7 5 4 5 7 9 10 12 5 t 8 8 6 4 4 n.="" aligning="" an="" empty="" string="" with="" another="" string="" of="" length="" k="" requires="" inserting="" k="" gaps,="" for="" a="" total="" cost="" of="" 2k.="" thus,="" in="" general="" we="" should="" set="" opt[m][j]="2(N-j)" and="" opt[i][n]="2(M-i)." for="" our="" example,="" the="" final="" matrix="" is:="" 0="" 1="" 2="" 3="" 4="" 5="" 6="" 7="" 8="" x\y="" t="" a="" a="" g="" g="" t="" c="" a="" ̶="" 0="" a="" 7="" 8="" 10="" 12="" 13="" 15="" 16="" 18="" 20="" 1="" a="" 6="" 6="" 8="" 10="" 11="" 13="" 14="" 16="" 18="" 2="" c="" 6="" 5="" 6="" 8="" 9="" 11="" 12="" 14="" 16="" 3="" a="" 7="" 5="" 4="" 6="" 7="" 9="" 11="" 12="" 14="" 4="" g="" 9="" 7="" 5="" 4="" 5="" 7="" 9="" 10="" 12="" 5="" t="" 8="" 8="" 6="" 4="">
Mar 15, 2021
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here