-
Notifications
You must be signed in to change notification settings - Fork 0
/
gpu_filecr.py
68 lines (64 loc) · 2.58 KB
/
gpu_filecr.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
import sys
import os
import subprocess
import shutil
if len(sys.argv) == 5:
prot_name1 = sys.argv[1]
os.system("python PDB_process.py "+prot_name1)
prot_name = prot_name1[:-4]+"a.pdb"
lig_name = sys.argv[2]
centroid = sys.argv[3]
nrun = sys.argv[4]
print(prot_name)
directory_name = os.getcwd()
path_out = directory_name+'/'+prot_name[:-4]+'_'+lig_name[:-4]
if not os.path.exists(path_out):
os.mkdir(path_out)
else:
shutil.rmtree(path_out)
os.mkdir(path_out)
shutil.copy(prot_name, path_out)
shutil.copy(lig_name, path_out)
shutil.copy(directory_name+'/Repository/autogrid4', path_out)
shutil.copy(directory_name+'/Repository/autodock_gpu_128wi', path_out)
os.chdir(path_out)
try:
pre_rec = 'python ../Repository/prepare_receptor4.py -r '+prot_name+' -A bonds_hydrogens '
subprocess.call(pre_rec, shell=True)
except:
pre_rec = 'python ../Repository/prepare_receptor4.py -r '+prot_name
subprocess.call(pre_rec, shell=True)
try:
pre_lig = 'python ../Repository/prepare_ligand4.py -l'+lig_name+' -A bonds_hydrogens'
subprocess.call(pre_lig, shell=True)
except:
pre_lig = 'python ../Repository/prepare_ligand4.py -l'+lig_name
subprocess.call(pre_lig, shell=True)
grid_para = 'python ../Repository/prepare_gpf4.py -l '+lig_name[:-4]+'.pdbqt -r '+prot_name[:-4]+'.pdbqt -p gridcenter='+centroid+' -o grid_pf.gpf'
subprocess.call(grid_para, shell=True)
dock_para = 'python ../Repository/prepare_dpf4.py -l '+lig_name[:-4]+'.pdbqt -r '+prot_name[:-4]+'.pdbqt -o dock_pf.dpf'
subprocess.call(dock_para, shell=True)
def a():
a_line = open("dock_pf.dpf", 'r')
aline = a_line.readlines()
out = open("dock_pf1.dpf", 'w')
for line in aline:
#print line
if line[:6] == "ga_run":
a = line[:6]+" 10"+line[10:]
out.write(a)
else:
out.write(line)
out.close()
a()
os.remove('dock_pf.dpf')
subprocess.call('./autogrid4 -p grid_pf.gpf -l grid_pf.glg ', shell=True)
os.system("rm autogrid4")
os.system("./autodock_gpu_128wi --ffile "+prot_name[:-4]+".maps.fld --lfile "+lig_name[:-4]+".pdbqt"+" --nrun "+nrun)
os.system("rm autodock_gpu_128wi")
os.chdir(directory_name)
shutil.copy(path_out+"/"+lig_name[:-4]+".dlg", directory_name)
os.system("rm "+prot_name)
else:
print("Usage python gpu_filecr.py <prot_name> <lig_name> <centroid_coordinate> <nrun>")
sys.exit()