From f888d306923edcca02b076f5aeeef70f8b99ac91 Mon Sep 17 00:00:00 2001 From: Jacob Durrant Date: Wed, 3 Jun 2020 22:32:34 -0400 Subject: [PATCH] Improved --silent option. --- dimorphite_dl.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/dimorphite_dl.py b/dimorphite_dl.py index 00e320c..73719b1 100644 --- a/dimorphite_dl.py +++ b/dimorphite_dl.py @@ -480,7 +480,7 @@ def next(self): # into a canonical form. Filter if failed. mol = UtilFuncs.convert_smiles_str_to_mol(smiles_str) if mol is None: - if not self.args["silent"]: + if "silent" in self.args and not self.args["silent"]: UtilFuncs.eprint( "WARNING: Skipping poorly formed SMILES string: " + line ) @@ -489,7 +489,7 @@ def next(self): # Handle nuetralizing the molecules. Filter if failed. mol = UtilFuncs.neutralize_mol(mol) if mol is None: - if not self.args["silent"]: + if "silent" in self.args and not self.args["silent"]: UtilFuncs.eprint( "WARNING: Skipping poorly formed SMILES string: " + line ) @@ -499,14 +499,14 @@ def next(self): try: mol = Chem.RemoveHs(mol) except: - if not self.args["silent"]: + if "silent" in self.args and not self.args["silent"]: UtilFuncs.eprint( "WARNING: Skipping poorly formed SMILES string: " + line ) return self.next() if mol is None: - if not self.args["silent"]: + if "silent" in self.args and not self.args["silent"]: UtilFuncs.eprint( "WARNING: Skipping poorly formed SMILES string: " + line ) @@ -630,7 +630,7 @@ def next(self): new_mols = ProtSubstructFuncs.protonate_site(new_mols, site) if len(new_mols) > self.args["max_variants"]: new_mols = new_mols[: self.args["max_variants"]] - if not self.args["silent"]: + if "silent" in self.args and not self.args["silent"]: UtilFuncs.eprint( "WARNING: Limited number of variants to " + str(self.args["max_variants"]) @@ -913,7 +913,7 @@ def set_protonation_charge(mols, idx, charges, prot_site_name): try: mol_copy = Chem.RemoveHs(mol_copy) except: - if not ProtSubstructFuncs.args["silent"]: + if "silent" in ProtSubstructFuncs.args and not ProtSubstructFuncs.args["silent"]: UtilFuncs.eprint( "WARNING: Skipping poorly formed SMILES string: " + Chem.MolToSmiles(mol_copy)