-
Notifications
You must be signed in to change notification settings - Fork 0
/
batch.py
46 lines (30 loc) · 1.53 KB
/
batch.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
import os
import subprocess
from ranking import *
vina_path = input("Path to Vina: ")
conf_path = input("Path to configuration file: ")
batch_path = input("Path to ligand directory: ")
out_path = input("Desired output directory: ")
for ligand in os.listdir(batch_path):
f = os.path.join(batch_path, ligand)
# checking if it is a file
if os.path.isfile(f):
print("Docking " + ligand + "...")
ligand_path = batch_path + "/" + ligand
log_name = (out_path+'/'+ligand.split('\\')[-1].split('.')[0]+ "_log.log")
out_name = (out_path+'/'+ligand.split('\\')[-1].split('.')[0]+ "_out.pdbqt")
args = [vina_path, '--config', conf_path, '--ligand' , ligand_path, '--log', log_name, '--out', out_name]
subprocess.run(args)
sorted_affinity = rank_affinities(ligand, log_name)
def vina_docking(vina_path,conf_path,batch_path,out_path):
for ligand in os.listdir(batch_path):
f = os.path.join(batch_path, ligand)
# checking if it is a file
if os.path.isfile(f):
print("Docking " + ligand + "...")
ligand_path = batch_path + "/" + ligand
log_name = (out_path+'/'+ligand.split('\\')[-1].split('.')[0]+ "_log.log")
out_name = (out_path+'/'+ligand.split('\\')[-1].split('.')[0]+ "_out.pdbqt")
args = [vina_path, '--config', conf_path, '--ligand' , ligand_path, '--log', log_name, '--out', out_name]
subprocess.run(args)
rank_affinities(ligand, log_name)