Write a function that takes a match, mismatch and gap score, as well as two ungapped sequences as input and returns two strings of the aligned sequences. Apply your function to the two sequences provided and print the aligned sequences, one sequence per line. Finally, calculate the score of your alignment using the match, mismatch and gap penalty provided. Not necessary to get the answer, but a suggestion: • after filling out the scoring matrix, start at the lower right (position score[n,m]) with i and j keeping track of your position use a while loop: while i > 0 and j > 0 and update i and j depending on the best move append gaps or nucleotides to two strings that store your alignment • if you need to reverse a string use: reverse_string = string[::-1]

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Please, help with the code to this example

Write a function that takes a match, mismatch and gap score, as well as two ungapped sequences as input and returns two strings of the aligned sequences.
Apply your function to the two sequences provided and print the aligned sequences, one sequence per line. Finally, calculate the score of your alignment using
the match, mismatch and gap penalty provided.
Not necessary to get the answer, but a suggestion:
after filling out the scoring matrix, start at the lower right (position score[n,m]) with i and j keeping track of your position
• use a while loop: while i > 0 and j > 0 and update i and j depending on the best move
append gaps or nucleotides to two strings that store your alignment
if you need to reverse a string use: reverse_string = string[:-1]
%3D
# Answer
# Make a score matrix with these two sequences
seqa
"CGTATGCTAGCTTATTTGC"
"TAACTAGCGATTGCGC"
seqb
# And these match, mismatch and gap scores
match =
1
mismatch =
-1
gap = -2
Transcribed Image Text:Write a function that takes a match, mismatch and gap score, as well as two ungapped sequences as input and returns two strings of the aligned sequences. Apply your function to the two sequences provided and print the aligned sequences, one sequence per line. Finally, calculate the score of your alignment using the match, mismatch and gap penalty provided. Not necessary to get the answer, but a suggestion: after filling out the scoring matrix, start at the lower right (position score[n,m]) with i and j keeping track of your position • use a while loop: while i > 0 and j > 0 and update i and j depending on the best move append gaps or nucleotides to two strings that store your alignment if you need to reverse a string use: reverse_string = string[:-1] %3D # Answer # Make a score matrix with these two sequences seqa "CGTATGCTAGCTTATTTGC" "TAACTAGCGATTGCGC" seqb # And these match, mismatch and gap scores match = 1 mismatch = -1 gap = -2
Expert Solution
Step 1

This is a problem of Sequence Alignment so first off all you need t see the defination of this kind of problrm and then  further I'll send the code also in python...

 Given as an info two strings, X = x_{1} x_{2}... x_{m} , and Y = y_{1} y_{2}... y_{m} , yield the arrangement of the strings, character by character, with the goal that the net punishment is limited. The punishment is determined as:
1. A punishment of p_{gap} happens assuming a hole is embedded between the string.
2. A punishment of p_{xy} happens for mis-matching the characters of X and Y .

Models:

Input : X = CG, Y = CA, p_gap = 3, p_xy = 7
Yield : X = CG_, Y = C_A, Total punishment = 6

Input : X = AGGGCT, Y = AGGCA, p_gap = 3, p_xy = 2
Yield : X = AGGGCT, Y = A_GGCA, Total punishment = 5

Input : X = CG, Y = CA, p_gap = 3, p_xy = 5
Yield : X = CG, Y = CA, Total punishment = 5

A concise Note on the historical backdrop of the issue
The Sequence Alignment issue is one of the principal issues of Biological Sciences, pointed toward observing the similitude of two amino-corrosive arrangements. Contrasting amino-acids is of prime significance to people, since it gives essential data on advancement and improvement. Saul B. Needleman and Christian D. Wunsch formulated a unique programming calculation to the issue and got it distributed in 1970. From that point forward, various upgrades have been made to further develop the time intricacy and space intricacy, but these are past the extent of conversation here.

Arrangement We can utilize dynamic programming to tackle this issue. The achievable arrangement is to bring holes into the strings, in order to balance the lengths. Since it very well may be effectively demonstrated that the expansion of additional holes in the wake of adjusting the lengths will just prompt augmentation of punishment.

Ideal Substructure
It very well may be seen from an ideal arrangement, for instance from the given example input, that the ideal arrangement limits to just three up-and-comers.
1. x_{m} and y_{n} .
2. x_{m} and hole.
3. hole and y_{n} .
Evidence of Optimal Substructure.
We can without much of a stretch demonstrate by logical inconsistency. Let X - x_{m} be X^' and Y - y_{n} be Y^' . Assume that the initiated arrangement of X^' , Y^' has some punishment P , and a contender arrangement has a punishment P^* , with P^* < P .
Presently, affixing x_{m} and y_{n} , we get an arrangement with punishment P^* + p_{xy} < P + p_{xy} . This goes against the optimality of the first arrangement of X, Y .
Subsequently, demonstrated.
Let dp[i][j] be the punishment of the ideal arrangement of X_{i} and Y_{i} . Then, at that point, from the ideal base, dp[i][j] = min(dp[i-1][j-1] + p_{xy}, dp[i-1][j] + p_{gap}, dp[i][j-1] + p_{gap}) .
The all out least punishment is consequently, dp[m][n] .

Reproducing the arrangement
To Reconstruct,
1. Follow back through the filled table, beginning dp[m][n] .
2. Whenever (I, j)
…..2a. on the off chance that it was filled utilizing case 1, go to (I-1, j-1) .
…..2b. assuming it was filled utilizing case 2, go to (I-1, j) .
…..2c. in the event that it was filled utilizing case 3, go to (I, j-1) .
3. on the off chance that possibly I = 0 or j = 0, coordinate the leftover substring with holes.

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Function Arguments
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education