Replace optparse with argparse.

Optparse is deprecated.  Argparse will allow tighter integration with
PDB2PQR/APBS.
This commit is contained in:
Nathan Baker
2020-05-12 13:13:28 -07:00
parent aeb1663d7b
commit ae7e8b6430
3 changed files with 107 additions and 64 deletions

View File

@@ -1,13 +1,18 @@
# entry point for propka script
import logging
import propka.lib, propka.molecular_container
_LOGGER = logging.getLogger("PROPKA")
def main():
"""
Reads in structure files, calculates pKa values, and prints pKa files
"""
# loading options, flaggs and arguments
options, pdbfiles = propka.lib.loadOptions()
options = propka.lib.loadOptions()
pdbfiles = options.filenames
for pdbfile in pdbfiles:
my_molecule = propka.molecular_container.Molecular_container(pdbfile, options)
@@ -25,7 +30,10 @@ def single(pdbfile, optargs=None):
single("protein.pdb", optargs=["--mutation=N25R/N181D", "-v", "--pH=7.2"])
"""
optargs = optargs if optargs is not None else []
options, ignored_pdbfiles = propka.lib.loadOptions(*optargs)
options = propka.lib.loadOptions(*optargs)
pdbfile = options.filenames.pop(0)
if len(options.filenames) > 0:
_LOGGER.warning("Ignoring filenames: %s", options.filenames)
my_molecule = propka.molecular_container.Molecular_container(pdbfile, options)
my_molecule.calculate_pka()