Skip to content

Commit

Permalink
Improved --silent option.
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobdurrant committed Jun 4, 2020
1 parent ca78cde commit f888d30
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions dimorphite_dl.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
Expand All @@ -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
)
Expand All @@ -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
)
Expand Down Expand Up @@ -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"])
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit f888d30

Please sign in to comment.