Skip to content

Commit

Permalink
Add try-catch
Browse files Browse the repository at this point in the history
  • Loading branch information
amorehead committed May 31, 2024
1 parent 99d41d9 commit e6dbbe3
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/models/vina_inference.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,10 +271,16 @@ def run_vina_inference(
if pdbqt_string:
with open(prepared_ligand_filepath, "w") as f:
f.write(pdbqt_string)
assert os.path.exists(
prepared_ligand_filepath
), f"Prepared ligand file not found: {prepared_ligand_filepath}"
prepared_ligand_filepaths.append(prepared_ligand_filepath)
try:
assert os.path.exists(
prepared_ligand_filepath
), f"Prepared ligand file not found: {prepared_ligand_filepath}"
prepared_ligand_filepaths.append(prepared_ligand_filepath)
except AssertionError as e:
logger.warning(
f"Prepared ligand file not found: {prepared_ligand_filepath}. Skipping..."
)
return None

# run AutoDock Vina
binding_site = ligand_binding_site_mapping[ligand_filepaths]
Expand Down

0 comments on commit e6dbbe3

Please sign in to comment.