| """ |
| protonate.py: Wrapper method for the reduce program: protonate (i.e., add hydrogens) a pdb using reduce |
| and save to an output file. |
| Pablo Gainza - LPDI STI EPFL 2019 |
| Released under an Apache License 2.0 |
| """ |
|
|
| from subprocess import Popen, PIPE |
| from IPython.core.debugger import set_trace |
| import os |
|
|
|
|
| def protonate(in_pdb_file, out_pdb_file): |
| |
| |
| |
| |
| |
| args = ["reduce", "-Trim", in_pdb_file] |
| p2 = Popen(args, stdout=PIPE, stderr=PIPE) |
| stdout, stderr = p2.communicate() |
| outfile = open(out_pdb_file, "w") |
| outfile.write(stdout.decode('utf-8').rstrip()) |
| outfile.close() |
| |
| args = ["reduce", "-HIS", out_pdb_file] |
| p2 = Popen(args, stdout=PIPE, stderr=PIPE) |
| stdout, stderr = p2.communicate() |
| outfile = open(out_pdb_file, "w") |
| outfile.write(stdout.decode('utf-8')) |
| outfile.close() |
|
|
|
|