<jupyter_start><jupyter_text>Dot Plot for Sequence Alignment Write a program to implement the Dot plot of sequence alignment. The program should take two sequences as input and a window size W based on which the alignment would be performed.<jupyter_code># Using Window size = 1

seq_1 = input ("Enter sequence 1: ")
seq_2 = input ("Enter sequence 2: ")

window = int(input ("Enter window size: "))

def plotMatrix (M, t, s1, s2, nonblank = '•', blank = ' '):
    print(' |' + s2)
    print('-'*(2 + len(s2)))
    for label, row in zip(s1, M):
        line = ''.join(nonblank if s < t else blank for s in row)
        print (label + '|' + line)
    
def makeMatrix (s1, s2, k):
    n = len(s1)
    m = len(s2)
    return [[M(s1,s2,i,j,k) for j in range(m-k+1)] for i in range(n-k+1)]
def delta (x,y):
    return 0 if x == y else 1
def M(s1,s2,i,j,k):
    return sum(delta(x,y) for x,y in zip(s1[i:i+k],s2[j:j+k]))

def dotplot(s1, s2, w = window, t = 1):
    M = makeMatrix (s2, s1, w)
    plotMatrix (M, t, s2, s1)

dotplot(seq_1, seq_2)
# Using Window size = 2

seq_1 = input ("Enter sequence 1: ")
seq_2 = input ("Enter sequence 2: ")

window = int(input ("Enter window size: "))

def plotMatrix (M, t, s1, s2, nonblank = '•', blank = ' '):
    print(' |' + s2)
    print('-'*(2 + len(s2)))
    for label, row in zip(s1, M):
        line = ''.join(nonblank if s < t else blank for s in row)
        print (label + '|' + line)
    
def makeMatrix (s1, s2, k):
    n = len(s1)
    m = len(s2)
    return [[M(s1,s2,i,j,k) for j in range(m-k+1)] for i in range(n-k+1)]
def delta (x,y):
    return 0 if x == y else 1
def M(s1,s2,i,j,k):
    return sum(delta(x,y) for x,y in zip(s1[i:i+k],s2[j:j+k]))

def dotplot(s1, s2, w = window, t = 1):
    M = makeMatrix (s2, s1, w)
    plotMatrix (M, t, s2, s1)

dotplot(seq_1, seq_2)
# Using Window size = 3

seq_1 = input ("Enter sequence 1: ")
seq_2 = input ("Enter sequence 2: ")

window = int(input ("Enter window size: "))

def plotMatrix (M, t, s1, s2, nonblank = '•', blank = ' '):
    print(' |' + s2)
    print('-'*(2 + len(s2)))
    for label, row in zip(s1, M):
        line = ''.join(nonblank if s < t else blank for s in row)
        print (label + '|' + line)
    
def makeMatrix (s1, s2, k):
    n = len(s1)
    m = len(s2)
    return [[M(s1,s2,i,j,k) for j in range(m-k+1)] for i in range(n-k+1)]
def delta (x,y):
    return 0 if x == y else 1
def M(s1,s2,i,j,k):
    return sum(delta(x,y) for x,y in zip(s1[i:i+k],s2[j:j+k]))

def dotplot(s1, s2, w = window, t = 1):
    M = makeMatrix (s2, s1, w)
    plotMatrix (M, t, s2, s1)

dotplot(seq_1, seq_2)<jupyter_output>Enter sequence 1: AACCTATAGCT
Enter sequence 2: GCGATATA
Enter window size: 3
 |AACCTATAGCT
-------------
G|         
C|         
G|         
A|     •   
T|    •    
A|     •
{'fraction_non_alphanumeric': 0.17703862660944206, 'fraction_numerical': 0.03755364806866953, 'mean_word_length': 2.826265389876881, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '473493', 'license': 'MIT', 'n_tokens_mistral': 1207, 'n_tokens_neox': 1179, 'n_words': 382, 'path': 'Dot-Plot.ipynb', 'repo_name': 'Not-A-Builder/Bioinformatics', 'size': '2796'}