|
a |
|
b/analysis/docking_py27.py |
|
|
1 |
import os |
|
|
2 |
import sys |
|
|
3 |
import glob |
|
|
4 |
|
|
|
5 |
|
|
|
6 |
def pdbs_to_pdbqts(pdb_dir, pdbqt_dir, dataset): |
|
|
7 |
for file in glob.glob(os.path.join(pdb_dir, '*.pdb')): |
|
|
8 |
name = os.path.splitext(os.path.basename(file))[0] |
|
|
9 |
outfile = os.path.join(pdbqt_dir, name + '.pdbqt') |
|
|
10 |
pdb_to_pdbqt(file, outfile, dataset) |
|
|
11 |
print('Wrote converted file to {}'.format(outfile)) |
|
|
12 |
|
|
|
13 |
|
|
|
14 |
def pdb_to_pdbqt(pdb_file, pdbqt_file, dataset): |
|
|
15 |
if os.path.exists(pdbqt_file): |
|
|
16 |
return pdbqt_file |
|
|
17 |
if dataset == 'crossdocked': |
|
|
18 |
os.system('prepare_receptor4.py -r {} -o {}'.format(pdb_file, pdbqt_file)) |
|
|
19 |
elif dataset == 'bindingmoad': |
|
|
20 |
os.system('prepare_receptor4.py -r {} -o {} -A checkhydrogens -e'.format(pdb_file, pdbqt_file)) |
|
|
21 |
else: |
|
|
22 |
raise NotImplementedError |
|
|
23 |
return pdbqt_file |
|
|
24 |
|
|
|
25 |
|
|
|
26 |
if __name__ == '__main__': |
|
|
27 |
pdbs_to_pdbqts(sys.argv[1], sys.argv[2], sys.argv[3]) |