Skip to content

Commit 1d0feb5

Browse files
author
Oliver Scott
committed
Fix deprecation of GenerateMolHashString, hash is now 'MolNode-SMILES'.
1 parent 003eebd commit 1d0feb5

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

scaffoldgraph/core/graph.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@
1818
from rdkit.Chem.rdMolDescriptors import CalcNumRings
1919

2020
from scaffoldgraph.io import *
21+
from scaffoldgraph import rdversion
2122
from scaffoldgraph.utils import canonize_smiles
23+
2224
from .fragment import get_murcko_scaffold, get_annotated_murcko_scaffold
2325
from .scaffold import Scaffold
2426

@@ -37,7 +39,11 @@ def init_molecule_name(mol):
3739
3840
"""
3941
if not mol.HasProp('_Name') or mol.GetProp('_Name') == '':
40-
n = rdMolHash.GenerateMoleculeHashString(mol)
42+
if rdversion < '2020.09.01':
43+
n = rdMolHash.GenerateMoleculeHashString(mol)
44+
else: # New version deprecated GenrateMolHashString
45+
hashf = rdMolHash.HashFunction.CanonicalSmiles
46+
n = 'MolNode-' + rdMolHash.MolHash(hashf)
4147
mol.SetProp('_Name', n)
4248

4349

0 commit comments

Comments
 (0)