@@ -3,97 +3,160 @@ from os import path
3
3
4
4
from snakemake .utils import min_version
5
5
6
- min_version ("7.19.1" ) # this is where SLURM support was introduced
6
+ min_version ("7.19.1" ) # this is where SLURM support was introduced
7
7
8
- INPUT_DIR = config ["INPUT_DIR" ]
8
+ INPUT_DIR = config ["INPUT_DIR" ]
9
9
10
- MIN_DIR = config ["PREPARED_LIGAND_DIR" ]
10
+ MIN_DIR = config ["PREPARED_LIGAND_DIR" ]
11
11
12
- PREPARED_DIR = config ["PREPARED_DATA_DIR" ]
12
+ PREPARED_DIR = config ["PREPARED_DATA_DIR" ]
13
13
14
- OUTPUT_DIR = config ["OUTPUT_DIR" ]
14
+ OUTPUT_DIR = config ["OUTPUT_DIR" ]
15
15
16
- TMP_DIR = config ["TEMP_DATA_DIR" ]
16
+ TMP_DIR = config ["TEMP_DATA_DIR" ]
17
17
18
- LOCAL_INPUT = config ["LOCAL_INPUT_DIR" ]
18
+ LOCAL_INPUT = config ["LOCAL_INPUT_DIR" ]
19
19
20
20
DATABASE = config ["DATABASE" ]
21
21
22
22
SUBSET = config ["SUBSET" ]
23
23
24
24
RESCREENING_TARGETS = config ["RESCREENING_TARGETS" ]
25
25
26
+
26
27
def generateOutput (wildcards ):
27
28
irods = path .join (OUTPUT_DIR , "results" , "irods.json" )
28
29
if config ["RESCREENING" ] == "TRUE" :
29
- out = expand (path .join (OUTPUT_DIR , "results" , "rescreening_{percentage}" , "{receptorID}" , "union.csv" ),
30
- receptorID = config ["TARGETS" ][0 ].split (',' )[0 ],
31
- percentage = config ["RESULT_NUMBER" ],
32
- combAll = combAll )
33
- hist = expand (path .join (OUTPUT_DIR , "results" , "{receptorID}_hist.png" ),
34
- receptorID = config ["TARGETS" ][0 ].split (',' )[0 ])
30
+ out = expand (
31
+ path .join (
32
+ OUTPUT_DIR ,
33
+ "results" ,
34
+ "rescreening_{percentage}" ,
35
+ "{receptorID}" ,
36
+ "union.csv" ,
37
+ ),
38
+ receptorID = config ["TARGETS" ][0 ].split ("," )[0 ],
39
+ percentage = config ["RESULT_NUMBER" ],
40
+ combAll = combAll ,
41
+ )
42
+ hist = expand (
43
+ path .join (OUTPUT_DIR , "results" , "{receptorID}_hist.png" ),
44
+ receptorID = config ["TARGETS" ][0 ].split ("," )[0 ],
45
+ )
35
46
36
- return hist + out + [irods ]
47
+ return hist + out + [irods ]
37
48
38
49
else :
39
- out = expand (path .join (OUTPUT_DIR , "results" , "{receptorID}_{percentage}.csv" ),
40
- receptorID = config ["TARGETS" ][0 ].split (',' )[0 ],
41
- percentage = config ["RESULT_NUMBER" ])
42
- hist = expand (path .join (OUTPUT_DIR , "results" , "{receptorID}_hist.png" ),
43
- receptorID = config ["TARGETS" ][0 ].split (',' )[0 ])
50
+ out = expand (
51
+ path .join (OUTPUT_DIR , "results" , "{receptorID}_{percentage}.csv" ),
52
+ receptorID = config ["TARGETS" ][0 ].split ("," )[0 ],
53
+ percentage = config ["RESULT_NUMBER" ],
54
+ )
55
+ hist = expand (
56
+ path .join (OUTPUT_DIR , "results" , "{receptorID}_hist.png" ),
57
+ receptorID = config ["TARGETS" ][0 ].split ("," )[0 ],
58
+ )
44
59
return hist + out + [irods ]
45
60
46
61
47
- localrules : all , generateIRODS , dockingResultsTxt , removeDuplicateLigands , makeVenn , prepareLigands2 , mergeDocking2 , bestLigands , prepareSecondDocking , convertMol2 , makeReceptorPDBQT , mergeDocking ,mergeLocalInput , split , split2 , targetProtein , getZINCdata , getZINCSubsets , gunzip , ENAMINEdownload , prepareReceptor , prepareDocking , prepareLibrary , prepareGeometry , makeHistogram , cleanLigands
48
-
49
- targetList = [] #get ProteinIDs from configfile for rescreening
62
+ localrules :
63
+ all ,
64
+ generateIRODS ,
65
+ dockingResultsTxt ,
66
+ removeDuplicateLigands ,
67
+ makeVenn ,
68
+ prepareLigands2 ,
69
+ mergeDocking2 ,
70
+ bestLigands ,
71
+ prepareSecondDocking ,
72
+ convertMol2 ,
73
+ makeReceptorPDBQT ,
74
+ mergeDocking ,
75
+ mergeLocalInput ,
76
+ split ,
77
+ split2 ,
78
+ targetProtein ,
79
+ getZINCdata ,
80
+ getZINCSubsets ,
81
+ gunzip ,
82
+ ENAMINEdownload ,
83
+ prepareReceptor ,
84
+ prepareDocking ,
85
+ prepareLibrary ,
86
+ prepareGeometry ,
87
+ makeHistogram ,
88
+ cleanLigands ,
89
+
90
+
91
+ targetList = [] # get ProteinIDs from configfile for rescreening
50
92
for i in config ["RESCREENING_TARGETS" ]:
51
- targetList .append (i .split (',' )[0 ])
93
+ targetList .append (i .split ("," )[0 ])
52
94
53
95
combList = []
54
96
for comb in itertools .combinations (targetList , 2 ): # all combinations of two targets
55
97
56
- combList .append ('_' .join (comb ))
98
+ combList .append ("_" .join (comb ))
99
+
100
+ combAll = "_" .join (targetList ) # combine all rescreening targets
57
101
58
- combAll = '_' .join (targetList ) # combine all rescreening targets
59
102
60
103
def getAllVenn (wildcards ):
61
- path .join (OUTPUT_DIR , "output" , "rescreening" , "{receptorID}" , "{RESCREENING_TARGETS}_union.txt" )
104
+ path .join (
105
+ OUTPUT_DIR ,
106
+ "output" ,
107
+ "rescreening" ,
108
+ "{receptorID}" ,
109
+ "{RESCREENING_TARGETS}_union.txt" ,
110
+ )
62
111
63
112
64
113
def IRODSinput (wildcards ):
65
114
if config ["RESCREENING" ] == "TRUE" :
66
- out = expand (path .join (OUTPUT_DIR , "results" , "rescreening_{percentage}" , "{receptorID}" , "union.csv" ),
67
- receptorID = config ["TARGETS" ][0 ].split (',' )[0 ],
68
- percentage = config ["RESULT_NUMBER" ],
69
- combAll = combAll )
115
+ out = expand (
116
+ path .join (
117
+ OUTPUT_DIR ,
118
+ "results" ,
119
+ "rescreening_{percentage}" ,
120
+ "{receptorID}" ,
121
+ "union.csv" ,
122
+ ),
123
+ receptorID = config ["TARGETS" ][0 ].split ("," )[0 ],
124
+ percentage = config ["RESULT_NUMBER" ],
125
+ combAll = combAll ,
126
+ )
70
127
else :
71
- out = expand (path .join (OUTPUT_DIR , "results" , "{receptorID}_{percentage}.csv" ),
72
- receptorID = config ["TARGETS" ][0 ].split (',' )[0 ],
73
- percentage = config ["RESULT_NUMBER" ])
128
+ out = expand (
129
+ path .join (OUTPUT_DIR , "results" , "{receptorID}_{percentage}.csv" ),
130
+ receptorID = config ["TARGETS" ][0 ].split ("," )[0 ],
131
+ percentage = config ["RESULT_NUMBER" ],
132
+ )
74
133
return out
75
134
135
+
76
136
def resources (RULE_NAME ):
77
137
out_list = []
78
138
for key in config [RULE_NAME ]:
79
- out_list .append (f' { key } = { config [RULE_NAME ][key ]} ' )
80
- out_str = ' ,\n ' .join (out_list )
139
+ out_list .append (f" { key } = { config [RULE_NAME ][key ]} " )
140
+ out_str = " ,\n " .join (out_list )
81
141
return out_str
82
142
143
+
83
144
rule all :
84
145
input :
85
- generateOutput
146
+ generateOutput ,
147
+
86
148
87
149
rule generateIRODS :
88
150
input :
89
- IRODSinput
151
+ IRODSinput ,
90
152
output :
91
- path .join (OUTPUT_DIR , "results" , "irods.json" )
153
+ path .join (OUTPUT_DIR , "results" , "irods.json" ),
92
154
log :
93
- "logs/generateIRODS.log"
155
+ "logs/generateIRODS.log" ,
94
156
script :
95
157
"scripts/generateIRODS.py"
96
158
159
+
97
160
include : "rules/analyse.smk"
98
161
include : "rules/docking.smk"
99
162
include : "rules/preparation.smk"
0 commit comments