Skip to content

Commit

Permalink
Add legacy sanity check
Browse files Browse the repository at this point in the history
  • Loading branch information
maabuu committed Aug 12, 2024
1 parent b0a1c6b commit a487e22
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
15 changes: 15 additions & 0 deletions posebusters/modules/sanity.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,18 @@ def check_all_atoms_connected(mol_pred: Mol):
details = {"number_fragments": num_frags}

return {"results": results, "details": details}


def check_chemistry(mol_pred: Mol):
"""Check sanity using RDKit and connectedness.
Notes:
- Only for backward compatibility. Use `check_chemistry_using_rdkit` and `check_all_atoms_connected` separately.
"""

rdkit_sanity = check_chemistry_using_rdkit(mol_pred)
connectedness = check_all_atoms_connected(mol_pred)
return {
"results": rdkit_sanity["results"] | connectedness["results"],
"details": rdkit_sanity["details"] | connectedness["details"],
}
9 changes: 7 additions & 2 deletions posebusters/posebusters.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,12 @@
from .modules.intermolecular_distance import check_intermolecular_distance
from .modules.loading import check_loading
from .modules.rmsd import check_rmsd
from .modules.sanity import check_all_atoms_connected, check_chemistry_using_inchi, check_chemistry_using_rdkit
from .modules.sanity import (
check_all_atoms_connected,
check_chemistry,
check_chemistry_using_inchi,
check_chemistry_using_rdkit,
)
from .modules.sucos import check_sucos
from .modules.volume_overlap import check_volume_overlap
from .tools.loading import safe_load_mol, safe_supply_mols
Expand All @@ -30,7 +35,7 @@

module_dict: dict[str, Callable] = {
"loading": check_loading,
"sanity": check_chemistry_using_rdkit, # for backwards compatibility
"sanity": check_chemistry, # for backwards compatibility
"rdkit_sanity": check_chemistry_using_rdkit,
"inchi_convertible": check_chemistry_using_inchi,
"atoms_connected": check_all_atoms_connected,
Expand Down

0 comments on commit a487e22

Please sign in to comment.