Warning: foreach() argument must be of type array|object, bool given in /var/www/html/web/app/themes/studypress-core-theme/template-parts/header/mobile-offcanvas.php on line 20

Local sequence alignment. Often two DNA sequences are significantly different, but contain regions that are very similar and are highly conserved. Design an algorithm that takes an input two strings x[1Kn]and y[1Km]and a scoring matrix δ(as defined in Exercise 6.26), and outputs substrings x'andy'of x and y respectively, that have the highest-scoring alignment over all pairs of such substrings. Your algorithm should take time O(mn).

Short Answer

Expert verified

The complexity of the program is Omn

Step by step solution

01

Local Sequence Alignment

The total scoring alignment is the cost of editing the strings using insertion, deletion, or gap penalties.

Suppose the given strings are x=x1,x2,Kxnandy=y1,y2,Kym.

The first step is to determine the similarity score of the elementsδa,b and the gap penalty of length k.

In the next step the first row and column of the scoring matrix M of size role="math" localid="1658918665081" n+1times m+1to zero Then in the next step, the scoring matrix is filled.

Then tracing back from the highest score to zero in the scoring matrix gives the best alignment.

02

Step 2:Give Algorithm

Algorithm:

The algorithm can be written as given below:

δa,b- score

Gk- gap penalty of length k

Mn+1m+1- scoring matrix

for o=0ton

M01=0

for o=0 to m

M10=0

for o=1 to n

for p=1 to n

Mop=max1Mo-1p-1+δao,bpmaxk1,Mo-kp-Gkmaxl1,Mop-1-Gk

Traceback from highest alignment score to 0.

03

Step 3:Explain Algorithm

Explanation:

Mopis a optimal score of aligning.

There are only a polynomial number of subproblems.

Every subproblems can be solved easily by solving smaller subproblems.

See, in step-7 we have three cases. first case is xo=ypsecond case is, xo aligns to a gap and, third case is ypaligns to a gap.

The calculated scoring matrix is of size

So, the complexity of the program is Onmo=

Unlock Step-by-Step Solutions & Ace Your Exams!

  • Full Textbook Solutions

    Get detailed explanations and key concepts

  • Unlimited Al creation

    Al flashcards, explanations, exams and more...

  • Ads-free access

    To over 500 millions flashcards

  • Money-back guarantee

    We refund you if you fail your exam.

Over 30 million students worldwide already upgrade their learning with Vaia!

One App. One Place for Learning.

All the tools & learning materials you need for study success - in one app.

Get started for free

Most popular questions from this chapter

Given two strings x=x1x2···xnand y=y1y2···ym, we wish to find the length of their longest common subsequence, that is, the largest k for which there are indices i1<i2<···<ikand j1<j2<···<jkwith xi1xi2···xik=yj1yj2···yjk. Show how to do this in time 0(mn).

Time and space complexity of dynamic programming. Our dynamic programming algorithm for computing the edit distance between strings of length m and n creates a table of size n×mand therefore needs O (mn) time and space. In practice, it will run out of space long before it runs out of time. How can this space requirement be reduced?

  1. Show that if we just want to compute the value of the edit distance (rather than the optimal sequence of edits), then only O(n) space is needed, because only a small portion of the table needs to be maintained at any given time.
  2. Now suppose that we also want the optimal sequence of edits. As we saw earlier, this problem can be recast in terms of a corresponding grid-shaped dag, in which the goal is to find the optimal path from node (0,0) to node (n,m). It will be convenient to work with this formulation, and while we’re talking about convenience, we might as well also assume that is a power of 2.
    Let’s start with a small addition to the edit distance algorithm that will turn out to be very useful. The optimal path in the dag must pass through an intermediate node (k,m2) for some k; show how the algorithm can be modified to also return this value k.
  3. Now consider a recursive scheme:
    Procedure find-path((0,0)(n,m))
    Compute the value kabove
    find-path ((0,0)k,m2)
    find-path k,m2n,m
    concatenate these two paths, with kin the middle.
    Show that this scheme can be made to run inO (mn) time and O(n) space.

Give an O(nt) algorithm for the following task. Input: A list of n positive integers a1,a2,...,an; a positive integer t. Question: Does some subset of the ai’s add up to t? (You can use each ai at most once.) (Hint: Look at subproblems of the form “does a subset of{a1,a2,...,ai} add up to ?”)

A certain string-processing language offers a primitive operation which splits a string into two pieces. Since this operation involves copying the original string, it takes n units of time for a string of length n, regardless of the location of the cut. Suppose, now, that you want to break a string into many pieces. The order in which the breaks are made can affect the total running time. For example, if you want to cut a 20-character string at positions 3 and 10, then making the first cut at position 3 incurs a total cost of 20+17=37, while doing position first has a better cost of 20+17=37.

Give a dynamic programming algorithm that, given the locations of m cuts in a string of length , finds the minimum cost of breaking the string into m +1 pieces.

Cutting cloth. You are given a rectangular piece of cloth with dimensions X×Y, whereX and Yare positive integers, and a list of products that can be made using the cloth. For each producti[1,n] you know that a rectangle of cloth of dimensionsai×bi is needed and that the final selling price of the product is ci. Assume the,ai biandci are all positive integers. You have a machine that can cut any rectangular piece of cloth into two pieces either horizontally or vertically. Design an algorithm that determines the best return on theX×Y piece of cloth, that is, a strategy for cutting the cloth so that the products made from the resulting pieces give the maximum sum of selling prices. You are free to make as many copies of a given product as you wish, or none if desired.

See all solutions

Recommended explanations on Computer Science Textbooks

View all explanations

What do you think about this solution?

We value your feedback to improve our textbook solutions.

Study anywhere. Anytime. Across all devices.

Sign-up for free