-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfind-sispa-primers.py
executable file
·56 lines (43 loc) · 1.11 KB
/
find-sispa-primers.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/usr/bin/python
import sys
from itertools import product
# BC004CG
sa1 = "CGTAGTACACTCTAGAGCACTA"
# BC009CG
#sa2 = "CGAGCTCTATACGTGTAGTCTC"
bcSet = []
names = []
i = 1
for bc in product('ACTG', repeat=6):
match = True
barcode = sa1+"".join(bc)
if len(bcSet) == 0:
bcSet.append(barcode)
names.append(str(i)+"".join(bc))
else:
for x in range(0,len(bcSet)):
print bcSet[x],barcode
if sum(ch1 != ch2 for ch1, ch2 in zip(bcSet[x],barcode)) < 3:
match = False
break
#print sum(ch1 != ch2 for ch1, ch2 in zip(bcSet[x],barcode))
if match == True:
bcSet.append(barcode)
names.append(str(i)+"".join(bc))
print len(bcSet)
i += 1
with open ("barcodes.fa","w") as f:
for i in range(0,len(bcSet)):
f.write(">"+str(i)+"\n"+bcSet[i]+"\n")
# ham = dict()
#
# for i in range(len(a1)):
# for x in range (i+1,len(a1)):
# ham[i][x] = 0
# print "\t"+"\t".join(names)
# for i in range(len(a1)):
# print names[i],
# for x in range (i+1,len(a1)):
# print str(sum(ch1 != ch2 for ch1, ch2 in zip(a1[i], a1[x])))+"\t",
# print
#ham[i][x] = sum(ch1 != ch2 for ch1, ch2 in zip(a1[i], a1[x]))