Mercurial > repos > bgruening > rxdock_rbcavity
comparison rbdock.py @ 0:e99f861ba68a draft
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/rxdock commit bb19570293b920983b6856b30b42203a09543bc5"
author | bgruening |
---|---|
date | Sat, 04 Apr 2020 15:04:13 -0400 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:e99f861ba68a |
---|---|
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() |