diff --git a/CHANGELOG.md b/CHANGELOG.md index 93551a35e..49065288a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed - [WIP] `torch` is loaded lazily - Full lookup backtesting example now tests different substance encodings +- Replaced unmaintained `mordred` dependency by `mordredcommunity` ## [0.8.0] - 2024-02-29 ### Changed diff --git a/baybe/utils/chemistry.py b/baybe/utils/chemistry.py index a8d895cfe..cf7e4001d 100644 --- a/baybe/utils/chemistry.py +++ b/baybe/utils/chemistry.py @@ -23,6 +23,8 @@ """chemistry dependencies. Please run "pip install 'baybe[chem]'".""" ) +from baybe.utils.numerical import DTypeFloatNumpy + _mordred_calculator = Calculator(descriptors) @@ -86,10 +88,13 @@ def _smiles_to_mordred_features(smiles: str) -> np.ndarray: """ try: return np.asarray( - _mordred_calculator(Chem.MolFromSmiles(smiles)).fill_missing() + _mordred_calculator(Chem.MolFromSmiles(smiles)).fill_missing(), + dtype=DTypeFloatNumpy, ) except Exception: - return np.full(len(_mordred_calculator.descriptors), np.NaN) + return np.full( + len(_mordred_calculator.descriptors), np.NaN, dtype=DTypeFloatNumpy + ) def smiles_to_mordred_features( diff --git a/docs/userguide/parameters.md b/docs/userguide/parameters.md index dd04c29c0..377ac14ca 100644 --- a/docs/userguide/parameters.md +++ b/docs/userguide/parameters.md @@ -128,7 +128,8 @@ SubstanceParameter( ``` The ``encoding`` option defines what kind of descriptors are calculated: -* ``MORDRED``: 2D descriptors from the [Mordred package](https://mordred-descriptor.github.io/documentation/master/) +* ``MORDRED``: 2D descriptors from the [Mordred package](https://mordred-descriptor.github.io/documentation/master/). + Since the original package is now unmaintained, baybe requires the community replacement [mordredcommunity](https://github.com/JacksonBurns/mordred-community) * ``RDKIT``: 2D descriptors from the [RDKit package](https://www.rdkit.org/) * ``MORGAN_FP``: Morgan fingerprints calculated with RDKit (1024 bits, radius 4) diff --git a/pyproject.toml b/pyproject.toml index 8ce093fee..0b694ca85 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -63,7 +63,7 @@ Issues = "https://github.com/emdgroup/baybe/issues/" [project.optional-dependencies] chem = [ "rdkit>=2022.3.4", - "mordred>=1.2.0", + "mordredcommunity>=1.2.0", ] onnx = [