Skip to content

Commit

Permalink
45 tests use old fingerprint method (part 2) (#53)
Browse files Browse the repository at this point in the history
update tests to GetMorganGenerator
  • Loading branch information
c-w-feldmann authored Jul 17, 2024
1 parent 188edb2 commit bcf9157
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions tests/utils/fingerprints.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from rdkit import Chem

# pylint: disable=no-name-in-module
from rdkit.Chem.AllChem import GetMorganFingerprintAsBitVect
from rdkit.Chem import rdFingerprintGenerator as rdkit_fp
from rdkit.DataStructs import ExplicitBitVect
from scipy import sparse

Expand All @@ -34,9 +34,10 @@ def make_sparse_fp(
Feature matrix.
"""
vector_list = []
morgan_fp = rdkit_fp.GetMorganGenerator(radius=radius, fpSize=n_bits)
for smiles in smiles_list:
mol = Chem.MolFromSmiles(smiles) # pylint: disable=no-member
vector = GetMorganFingerprintAsBitVect(mol, radius=radius, nBits=n_bits)
vector = morgan_fp.GetFingerprintAsNumPy(mol)
vector_list.append(sparse.csr_matrix(vector))
return sparse.vstack(vector_list)

Expand Down

0 comments on commit bcf9157

Please sign in to comment.