I am trying to create adjacency matrix based on comparing overlaps between the substrings of set A.If there is a overlap between the substrings,then I will store +1 in the matrix M else wont.I have already written a code utilizing sequence matcher to compare the strings,but I am getting the following error while trying to execute the code.
import numpy
import array
from difflib import SequenceMatcher as sm
##
###read the file
##f=open('spectrum.txt','r')
##s=f.readlines()
##a=str(s)
a='{ATG,TGG,TGC,GTG,GGC,GCA,GCG,CGT}'
p= dict(enumerate(a[1:-1].split(",")))
print p
n= p.keys()[-1]
print p.keys()[1]
M=numpy.zeros([n,n],int)
print M
for i in range(0,n-1):
for j in range(0,n-1):
if i==j:
pass
elif sm(None,p.keys(i),p.keys(j))!=0:
M[i,j]+=1
else:
pass
print M