1 |
|
import os |
2 |
|
|
3 |
|
molblock_in = file("drugs.sdf").read() |
4 |
< |
cmd = os.curdir + os.sep + "mengine" |
4 |
> |
cmd = os.curdir + os.sep + "mengine -dxi" |
5 |
|
# mengine will read multi-molblock sdf files, |
6 |
|
# but calling through popen2 with some (large?) files hangs on windows, |
7 |
|
# even though the same file runs fine at command line. |
8 |
|
# So, split into separate files. |
9 |
|
for molblock_in in (file("drugs.sdf").read()).split('$$$$\n'): |
10 |
|
if len(molblock_in) > 0: |
11 |
< |
mengine_in, mengine_out = os.popen2(cmd) |
11 |
> |
mengine_in, mengine_out, mengine_err = os.popen3(cmd) |
12 |
|
mengine_in.write(molblock_in) |
13 |
|
mengine_in.close() |
14 |
|
molblock_out = mengine_out.read() |
15 |
|
print molblock_out, |
16 |
+ |
print mengine_err.read(), |