Question: Create a function called memoAlignScore ( S 1 , S 2 , gap, substitutionMatrix,memo ) We have already developed a function alignScore that computes the
Create a function called memoAlignScoreS S gap, substitutionMatrix,memo
We have already developed a function alignScore that computes the alignment score.
def alignScoreS S gap, substitutionMatrix:
Returns the sequence alignment score for S and S
if S: return gap lenS
elif S : return gap lenS
else:
option substitutionMatrixS S alignScoreS: S: gap, substitutionMatrix
option gap alignScoreS: S gap substitutionMatrix
option gap alignScoreS S: gap substitutionMatrix
return maxoption option option
Your first task is to implement a memoized version of alignScore, memoAlignScoreS S gap, substitutionMatrix,memo where memo is a dictionary. You can start it off as
Test your memoAlignScore function carefully. Here are some examples of the memoAlignScore function in action:
memoAlignScoreblosum
memoAlignScoreFGTSKblosum
memoAlignScoreIVEKGYY'AVEYY',blosum
memoAlignScoreCIEAFGTSKQKRALNSRRMNAVGNDIVSTAVTKAAADVIDAKGVTALIQDVAQD'RDLPIWTSVDWKSLPATEIFNKAFSQGSDEAMYDYMAVYKKSCPQTRR',blosum
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
