Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

Database Security

Authors: Alfred Basta, Melissa Zgola

1st Edition

1435453905, 978-1435453906

More Books

Students also viewed these Databases questions

Question

4. Explain how to price managerial and professional jobs.

Answered: 1 week ago