diff --git a/graphium/data/smiles_transform.py b/graphium/data/smiles_transform.py index e498b405f..d6f22fbdc 100644 --- a/graphium/data/smiles_transform.py +++ b/graphium/data/smiles_transform.py @@ -27,7 +27,9 @@ def smiles_to_unique_mol_id(smiles: str) -> Optional[str]: mol_id: a string unique ID """ try: - mol = dm.to_mol(mol=smiles) + mol = dm.to_mol( + mol=smiles + ) # Doesn't need `ordered=True` because the unique_id doesn't depend on the atom order mol_id = dm.unique_id(mol) except: mol_id = "" diff --git a/graphium/features/featurizer.py b/graphium/features/featurizer.py index 7c6afda4c..8d8e18159 100644 --- a/graphium/features/featurizer.py +++ b/graphium/features/featurizer.py @@ -743,7 +743,7 @@ def mol_to_adj_and_features( """ if isinstance(mol, str): - mol = dm.to_mol(mol) + mol = dm.to_mol(mol, ordered=True) # Add or remove explicit hydrogens if explicit_H: @@ -1071,7 +1071,7 @@ def mol_to_graph_dict( input_mol = mol try: if isinstance(mol, str): - mol = dm.to_mol(mol) + mol = dm.to_mol(mol, ordered=True) if explicit_H: mol = Chem.AddHs(mol) else: diff --git a/graphium/features/properties.py b/graphium/features/properties.py index ad4ff5e5e..89a90ffee 100644 --- a/graphium/features/properties.py +++ b/graphium/features/properties.py @@ -18,6 +18,7 @@ import datamol as dm from rdkit.Chem import rdMolDescriptors as rdMD +from loguru import logger def get_prop_or_none( @@ -33,6 +34,7 @@ def get_prop_or_none( Returns: The property or a list of `None` with lenght `n`. """ + logger.warning("get_prop_or_none is deprecated. Use `datamol.to_fp` instead.") try: return prop(*args, **kwargs) except RuntimeError: @@ -75,8 +77,12 @@ def get_props_from_mol( """ + logger.warning("get_props_from_mol is deprecated. Use `datamol.to_fp` instead.") + if isinstance(mol, str): - mol = dm.to_mol(mol) + mol = dm.to_mol( + mol + ) # Doesn't need `ordered=True` because the fingerprints don't depend on the atom order if isinstance(properties, str): properties = [properties] diff --git a/profiling/profile_mol_to_graph.py b/profiling/profile_mol_to_graph.py index a3ee1dbf1..423f487cf 100644 --- a/profiling/profile_mol_to_graph.py +++ b/profiling/profile_mol_to_graph.py @@ -67,7 +67,9 @@ def main(): graphs = [] for s in tqdm(smiles): - mol = dm.to_mol(s) + mol = dm.to_mol( + s + ) # Doesn't need `ordered=True` because this is just to test the speed of the featurizer graphs.append(mol_to_graph_dict(mol, **featurizer)) print(graphs[0])