Question: This question is in regards to a string alignment Python function that I am working on. The function takes in two ASCII strings x and

This question is in regards to a string alignment Python function that I am working on. The function takes in two ASCII strings x and y, creates a table of length nx, by ny, then calculates an optimal cost between a set of 3 operations (indel, swap, substitute), and returns the completed table with the optimal costs filled in as values. Below is what I have so far. The base cases are filled in in row 1 and column 1. What I need now is to fill in the rest of the matrix by comparing the nodes directly above [i-1][j], directly to the left [i][j-1], left corner [i-1][j-1], and two to the left diagonally [i-2][j-2], and making [i][j] the minimum of those + the cost of the operation. It should be filled in as follows:

if [i-1][j] or [i][j-1] + 1 (cost of indel) are min --> [i][j] = random choice between [i-1][j] and [i][j-1] + 1 (cost of indel)

if [i-1][j-1] + 10 (cost of sub) is min --> [i][j] = [i-1][j-1] + 10 (cost of sub)

if [i-2][j-2] + 12 (cost of swap) is min --> [i][j] = [i-2][j-2] + 12 (cost of swap)

Below is what I have so far, thanks for any help and let me know if you need any extra clarification.This question is in regards to a string alignment Python function that

def ali String (x, y) rows len (x) 1 cols len (y) S CO for i in range (cols) for i in range (rows) for i in range (rows) S Cil CO for i in range (cols) SCO] [i] return S table alignstring Exponential Polynomial for i in range (len (table) print (table [i]) StringAlignment C Users Chris AppData Local Programs Python Python 36-32 [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10] 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] [3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] [5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] 6 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] [7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] [8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] 11 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] Process finished with exit code 0

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!