Commit eb68b349 authored by Jacob Durrant's avatar Jacob Durrant

Minor updates.

parent 6c8aca90
Pipeline #314 failed with stages
...@@ -6,6 +6,9 @@ Changes ...@@ -6,6 +6,9 @@ Changes
* Updated protonation of nitrogen, oxygen, and sulfur atoms to be compatible * Updated protonation of nitrogen, oxygen, and sulfur atoms to be compatible
with the latest version of RDKit, which broke backwards compatibility. with the latest version of RDKit, which broke backwards compatibility.
* Added "silent" option to suppress all output.
* Added code to suppress unnecessary RDKit warnings.
* Updated copyright to 2020.
1.2.2 1.2.2
----- -----
......
...@@ -35,7 +35,7 @@ usage: dimorphite_dl.py [-h] [--min_ph MIN] [--max_ph MAX] ...@@ -35,7 +35,7 @@ usage: dimorphite_dl.py [-h] [--min_ph MIN] [--max_ph MAX]
[--label_states] [--test] [--label_states] [--test]
Dimorphite 1.2.3: Creates models of appropriately protonated small moleucles. Dimorphite 1.2.3: Creates models of appropriately protonated small moleucles.
Apache 2.0 License. Copyright 2018 Jacob D. Durrant. Apache 2.0 License. Copyright 2020 Jacob D. Durrant.
optional arguments: optional arguments:
-h, --help show this help message and exit -h, --help show this help message and exit
......
# Copyright 2018 Jacob D. Durrant # Copyright 2020 Jacob D. Durrant
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
...@@ -30,19 +30,25 @@ except ImportError: ...@@ -30,19 +30,25 @@ except ImportError:
# Python3 # Python3
from io import StringIO from io import StringIO
# Always let the user know a help file is available. def print_header():
print("\nFor help, use: python dimorphite_dl.py --help") """Prints out header information."""
# Always let the user know a help file is available.
print("\nFor help, use: python dimorphite_dl.py --help")
# And always report citation information. # And always report citation information.
print("\nIf you use Dimorphite-DL in your research, please cite:") print("\nIf you use Dimorphite-DL in your research, please cite:")
print("Ropp PJ, Kaminsky JC, Yablonski S, Durrant JD (2019) Dimorphite-DL: An") print("Ropp PJ, Kaminsky JC, Yablonski S, Durrant JD (2019) Dimorphite-DL: An")
print("open-source program for enumerating the ionization states of drug-like small") print("open-source program for enumerating the ionization states of drug-like small")
print("molecules. J Cheminform 11:14. doi:10.1186/s13321-019-0336-9.\n") print("molecules. J Cheminform 11:14. doi:10.1186/s13321-019-0336-9.\n")
try: try:
import rdkit import rdkit
from rdkit import Chem from rdkit import Chem
from rdkit.Chem import AllChem from rdkit.Chem import AllChem
# Disable the unnecessary RDKit warnings
from rdkit import RDLogger
RDLogger.DisableLog("rdApp.*")
except: except:
msg = "Dimorphite-DL requires RDKit. See https://www.rdkit.org/" msg = "Dimorphite-DL requires RDKit. See https://www.rdkit.org/"
print(msg) print(msg)
...@@ -61,6 +67,8 @@ def main(params=None): ...@@ -61,6 +67,8 @@ def main(params=None):
parser = ArgParseFuncs.get_args() parser = ArgParseFuncs.get_args()
args = vars(parser.parse_args()) args = vars(parser.parse_args())
if not args["silent"]:
print_header()
# Add in any parameters in params. # Add in any parameters in params.
if params is not None: if params is not None:
...@@ -69,10 +77,11 @@ def main(params=None): ...@@ -69,10 +77,11 @@ def main(params=None):
# If being run from the command line, print out all parameters. # If being run from the command line, print out all parameters.
if __name__ == "__main__": if __name__ == "__main__":
print("\nPARAMETERS:\n") if not args["silent"]:
for k in sorted(args.keys()): print("\nPARAMETERS:\n")
print(k.rjust(13) + ": " + str(args[k])) for k in sorted(args.keys()):
print("") print(k.rjust(13) + ": " + str(args[k]))
print("")
if args["test"]: if args["test"]:
# Run tests. # Run tests.
...@@ -139,7 +148,7 @@ class ArgParseFuncs: ...@@ -139,7 +148,7 @@ class ArgParseFuncs:
parser = MyParser(description="Dimorphite 1.2.3: Creates models of " + parser = MyParser(description="Dimorphite 1.2.3: Creates models of " +
"appropriately protonated small moleucles. " + "appropriately protonated small moleucles. " +
"Apache 2.0 License. Copyright 2018 Jacob D. " + "Apache 2.0 License. Copyright 2020 Jacob D. " +
"Durrant.") "Durrant.")
parser.add_argument('--min_ph', metavar='MIN', type=float, default=6.4, parser.add_argument('--min_ph', metavar='MIN', type=float, default=6.4,
help='minimum pH to consider (default: 6.4)') help='minimum pH to consider (default: 6.4)')
...@@ -158,6 +167,8 @@ class ArgParseFuncs: ...@@ -158,6 +167,8 @@ class ArgParseFuncs:
parser.add_argument('--label_states', action="store_true", parser.add_argument('--label_states', action="store_true",
help='label protonated SMILES with target state ' + \ help='label protonated SMILES with target state ' + \
'(i.e., "DEPROTONATED", "PROTONATED", or "BOTH").') '(i.e., "DEPROTONATED", "PROTONATED", or "BOTH").')
parser.add_argument('--silent', action="store_true",
help='do not print any messages to the screen')
parser.add_argument('--test', action="store_true", parser.add_argument('--test', action="store_true",
help='run unit tests (for debugging)') help='run unit tests (for debugging)')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment