Commit f888d306 authored by Jacob Durrant's avatar Jacob Durrant

Improved --silent option.

parent ca78cde2
......@@ -480,7 +480,7 @@ class LoadSMIFile(object):
# 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 @@ class LoadSMIFile(object):
# 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 @@ class LoadSMIFile(object):
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 @@ class Protonate(object):
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 @@ class ProtSubstructFuncs:
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)
......
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