mirror of
https://github.com/rdkit/rdkit.git
synced 2026-06-03 21:44:30 +08:00
Update SA score to use FingerprintGenerators (#7795)
* modernize Contrib/SA_Score/sascorer.py this is impacted by some new deprecation warning: we need to use rdFingerprintGenerator * we need to use the "legacy" Morgan fingerprint length to keep the obtained scores invariant * Update Contrib/SA_Score/sascorer.py Co-authored-by: Greg Landrum <greg.landrum@gmail.com> * Update Contrib/SA_Score/sascorer.py Co-authored-by: Greg Landrum <greg.landrum@gmail.com> --------- Co-authored-by: Francois Berenger <ligand@free.fr> Co-authored-by: Greg Landrum <greg.landrum@gmail.com>
This commit is contained in:
committed by
GitHub
parent
aeb70c4dfc
commit
75771be090
@@ -22,7 +22,7 @@ import pickle
|
||||
from collections import defaultdict
|
||||
|
||||
from rdkit import Chem
|
||||
from rdkit.Chem import rdMolDescriptors
|
||||
from rdkit.Chem import rdMolDescriptors, rdFingerprintGenerator
|
||||
|
||||
_fscores = None
|
||||
|
||||
@@ -46,14 +46,14 @@ def numBridgeheadsAndSpiro(mol, ri=None):
|
||||
nBridgehead = rdMolDescriptors.CalcNumBridgeheadAtoms(mol)
|
||||
return nBridgehead, nSpiro
|
||||
|
||||
mfpgen = rdFingerprintGenerator.GetMorganGenerator(radius=2)
|
||||
|
||||
def calculateScore(m):
|
||||
if _fscores is None:
|
||||
readFragmentScores()
|
||||
|
||||
# fragment score
|
||||
fp = rdMolDescriptors.GetMorganFingerprint(m,
|
||||
2) # <- 2 is the *radius* of the circular fingerprint
|
||||
fp = mfpgen.GetSparseCountFingerprint(m)
|
||||
fps = fp.GetNonzeroElements()
|
||||
score1 = 0.
|
||||
nf = 0
|
||||
|
||||
Reference in New Issue
Block a user