Question: Implement only the global_alignment function useing the scoring method of +1 for match and -1 for mismatch and indel. print the global alignment with one

Implement only the global_alignment function useing the scoring method of +1 for match and -1 for mismatch and indel. print the global alignment with one line per string with '-' characters for indels.

import numpy as np import pandas as pd import scipy from plotnine import * def global_alignment(sequence1, sequence2): print("your code here")

def random_sequence(n): return("".join(np.random.choice(["A","C","G","T"], n)))

def mutate(s, snp_rate, indel_rate): x = [c for c in s] i = 0 while i < len(x): if np.random.random() < snp_rate: x[i] = random_sequence(1) if np.random.random() < indel_rate: length = np.random.geometric(0.5) if np.random.random() < 0.5: # insertion x[i] = x[i] + random_sequence(length) else: for j in range(i,i+length): if j < len(x): x[j] = "" i += 1 i += 1 return("".join(x))

s1 = random_sequence(100) s2 = mutate(s1, 0.1, 0.1)

# running your alignment code global_alignment(s1, s2)

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!