Mercurial > repos > bgruening > openbabel_obgrep
annotate multi_obgrep.py @ 11:78640d0127ce draft
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/openbabel commit 944ea4bb8a9cd4244152a4a4fecd0485fabc2ad0"
author | bgruening |
---|---|
date | Tue, 28 Jul 2020 08:36:19 -0400 |
parents | b0311f002a5f |
children | 2912ebf12ef2 |
rev | line source |
---|---|
0
b0311f002a5f
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/openbabel commit 8350bb3a632722c33bc91ec5238d47a536903729
bgruening
parents:
diff
changeset
|
1 #!/usr/bin/env python |
b0311f002a5f
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/openbabel commit 8350bb3a632722c33bc91ec5238d47a536903729
bgruening
parents:
diff
changeset
|
2 """ |
b0311f002a5f
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/openbabel commit 8350bb3a632722c33bc91ec5238d47a536903729
bgruening
parents:
diff
changeset
|
3 Input: Molecules in SDF, SMILES ... |
b0311f002a5f
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/openbabel commit 8350bb3a632722c33bc91ec5238d47a536903729
bgruening
parents:
diff
changeset
|
4 Output: Molecule file filtered with obgrep. |
b0311f002a5f
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/openbabel commit 8350bb3a632722c33bc91ec5238d47a536903729
bgruening
parents:
diff
changeset
|
5 Copyright 2013, Bjoern Gruening and Xavier Lucas |
b0311f002a5f
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/openbabel commit 8350bb3a632722c33bc91ec5238d47a536903729
bgruening
parents:
diff
changeset
|
6 """ |
b0311f002a5f
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/openbabel commit 8350bb3a632722c33bc91ec5238d47a536903729
bgruening
parents:
diff
changeset
|
7 import sys, os |
b0311f002a5f
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/openbabel commit 8350bb3a632722c33bc91ec5238d47a536903729
bgruening
parents:
diff
changeset
|
8 import argparse |
b0311f002a5f
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/openbabel commit 8350bb3a632722c33bc91ec5238d47a536903729
bgruening
parents:
diff
changeset
|
9 import multiprocessing |
b0311f002a5f
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/openbabel commit 8350bb3a632722c33bc91ec5238d47a536903729
bgruening
parents:
diff
changeset
|
10 import tempfile |
b0311f002a5f
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/openbabel commit 8350bb3a632722c33bc91ec5238d47a536903729
bgruening
parents:
diff
changeset
|
11 import subprocess |
b0311f002a5f
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/openbabel commit 8350bb3a632722c33bc91ec5238d47a536903729
bgruening
parents:
diff
changeset
|
12 import shutil |
b0311f002a5f
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/openbabel commit 8350bb3a632722c33bc91ec5238d47a536903729
bgruening
parents:
diff
changeset
|
13 import shlex |
b0311f002a5f
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/openbabel commit 8350bb3a632722c33bc91ec5238d47a536903729
bgruening
parents:
diff
changeset
|
14 |
11
78640d0127ce
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/openbabel commit 944ea4bb8a9cd4244152a4a4fecd0485fabc2ad0"
bgruening
parents:
0
diff
changeset
|
15 from openbabel import openbabel, pybel |
78640d0127ce
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/openbabel commit 944ea4bb8a9cd4244152a4a4fecd0485fabc2ad0"
bgruening
parents:
0
diff
changeset
|
16 openbabel.obErrorLog.StopLogging() |
0
b0311f002a5f
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/openbabel commit 8350bb3a632722c33bc91ec5238d47a536903729
bgruening
parents:
diff
changeset
|
17 def parse_command_line(): |
b0311f002a5f
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/openbabel commit 8350bb3a632722c33bc91ec5238d47a536903729
bgruening
parents:
diff
changeset
|
18 parser = argparse.ArgumentParser() |
b0311f002a5f
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/openbabel commit 8350bb3a632722c33bc91ec5238d47a536903729
bgruening
parents:
diff
changeset
|
19 parser.add_argument('-i', '--infile', required=True, help='Molecule file.') |
b0311f002a5f
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/openbabel commit 8350bb3a632722c33bc91ec5238d47a536903729
bgruening
parents:
diff
changeset
|
20 parser.add_argument('-q', '--query', required=True, help='Query file, containing different SMARTS in each line.') |
b0311f002a5f
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/openbabel commit 8350bb3a632722c33bc91ec5238d47a536903729
bgruening
parents:
diff
changeset
|
21 parser.add_argument('-o', '--outfile', required=True, help='Path to the output file.') |
b0311f002a5f
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/openbabel commit 8350bb3a632722c33bc91ec5238d47a536903729
bgruening
parents:
diff
changeset
|
22 parser.add_argument("--iformat", help="Input format, like smi, sdf, inchi") |
b0311f002a5f
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/openbabel commit 8350bb3a632722c33bc91ec5238d47a536903729
bgruening
parents:
diff
changeset
|
23 parser.add_argument("--n-times", dest="n_times", type=int, |
b0311f002a5f
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/openbabel commit 8350bb3a632722c33bc91ec5238d47a536903729
bgruening
parents:
diff
changeset
|
24 default=0, help="Print a molecule only if the pattern occurs # times inside the molecule.") |
b0311f002a5f
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/openbabel commit 8350bb3a632722c33bc91ec5238d47a536903729
bgruening
parents:
diff
changeset
|
25 parser.add_argument('-p', '--processors', type=int, default=multiprocessing.cpu_count()) |
b0311f002a5f
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/openbabel commit 8350bb3a632722c33bc91ec5238d47a536903729
bgruening
parents:
diff
changeset
|
26 parser.add_argument("--invert-matches", dest="invert_matches", action="store_true", |
b0311f002a5f
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/openbabel commit 8350bb3a632722c33bc91ec5238d47a536903729
bgruening
parents:
diff
changeset
|
27 default=False, help="Invert the matching, print non-matching molecules.") |
b0311f002a5f
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/openbabel commit 8350bb3a632722c33bc91ec5238d47a536903729
bgruening
parents:
diff
changeset
|
28 parser.add_argument("--only-name", dest="only_name", action="store_true", |
b0311f002a5f
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/openbabel commit 8350bb3a632722c33bc91ec5238d47a536903729
bgruening
parents:
diff
changeset
|
29 default=False, help="Only print the name of the molecules.") |
b0311f002a5f
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/openbabel commit 8350bb3a632722c33bc91ec5238d47a536903729
bgruening
parents:
diff
changeset
|
30 parser.add_argument("--full-match", dest="full_match", action="store_true", |
b0311f002a5f
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/openbabel commit 8350bb3a632722c33bc91ec5238d47a536903729
bgruening
parents:
diff
changeset
|
31 default=False, help="Full match, print matching-molecules only when the number of heavy atoms is also equal to the number of atoms in the SMARTS pattern.") |
b0311f002a5f
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/openbabel commit 8350bb3a632722c33bc91ec5238d47a536903729
bgruening
parents:
diff
changeset
|
32 parser.add_argument("--number-of-matches", dest="number_of_matches", action="store_true", |
b0311f002a5f
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/openbabel commit 8350bb3a632722c33bc91ec5238d47a536903729
bgruening
parents:
diff
changeset
|
33 default=False, help="Print the number of matches.") |
b0311f002a5f
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/openbabel commit 8350bb3a632722c33bc91ec5238d47a536903729
bgruening
parents:
diff
changeset
|
34 return parser.parse_args() |
b0311f002a5f
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/openbabel commit 8350bb3a632722c33bc91ec5238d47a536903729
bgruening
parents:
diff
changeset
|
35 |
b0311f002a5f
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/openbabel commit 8350bb3a632722c33bc91ec5238d47a536903729
bgruening
parents:
diff
changeset
|
36 results = list() |
b0311f002a5f
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/openbabel commit 8350bb3a632722c33bc91ec5238d47a536903729
bgruening
parents:
diff
changeset
|
37 def mp_callback(res): |
b0311f002a5f
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/openbabel commit 8350bb3a632722c33bc91ec5238d47a536903729
bgruening
parents:
diff
changeset
|
38 results.append(res) |
b0311f002a5f
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/openbabel commit 8350bb3a632722c33bc91ec5238d47a536903729
bgruening
parents:
diff
changeset
|
39 |
b0311f002a5f
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/openbabel commit 8350bb3a632722c33bc91ec5238d47a536903729
bgruening
parents:
diff
changeset
|
40 def mp_helper( query, args ): |
b0311f002a5f
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/openbabel commit 8350bb3a632722c33bc91ec5238d47a536903729
bgruening
parents:
diff
changeset
|
41 """ |
b0311f002a5f
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/openbabel commit 8350bb3a632722c33bc91ec5238d47a536903729
bgruening
parents:
diff
changeset
|
42 Helper function for multiprocessing. |
b0311f002a5f
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/openbabel commit 8350bb3a632722c33bc91ec5238d47a536903729
bgruening
parents:
diff
changeset
|
43 That function is a wrapper around obgrep. |
b0311f002a5f
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/openbabel commit 8350bb3a632722c33bc91ec5238d47a536903729
bgruening
parents:
diff
changeset
|
44 """ |
b0311f002a5f
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/openbabel commit 8350bb3a632722c33bc91ec5238d47a536903729
bgruening
parents:
diff
changeset
|
45 |
b0311f002a5f
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/openbabel commit 8350bb3a632722c33bc91ec5238d47a536903729
bgruening
parents:
diff
changeset
|
46 cmd_list = [] |
b0311f002a5f
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/openbabel commit 8350bb3a632722c33bc91ec5238d47a536903729
bgruening
parents:
diff
changeset
|
47 if args.invert_matches: |
b0311f002a5f
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/openbabel commit 8350bb3a632722c33bc91ec5238d47a536903729
bgruening
parents:
diff
changeset
|
48 cmd_list.append('-v') |
b0311f002a5f
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/openbabel commit 8350bb3a632722c33bc91ec5238d47a536903729
bgruening
parents:
diff
changeset
|
49 if args.only_name: |
b0311f002a5f
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/openbabel commit 8350bb3a632722c33bc91ec5238d47a536903729
bgruening
parents:
diff
changeset
|
50 cmd_list.append('-n') |
b0311f002a5f
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/openbabel commit 8350bb3a632722c33bc91ec5238d47a536903729
bgruening
parents:
diff
changeset
|
51 if args.full_match: |
b0311f002a5f
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/openbabel commit 8350bb3a632722c33bc91ec5238d47a536903729
bgruening
parents:
diff
changeset
|
52 cmd_list.append('-f') |
b0311f002a5f
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/openbabel commit 8350bb3a632722c33bc91ec5238d47a536903729
bgruening
parents:
diff
changeset
|
53 if args.number_of_matches: |
b0311f002a5f
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/openbabel commit 8350bb3a632722c33bc91ec5238d47a536903729
bgruening
parents:
diff
changeset
|
54 cmd_list.append('-c') |
b0311f002a5f
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/openbabel commit 8350bb3a632722c33bc91ec5238d47a536903729
bgruening
parents:
diff
changeset
|
55 if args.n_times: |
b0311f002a5f
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/openbabel commit 8350bb3a632722c33bc91ec5238d47a536903729
bgruening
parents:
diff
changeset
|
56 cmd_list.append('-t %s' % str(args.n_times)) |
b0311f002a5f
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/openbabel commit 8350bb3a632722c33bc91ec5238d47a536903729
bgruening
parents:
diff
changeset
|
57 |
b0311f002a5f
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/openbabel commit 8350bb3a632722c33bc91ec5238d47a536903729
bgruening
parents:
diff
changeset
|
58 tmp = tempfile.NamedTemporaryFile(delete=False) |
b0311f002a5f
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/openbabel commit 8350bb3a632722c33bc91ec5238d47a536903729
bgruening
parents:
diff
changeset
|
59 cmd = 'obgrep %s "%s" %s' % (' '.join(cmd_list), query, args.infile) |
b0311f002a5f
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/openbabel commit 8350bb3a632722c33bc91ec5238d47a536903729
bgruening
parents:
diff
changeset
|
60 child = subprocess.Popen(shlex.split(cmd), |
b0311f002a5f
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/openbabel commit 8350bb3a632722c33bc91ec5238d47a536903729
bgruening
parents:
diff
changeset
|
61 stdout=open(tmp.name, 'w+'), stderr=subprocess.PIPE) |
b0311f002a5f
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/openbabel commit 8350bb3a632722c33bc91ec5238d47a536903729
bgruening
parents:
diff
changeset
|
62 |
b0311f002a5f
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/openbabel commit 8350bb3a632722c33bc91ec5238d47a536903729
bgruening
parents:
diff
changeset
|
63 stdout, stderr = child.communicate() |
b0311f002a5f
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/openbabel commit 8350bb3a632722c33bc91ec5238d47a536903729
bgruening
parents:
diff
changeset
|
64 return (tmp.name, query) |
b0311f002a5f
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/openbabel commit 8350bb3a632722c33bc91ec5238d47a536903729
bgruening
parents:
diff
changeset
|
65 |
b0311f002a5f
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/openbabel commit 8350bb3a632722c33bc91ec5238d47a536903729
bgruening
parents:
diff
changeset
|
66 |
b0311f002a5f
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/openbabel commit 8350bb3a632722c33bc91ec5238d47a536903729
bgruening
parents:
diff
changeset
|
67 def obgrep( args ): |
b0311f002a5f
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/openbabel commit 8350bb3a632722c33bc91ec5238d47a536903729
bgruening
parents:
diff
changeset
|
68 |
b0311f002a5f
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/openbabel commit 8350bb3a632722c33bc91ec5238d47a536903729
bgruening
parents:
diff
changeset
|
69 temp_file = tempfile.NamedTemporaryFile() |
b0311f002a5f
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/openbabel commit 8350bb3a632722c33bc91ec5238d47a536903729
bgruening
parents:
diff
changeset
|
70 temp_link = "%s.%s" % (temp_file.name, args.iformat) |
b0311f002a5f
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/openbabel commit 8350bb3a632722c33bc91ec5238d47a536903729
bgruening
parents:
diff
changeset
|
71 temp_file.close() |
b0311f002a5f
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/openbabel commit 8350bb3a632722c33bc91ec5238d47a536903729
bgruening
parents:
diff
changeset
|
72 os.symlink(args.infile, temp_link) |
b0311f002a5f
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/openbabel commit 8350bb3a632722c33bc91ec5238d47a536903729
bgruening
parents:
diff
changeset
|
73 args.infile = temp_link |
b0311f002a5f
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/openbabel commit 8350bb3a632722c33bc91ec5238d47a536903729
bgruening
parents:
diff
changeset
|
74 |
b0311f002a5f
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/openbabel commit 8350bb3a632722c33bc91ec5238d47a536903729
bgruening
parents:
diff
changeset
|
75 pool = multiprocessing.Pool( args.processors ) |
b0311f002a5f
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/openbabel commit 8350bb3a632722c33bc91ec5238d47a536903729
bgruening
parents:
diff
changeset
|
76 for query in open( args.query ): |
b0311f002a5f
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/openbabel commit 8350bb3a632722c33bc91ec5238d47a536903729
bgruening
parents:
diff
changeset
|
77 pool.apply_async(mp_helper, args=(query.strip(), args), callback=mp_callback) |
b0311f002a5f
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/openbabel commit 8350bb3a632722c33bc91ec5238d47a536903729
bgruening
parents:
diff
changeset
|
78 #mp_callback( mp_helper(query.strip(), args) ) |
b0311f002a5f
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/openbabel commit 8350bb3a632722c33bc91ec5238d47a536903729
bgruening
parents:
diff
changeset
|
79 pool.close() |
b0311f002a5f
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/openbabel commit 8350bb3a632722c33bc91ec5238d47a536903729
bgruening
parents:
diff
changeset
|
80 pool.join() |
b0311f002a5f
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/openbabel commit 8350bb3a632722c33bc91ec5238d47a536903729
bgruening
parents:
diff
changeset
|
81 |
b0311f002a5f
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/openbabel commit 8350bb3a632722c33bc91ec5238d47a536903729
bgruening
parents:
diff
changeset
|
82 out_handle = open( args.outfile, 'wb' ) |
b0311f002a5f
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/openbabel commit 8350bb3a632722c33bc91ec5238d47a536903729
bgruening
parents:
diff
changeset
|
83 for result_file, query in results: |
b0311f002a5f
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/openbabel commit 8350bb3a632722c33bc91ec5238d47a536903729
bgruening
parents:
diff
changeset
|
84 res_handle = open(result_file,'rb') |
b0311f002a5f
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/openbabel commit 8350bb3a632722c33bc91ec5238d47a536903729
bgruening
parents:
diff
changeset
|
85 shutil.copyfileobj( res_handle, out_handle ) |
b0311f002a5f
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/openbabel commit 8350bb3a632722c33bc91ec5238d47a536903729
bgruening
parents:
diff
changeset
|
86 res_handle.close() |
b0311f002a5f
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/openbabel commit 8350bb3a632722c33bc91ec5238d47a536903729
bgruening
parents:
diff
changeset
|
87 os.remove( result_file ) |
b0311f002a5f
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/openbabel commit 8350bb3a632722c33bc91ec5238d47a536903729
bgruening
parents:
diff
changeset
|
88 out_handle.close() |
b0311f002a5f
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/openbabel commit 8350bb3a632722c33bc91ec5238d47a536903729
bgruening
parents:
diff
changeset
|
89 |
b0311f002a5f
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/openbabel commit 8350bb3a632722c33bc91ec5238d47a536903729
bgruening
parents:
diff
changeset
|
90 os.remove( temp_link ) |
b0311f002a5f
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/openbabel commit 8350bb3a632722c33bc91ec5238d47a536903729
bgruening
parents:
diff
changeset
|
91 |
b0311f002a5f
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/openbabel commit 8350bb3a632722c33bc91ec5238d47a536903729
bgruening
parents:
diff
changeset
|
92 def __main__(): |
b0311f002a5f
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/openbabel commit 8350bb3a632722c33bc91ec5238d47a536903729
bgruening
parents:
diff
changeset
|
93 """ |
b0311f002a5f
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/openbabel commit 8350bb3a632722c33bc91ec5238d47a536903729
bgruening
parents:
diff
changeset
|
94 Multiprocessing obgrep search. |
b0311f002a5f
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/openbabel commit 8350bb3a632722c33bc91ec5238d47a536903729
bgruening
parents:
diff
changeset
|
95 """ |
b0311f002a5f
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/openbabel commit 8350bb3a632722c33bc91ec5238d47a536903729
bgruening
parents:
diff
changeset
|
96 args = parse_command_line() |
b0311f002a5f
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/openbabel commit 8350bb3a632722c33bc91ec5238d47a536903729
bgruening
parents:
diff
changeset
|
97 obgrep( args ) |
b0311f002a5f
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/openbabel commit 8350bb3a632722c33bc91ec5238d47a536903729
bgruening
parents:
diff
changeset
|
98 |
b0311f002a5f
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/openbabel commit 8350bb3a632722c33bc91ec5238d47a536903729
bgruening
parents:
diff
changeset
|
99 if __name__ == "__main__" : |
b0311f002a5f
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/chemicaltoolbox/openbabel commit 8350bb3a632722c33bc91ec5238d47a536903729
bgruening
parents:
diff
changeset
|
100 __main__() |