comparison rbdock.py @ 4:a428230b38f6 draft

"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/rdock commit db567a29443284f2cec1444ec9db9aa6bd913fad"
author bgruening
date Fri, 03 Apr 2020 13:32:13 -0400
parents
children
comparison
equal deleted inserted replaced
3:1709d2c3dc20 4:a428230b38f6
1 import subprocess
2 import argparse
3
4 def main():
5 parser = argparse.ArgumentParser(description='Simple wrapper for rbdock')
6 parser.add_argument('-n', '--num', type=int, help='Number of docking poses to generate')
7 parser.add_argument('-s', '--seed', type=int, help='Random seed')
8 args = parser.parse_args()
9
10 cmd = ['rbdock', '-i', 'ligands.sdf', '-r', 'receptor.prm', '-p', 'dock.prm', '-n', str(args.num), '-o', 'rdock_output']
11 if args.seed != None:
12 cmd += ['-s', str(args.seed)]
13
14 ps = subprocess.Popen(cmd, stdout=subprocess.PIPE)
15
16 error_counter = 0
17 for stdout_line in iter(ps.stdout.readline, ''):
18 if 'RBT_DOCKING_ERROR' in str(stdout_line):
19 error_counter += 1
20 if error_counter == 10:
21 print(ps.stdout)
22 exit(23)
23 if ps.poll() != None:
24 print(ps.stdout)
25 exit(int(ps.poll()))
26
27 if __name__ == "__main__":
28 main()