@@ -3,97 +3,160 @@ from os import path
33
44from snakemake .utils import min_version
55
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
77
8- INPUT_DIR = config ["INPUT_DIR" ]
8+ INPUT_DIR = config ["INPUT_DIR" ]
99
10- MIN_DIR = config ["PREPARED_LIGAND_DIR" ]
10+ MIN_DIR = config ["PREPARED_LIGAND_DIR" ]
1111
12- PREPARED_DIR = config ["PREPARED_DATA_DIR" ]
12+ PREPARED_DIR = config ["PREPARED_DATA_DIR" ]
1313
14- OUTPUT_DIR = config ["OUTPUT_DIR" ]
14+ OUTPUT_DIR = config ["OUTPUT_DIR" ]
1515
16- TMP_DIR = config ["TEMP_DATA_DIR" ]
16+ TMP_DIR = config ["TEMP_DATA_DIR" ]
1717
18- LOCAL_INPUT = config ["LOCAL_INPUT_DIR" ]
18+ LOCAL_INPUT = config ["LOCAL_INPUT_DIR" ]
1919
2020DATABASE = config ["DATABASE" ]
2121
2222SUBSET = config ["SUBSET" ]
2323
2424RESCREENING_TARGETS = config ["RESCREENING_TARGETS" ]
2525
26+
2627def generateOutput (wildcards ):
2728 irods = path .join (OUTPUT_DIR , "results" , "irods.json" )
2829 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+ )
3546
36- return hist + out + [irods ]
47+ return hist + out + [irods ]
3748
3849 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+ )
4459 return hist + out + [irods ]
4560
4661
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
5092for i in config ["RESCREENING_TARGETS" ]:
51- targetList .append (i .split (',' )[0 ])
93+ targetList .append (i .split ("," )[0 ])
5294
5395combList = []
5496for comb in itertools .combinations (targetList , 2 ): # all combinations of two targets
5597
56- combList .append ('_' .join (comb ))
98+ combList .append ("_" .join (comb ))
99+
100+ combAll = "_" .join (targetList ) # combine all rescreening targets
57101
58- combAll = '_' .join (targetList ) # combine all rescreening targets
59102
60103def 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+ )
62111
63112
64113def IRODSinput (wildcards ):
65114 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+ )
70127 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+ )
74133 return out
75134
135+
76136def resources (RULE_NAME ):
77137 out_list = []
78138 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 )
81141 return out_str
82142
143+
83144rule all :
84145 input :
85- generateOutput
146+ generateOutput ,
147+
86148
87149rule generateIRODS :
88150 input :
89- IRODSinput
151+ IRODSinput ,
90152 output :
91- path .join (OUTPUT_DIR , "results" , "irods.json" )
153+ path .join (OUTPUT_DIR , "results" , "irods.json" ),
92154 log :
93- "logs/generateIRODS.log"
155+ "logs/generateIRODS.log" ,
94156 script :
95157 "scripts/generateIRODS.py"
96158
159+
97160include : "rules/analyse.smk"
98161include : "rules/docking.smk"
99162include : "rules/preparation.smk"
0 commit comments