From 41ef57263b5e6baa5c5838694024ef711a94b580 Mon Sep 17 00:00:00 2001 From: Amy He Date: Mon, 9 Dec 2024 11:11:33 -0800 Subject: [PATCH] catch prepare error without interrupting batch processing in mk_prepare_ligand.py --- meeko/cli/mk_prepare_ligand.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/meeko/cli/mk_prepare_ligand.py b/meeko/cli/mk_prepare_ligand.py index b506b7b..bf67a56 100755 --- a/meeko/cli/mk_prepare_ligand.py +++ b/meeko/cli/mk_prepare_ligand.py @@ -637,7 +637,15 @@ def main(): print(error_msg, file=sys.stderr) else: - molsetups = preparator.prepare(mol, rename_atoms=args.rename_atoms) + try: + molsetups = preparator.prepare(mol, rename_atoms=args.rename_atoms) + except Exception as error_msg: + nr_failures += 1 + this_mol_had_failure = True + print(error_msg, file=sys.stderr) + input_mol_with_failure += int(this_mol_had_failure) + continue + if len(molsetups) > 1: output.is_multimol = True suffixes = output.get_suffixes(molsetups)