Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need help figuring out how to implement the gene sequence algorithm (Needleman-Wunsch) using a Divide and Conquer version in Python with the following specifications:

I need help figuring out how to implement the gene sequence algorithm (Needleman-Wunsch) using a Divide and Conquer version in Python with the following specifications:

"""

Please implement functions named: reset, basicOps, genSeqDC, setS1, setS2, and timeComplexity; details follow.

Please make s1 and s2 global variables, so you don't have to pass them around everywhere

You don't have to, but you might want to, add a main function and code/test this in your

favorite Python IDE.

"""

counter = 0

s1 = ""

s2 = ""

""" reset, resets basic op counter to 0 and s1/s2 to empty strings """

def reset():

global counter

global s1

global s2

counter = 0

s1 = ""

s2 = ""

"""

basicOps returns the number of basic operations

HINT: don't forget to count basic operations!!!

"""

def basicOps():

global counter

return counter

"""

setS1 sets global variable s1 to gene sequence specified

"""

def setS1(seq):

global s1

s1 = seq

"""

setS2 sets global variable s2 to gene sequence specified

"""

def setS2(seq):

global s2

s2 = seq

"""

geneSeqDC, implement Genetic Sequence Alignment Algorithm Divide and Conquer Solution.

Remember: s1 and s2 are global variables. Therefore, please focus on how i and j affect the optimal

gene sequence alignment.

Note the unit tests assume that i and j are zero-based!

For example given the strings in the slides ("ACGCTGA", "ACTGT"), the unit tests will invoke genSeqDC(len(s1)-1, len(s2)-1)

or more specifically, for this example, it calculates genSeqDC(6, 4) *** NOT genSeqDC(7,4) ***

However, please implement it using recursion, ***not using an array-cache***

"""

def genSeqDC(i, j):

global s1

global s2

global counter

# Note the unit tests assume that i and j are zero-based!

# For example given the strings in the slides ("ACGCTGA", "ACTGT"), the unit tests invoke genSeqDC(len(s1)-1, len(s2)-1)

# or more specifically, for this example, it calculates genSeqDC(6, 4) *** NOT genSeqDC(7,4) ***

pass

"""

For two gene sequences of size m and n, how many basic operations will the d&c gene-sequencing algorithm perform?

Please only count the number of function calls.

Note: depending on exactly how you implement your divide and conquer algorithm might affect the exact number of basic ops

This estimate should be the high water mark. For extra credit, implement the exact number of basic operations that occurs.

"""

def timeComplexity(m, n):

pass

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Organizational Change

Authors: Barbara Senior, Stephen Swailes

5th Edition

1292063831, 9781292063836

More Books

Students also viewed these Accounting questions