-
Notifications
You must be signed in to change notification settings - Fork 36
/
Copy pathreduce.py
25 lines (22 loc) · 855 Bytes
/
reduce.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
# LIBTBX_SET_DISPATCHER_NAME phenix.reduce
# LIBTBX_SET_DISPATCHER_NAME mmtbx.reduce
# LIBTBX_SET_DISPATCHER_NAME molprobity.reduce
import libtbx.load_env
import os, sys, subprocess
def raise_sorry(message, file_name):
from libtbx.str_utils import show_string
from libtbx.utils import Sorry
raise Sorry(message % show_string(file_name))
def run(args):
reduce_exe = libtbx.env.under_build("reduce/exe/reduce")
if (os.name == "nt"):
reduce_exe += ".exe"
if (not os.path.isfile(reduce_exe)):
raise_sorry("Missing phenix.reduce executable: %s", reduce_exe)
db = libtbx.env.under_dist("reduce", "reduce_wwPDB_het_dict.txt")
if (not os.path.isfile(db)):
raise_sorry("Missing phenix.reduce database: %s", db)
cmd = [reduce_exe, "-DB", db, "-ALLALT"]
subprocess.call(cmd + args)
if (__name__ == "__main__"):
run(sys.argv[1:])