forked from Stefan-A-Hoffmann/High-throughput-CRISPR-design
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCRISPRdirectPOST.py
34 lines (26 loc) · 1.21 KB
/
CRISPRdirectPOST.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
import requests
import time
###################################
h_sequences = open("CDS sequences.txt").read().splitlines() #split into list - easier to handle
with open('edits.txt') as h_edits:
for line_edit in h_edits:
edit_pair = line_edit.split()
h_sequences_index=int(0)
for h_sequences_line in h_sequences:
h_sequences_index = h_sequences_index+1
if edit_pair[0] == h_sequences_line:
seq = (h_sequences[h_sequences_index])
targetname = "targets_"+edit_pair[0]
parameters = {"userseq":seq, "db":"sacCer3", "format":"txt"}
print(parameters)
print("****************************************************")
# get Cas9 target sites from CRISPRdirect
r = requests.post("http://crispr.dbcls.jp/", data = parameters)
print(r.text)
filename = "%s.txt" % targetname
print(filename+"\n")
print("****************************************************")
f = open(filename,"w")
f.write(r.text)
f.close()
time.sleep(5)