forked from chaunceydust/Auto_AutoDock-GPU
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathauto_autodock_gpu.py
183 lines (141 loc) · 6.31 KB
/
auto_autodock_gpu.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
#!/usr/bin/env python3
import time
import argparse
# import multiprocessing
from tools import inputprep
from tools import rundock
from tools import postproc
from tools import check
from tools import miscellaneous
parser = argparse.ArgumentParser (description='Tools for high-throughput docking screening using autodock-gpu')
# switch
# parser.add_argument('-smi', '--smi', dest='smi_dest', action='store_true')
parser.add_argument('-sl', '--splitligs', dest='splitligs_dest', action='store_true', help='Split ligand before run the automated docking')
# path
parser.add_argument('-p', '--proteinpath', required=False, type=str, default=None, help='Set the path to maps.fld file for receptor (file)')
parser.add_argument('-l', '--ligandpath', required=False, type=str, default=None, help='Set the path to directory containing ligands (directory)')
parser.add_argument('-v', '--vinapath', required=False, type=str, default=None, help='Path to autodock_vina (directory)')
parser.add_argument('-ls', '--listpath', required=False, type=str, default=None, help='Path to list.txt (file)')
parser.add_argument('-d', '--resultpath', required=False, type=str, default=None, help='Set the path to result directory (directory)')
# setting
parser.add_argument('-bin', '--autodockbin', required=False, type=str, default='autodock_gpu_128wi', help='Binary file of AutoDock-GPU (bin_file)')
parser.add_argument('--gpu', required=False, type=str, default=1, help='Which GPU do you use ? (starts at 1)')
parser.add_argument('--qtpath', required=False, type=str, default=None, help='path to pdbqt (for running obabel)')
# etc
parser.add_argument('--np', required=False, type=int, default=2, help='Number of cores for execute')
parser.add_argument('--fn', required=False, type=str, default='', help='A function name to use')
parser.add_argument('--csv', required=False, type=str, default='results.csv', help='csv file name')
parser.add_argument('--splitnum', required=False, type=int, default=4, help='How many divided list files you want ?')
args = parser.parse_args()
class RunScript:
def __init__ (self, args):
self.args = args
def fxn_select (self):
start_init = time.time()
inp = inputprep.InputPrep(args)
run_docking = rundock.RunDock(args)
post_proc = postproc.ParallelRun (args)
path_check = check.PathCheck(args)
misc = miscellaneous.Misc(args)
fn_dict = {
'smi2pdbqt':inp.smi2pdbqt,
'listgen':inp.listgen,
'splitligs':inp.split_ligs,
'run_docking':run_docking.autodock_gpu_run,
'dlg2qt':post_proc.dlg2qt_pararun,
'result2df':post_proc.result2df_pararun,
'obabel':post_proc.obabel_pararun,
'molproperty':post_proc.property_pararun,
'clustering':post_proc.clustering_pararun,
'znparsing':post_proc.znparsing_pararun,
'listsplit':misc.listsplit,
'value_cutoff':misc.value_cutoff,
'scatterplot':misc.scatterplot,
'copypdbqt':misc.copypdbqt
}
if args.fn in fn_dict:
fn_ = fn_dict[args.fn]
new_path_dict = path_check.pathcheck()
args.vinapath = new_path_dict['vinapath']
args.resultpath = new_path_dict['resultpath']
args.listpath = new_path_dict['listpath']
fn_()
print ('Total elapsed time: ', time.time() - start_init, 'sec')
quit()
elif args.fn == 'postproc':
runlist = ['obabel', 'molproperty', 'value_cutoff', 'clustering', 'scatterplot']
new_path_dict = path_check.pathcheck()
args.vinapath = new_path_dict['vinapath']
args.resultpath = new_path_dict['resultpath']
args.listpath = new_path_dict['listpath']
for i in runlist:
fn_ = fn_dict[i]
fn_()
print ('Total elapsed time: ', time.time() - start_init, 'sec')
quit()
else:
fxns = '''
- Essential fxns
1) splitligs (ligandpath, vinapath)
2) listgen (proteinpath, ligandpath, listpath)
3) run_docking (listpath, autodockbin, resultpath, gpu)
4) dlg2qt (resultpath)
5) result2df (resultpath)
6) obabel (csv, qtpath, np)
7) molproperty (csv, np)
8) clusterting (csv, np)
999) postproc (csv, qtpath, np)
>>> obabel - molproperty - cutoff - clustering - scatterplot
- Miscellaneous fxns
10) smi2pdbqt (ligandpath, np)
11) listsplit (listpath, splitnum)
12) znparsing (np, csv)
13) value_cutoff (csv)
14) scatterplot (csv)
15) copypdbqt (csv, qtpath)
'''
print ('Please select/enter the one of functions below and enter it.')
print (fxns)
quit()
def auto_run (self):
start_init = time.time ()
inp = inputprep.InputPrep(self.args)
run_docking = rundock.RunDock(self.args)
post_proc = postproc.ParallelRun(args)
misc = miscellaneous.Misc(args)
if self.args.splitligs_dest == True:
inp.split_ligs()
else:
pass
inp.listgen()
run_docking.autodock_gpu_run()
post_proc.dlg2qt_pararun()
post_proc.result2df_pararun()
post_proc.obabel_pararun()
post_proc.property_pararun()
misc.value_cutoff()
post_proc.clustering_pararun()
misc.scatterplot()
print ('Total elapsed time: ', time.time() - start_init, 'sec')
quit()
if __name__ == '__main__':
run_script = RunScript(args)
path_check = check.PathCheck(args)
if args.fn == '':
pass
else:
run_script.fxn_select()
new_path_dict = path_check.pathcheck()
args.vinapath = new_path_dict['vinapath']
args.resultpath = new_path_dict['resultpath']
args.listpath = new_path_dict['listpath']
args_dict = vars(args)
for key, value in args_dict.items():
print (f'[{key}] {value}')
print ('-----------------------------')
cont_ = input('Please check your inputs before continuing !! (y / n): ')
if cont_ == 'n':
quit()
else:
pass
run_script.auto_run()