(5/5)

The problem

The science of Bioinformatics is broadly defined as “the application of tools of com- putation and analysis to capture and interpret biological data” (A. Bayat, “Science, medicine, and the future: Bioinformatics”, British Medical Journal, 324 (2002), p.1018-1022). One fundamental part of it is a sequence analysis of DNA and pro- teins, which is often called Genomics. In this assignment, we will learn how to solve two simple problems of genomics: likelihood of gene mutation and gene sequence alignment.

Both problems deal with two gene sequences which can be described as strings of symbols representing four nucleotides (or, bases), A, C, G and T:

The first problem quantifies the difference between two sequences (of possibly unequal length), so that the two can be aligned and considered as mutational variation of one another. The second problem calculates the likelihood that the two sequences are related by mutation.

Problem One: DNA Sequence Alignment

Often a protein function encoded in a genetic sequence is determined by comparing this sequence to another sequence (perhaps belonging to a different organism) which is already known. Comparing, or aligning, the two sequences is a viable method which may ease the task of determining protein functions.

The alignment is performed by calculating the edit-distance of sequences. The edit- distance is also used in coding theory, spell checking, plagiarism detection, version control, computational linguistics and other areas. The method to calculate the edit-distance of two sequences consists in aligning them (allowing gaps to make up for missing symbols since the sequences can have unequal length). Each mismatch or gap in an alignment incurs a penalty. In genomics applications, the following penalty function is often used:

Penalty Cost

Gap 2

Mismatch 1

Match 0

Two examples next illustrate how this penalty assignment works:

and

The total cost of alignment is just a sum of all penalties; in the above examples, it’s 8 for the first alignment and 7 for the second. The edit-distance is defined as the smallest total penalty among all possible alignments. One can tackle this problem in two ways: a recursive one (relatively simple) and a dynamic programming.

A recursive (naive) approach is quite simple, bit it can be very demanding computa- tionally since the number of possible alignments grows exponentially with the length of sequences. The algorithm of recursive approach for calculating the edit-distance goes like this:

• Take two original sequences x , y of the length M , N correspondingly, and denote their edit-distance:

edist(x , y) edist(0, 0), where edist(i, j) is the edit-distance of two suffix sequences x [i..M ] and y[ j..N ] (in other words if x = x0 . . . xM , its suffix sequence x [i..k] is the same as a subsequence xi . . . xk, i ⩾ 0, k ⩽ M , and similarly for the suffix sequence y[ j..N ]). The task now is to write down a recursive relation for edist(i, j).

• In the optimal alignment, there are three possibilities:

– x [i] and y[ j] align with penalty 0 or 1 depending whether they match or not, the remaining contribution is edist(i + 1, j + 1);

– there is a gap in the y sequence which contributes penalty 2, and the remaining term comes from aligning x [i + 1..M ] and y[ j..N ] with the contribution edist(i + 1, j);

– there is a gap in x sequence (penalty 2), and the remaining alignment contributing edist(i, j + 1).

The optimal alignment for x [i..M ] and y[ j..N ] must be obtained by minimis- ing edist:

edist(i, j) = min edist(i+1, j+1)+(0 or 1), edist(i+1, j)+2, edist(i, j+1)+2}, i < M , j < N .

• When i = M , the remaining alignment with an empty sequence contributes 2(N − i), and analogously for j = N case:

edist(M , j) = 2(N − j) and edist(i, N ) = 2(M − i)

The above cases are enough to calculate edist(0, 0) for any x and y, and thus calculate edist(x , y). Your task is to implement this algorithm.

A more sophisticated dynamic programming approach allows to overcome the in- efficiency of the recursive approach related to multiple repetitions of the same computation when one moves from one recursive level to the previous one. In a case of two sequences having the length N , the number of recursive calls (almost all of them redundant) grows like 2N . The dynamic programming allows to avoid unnec- essary computation by breaking the original problem into subproblems, storing the result of their solution (when those are obtained for the first time), and then simply re-using those results when they are needed instead of repeating same computation over and over again. This technique is also called memoization. We shall discuss it in the lectures on a simple example. If you decide to employ this approach here, you need research this topic to the greater extent yourself (by using references provided in Bibliography) and apply what you will have learnt.

(5/5)

DescriptionIn this final assignment, the students will demonstrate their ability to apply two ma

Path finding involves finding a path from A to B. Typically we want the path to have certain properties,such as being the shortest or to avoid going t

Develop a program to emulate a purchase transaction at a retail store. Thisprogram will have two classes, a LineItem class and a Transaction class. Th

1 Project 1 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of

1 Project 2 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of