From e15af86d7373bb52bf2e892c7db9d410a4cf2aeb Mon Sep 17 00:00:00 2001 From: Nathan Baker Date: Mon, 3 Jul 2023 10:59:21 -0700 Subject: [PATCH 1/3] Update documentation about PROPKA options. Warn that we ignore some PROPKA options. --- docs/source/releases.rst | 5 +++++ docs/source/using/index.rst | 7 +++++++ 2 files changed, 12 insertions(+) diff --git a/docs/source/releases.rst b/docs/source/releases.rst index 7d260e7..d9d00a0 100644 --- a/docs/source/releases.rst +++ b/docs/source/releases.rst @@ -6,6 +6,11 @@ Release history Current version *************** +Changes +======= + +* Added warnings about ignored PROPKA options (`#365 `_) + Fixes ===== diff --git a/docs/source/using/index.rst b/docs/source/using/index.rst index ad4a777..a54aad1 100644 --- a/docs/source/using/index.rst +++ b/docs/source/using/index.rst @@ -48,6 +48,13 @@ Information about additional options can be obtained by running: pdb2pqr --help +.. note:: + + `PROPKA `_ options are exposed via the PDB2PQR command line for convenience. + However, not all of these options are supported in PDB2PQR. + We have tried to add warning or error messages when unsupported PROPKA options are passed to the code but we may have missed some. + Please `file an issue `_ if you find a PROPKA option that is not working in PDB2PQR. + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Additional command-line tools ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ From a02a7716a3f3c545f4161824c85f0c4416ddb61e Mon Sep 17 00:00:00 2001 From: Nathan Baker Date: Mon, 3 Jul 2023 11:34:00 -0700 Subject: [PATCH 2/3] Add warnings for unused PROPKA options. Fixes #365. --- pdb2pqr/config.py | 7 +++++++ pdb2pqr/main.py | 9 ++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/pdb2pqr/config.py b/pdb2pqr/config.py index f3c6094..a85e00d 100644 --- a/pdb2pqr/config.py +++ b/pdb2pqr/config.py @@ -5,6 +5,13 @@ VERSION = __version__ +#: Options for PROPKA that PDB2PQR cannot handle +IGNORED_PROPKA_OPTIONS = [ + "thermophiles", "chains", "alignment", "mutations", "mutator", + "mutator_options", "reuse_ligand_mol2_file", "keep_protons", + "protonate_all" +] + #: How to format PDB2PQR title in output TITLE_STR = f"PDB2PQR v{VERSION}: biomolecular structure conversion software." diff --git a/pdb2pqr/main.py b/pdb2pqr/main.py index e886801..17bd910 100644 --- a/pdb2pqr/main.py +++ b/pdb2pqr/main.py @@ -26,7 +26,7 @@ from .ligand.mol2 import Mol2Molecule from .utilities import noninteger_charge from .config import VERSION, TITLE_STR, CITATIONS, FORCE_FIELDS -from .config import REPAIR_LIMIT +from .config import REPAIR_LIMIT, IGNORED_PROPKA_OPTIONS _LOGGER = logging.getLogger(f"PDB2PQR{VERSION}") @@ -279,6 +279,13 @@ def check_options(args): :type args: argparse.Namespace :raises RuntimeError: silly option combinations were encountered. """ + for option in IGNORED_PROPKA_OPTIONS: + if option in args: + _LOGGER.warn( + f"PROPKA option '{option}' is not processed correctly by " + f"PDB2PQR. Ignoring." + ) + args.__dict__.pop(option) if (args.ph < 0) or (args.ph > 14): err = ( f"Specified pH ({args.ph}) is outside the range " From 04bc0071c64e4e9f30639fd6d323b32674ae16e8 Mon Sep 17 00:00:00 2001 From: Nathan Baker Date: Mon, 3 Jul 2023 13:28:19 -0700 Subject: [PATCH 3/3] Fixed dumb use of 'pop'. Replace values instead of removing attributes. --- pdb2pqr/config.py | 16 +++++++++++----- pdb2pqr/main.py | 14 ++++++++------ 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/pdb2pqr/config.py b/pdb2pqr/config.py index a85e00d..58dacd9 100644 --- a/pdb2pqr/config.py +++ b/pdb2pqr/config.py @@ -6,11 +6,17 @@ #: Options for PROPKA that PDB2PQR cannot handle -IGNORED_PROPKA_OPTIONS = [ - "thermophiles", "chains", "alignment", "mutations", "mutator", - "mutator_options", "reuse_ligand_mol2_file", "keep_protons", - "protonate_all" -] +IGNORED_PROPKA_OPTIONS = { + "thermophiles": None, + "chains": None, + "alignment": None, + "mutations": None, + "mutator": None, + "mutator_options": None, + "reuse_ligand_mol2_file": False, + "keep_protons": False, + "protonate_all": False +} #: How to format PDB2PQR title in output TITLE_STR = f"PDB2PQR v{VERSION}: biomolecular structure conversion software." diff --git a/pdb2pqr/main.py b/pdb2pqr/main.py index 17bd910..ffba7e0 100644 --- a/pdb2pqr/main.py +++ b/pdb2pqr/main.py @@ -279,13 +279,15 @@ def check_options(args): :type args: argparse.Namespace :raises RuntimeError: silly option combinations were encountered. """ - for option in IGNORED_PROPKA_OPTIONS: + for option, new_value in IGNORED_PROPKA_OPTIONS.items(): if option in args: - _LOGGER.warn( - f"PROPKA option '{option}' is not processed correctly by " - f"PDB2PQR. Ignoring." - ) - args.__dict__.pop(option) + value = getattr(args, option) + if value: + _LOGGER.warning( + f"PROPKA option '{option}' {getattr(args, option)} is not " + f"processed correctly by PDB2PQR. Ignoring." + ) + setattr(args, option, new_value) if (args.ph < 0) or (args.ph > 14): err = ( f"Specified pH ({args.ph}) is outside the range "