Skip to content

Commit

Permalink
Merge pull request #272 from JacksonBurns/fix/morgangenerator_depreca…
Browse files Browse the repository at this point in the history
…tion

Fix MorganGenerator Deprecation Warning
  • Loading branch information
JacksonBurns authored Aug 13, 2024
2 parents 87cfd0e + 98da34b commit 2afdee7
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 10 deletions.
6 changes: 1 addition & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
fail-fast: false
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
os: [ubuntu-latest, windows-latest, macos-13]
os: [ubuntu-latest, windows-latest, macos-latest]
exclude:
- os: macos-13
python-version: '3.8'
Expand All @@ -59,10 +59,6 @@ jobs:
python -m pip install -r requirements.txt
python -m pip install -e .
python -m pip install coverage
- name: Avoid Problematic Packages on MacOS 13
if: matrix.os == 'macos-13'
run: |
python -m pip install --force-reinstall 'numpy<2' 'scipy<1.14'
- name: Run Tests
run: |
coverage run --source=. --omit=interfaces/*,aimsim/__main__.py,aimsim/tasks/__init__.py,aimsim/ops/__init__.py,aimsim/chemical_datastructures/__init__.py,aimsim/utils/__init__.py,setup.py,tests/*,aimsim/__init__.py,aimsim/utils/plotting_scripts.py -m unittest discover -v
Expand Down
2 changes: 1 addition & 1 deletion aimsim/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@
except ImportError:
pass # aimsim_core does not include this

__version__ = "2.2.1"
__version__ = "2.2.2"
8 changes: 5 additions & 3 deletions aimsim/ops/descriptor.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from rdkit.Chem import rdmolops
from rdkit import Chem
from rdkit import DataStructs
from rdkit.Chem import AllChem
from rdkit.Chem import rdFingerprintGenerator
from rdkit.Chem.Fingerprints import FingerprintMols
from rdkit.Chem import MACCSkeys
from rdkit.Chem.AtomPairs import Pairs, Torsions
Expand Down Expand Up @@ -101,7 +101,8 @@ def _set_morgan_fingerprint(self, molecule_graph, radius, n_bits, **kwargs):
as count.
"""
self.rdkit_ = AllChem.GetMorganFingerprintAsBitVect(molecule_graph, radius, nBits=n_bits, **kwargs)
fpg = rdFingerprintGenerator.GetMorganGenerator(radius=radius, fpSize=n_bits, **kwargs)
self.rdkit_ = fpg.GetFingerprint(molecule_graph)
self.label_ = "morgan_fingerprint"
self.params_ = {"radius": radius, "n_bits": n_bits}

Expand All @@ -127,7 +128,8 @@ def _set_rdkit_topological_fingerprint(self, molecule_graph, min_path, max_path,
f"greater than the minimum path "
f"used for fingerprint."
)
self.rdkit_ = rdmolops.RDKFingerprint(molecule_graph, minPath=min_path, maxPath=max_path)
fpg = rdFingerprintGenerator.GetRDKitFPGenerator(minPath=min_path, maxPath=max_path, **kwargs)
self.rdkit_ = fpg.GetFingerprint(molecule_graph)
self.label_ = "topological_fingerprint"
self.params_ = {"min_path": min_path, "max_path": max_path}

Expand Down
3 changes: 2 additions & 1 deletion tests/test_Descriptor.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@ def test_padelpy_descriptors(self):
with self.assertRaises(ValueError):
descriptor.to_rdkit()

@unittest.skipIf(int(np.__version__[0]) >= 2, "MHFP fails on numpy >2 see https://github.com/reymond-group/mhfp/issues/6")
def test_minhash_fingerprint(self):
"""Test creation of minhash fingerprint"""
mol_graph = MolFromSmiles("CCOCC")
Expand Down Expand Up @@ -303,7 +304,7 @@ def test_exptl_descriptors(self):
"maccs_keys",
"atom-pair_fingerprint",
"torsion_fingerprint",
"minhash_fingerprint",
# "minhash_fingerprint", -> upstream bug, see https://github.com/reymond-group/mhfp/issues/6
]
for desc in fprint_list:
descriptor = Descriptor()
Expand Down

0 comments on commit 2afdee7

Please sign in to comment.