[Rdkit-discuss] How do rdFingerprintGenerator.GetMorganGenerator and AllChem.GetMorganFingerprintAs
Open-Source Cheminformatics and Machine Learning
Brought to you by:
glandrum
From: Lewis M. <lew...@gm...> - 2019-07-10 01:51:56
|
Hi all, Quick question on truncated fingerprints, any help is really appreciated. I think I've missed a trick on how the new fingerprint generator works. I thought the below should produce equivalent fingerprints but they are totally different. Has the implementation changed, or maybe I'm getting the kwargs incorrect? See below code or this link for a quick visual: https://github.com/ljmartin/snippets/blob/master/truncated_fingerprints.ipynb Thanks ! import rdkit from rdkit import Chem from rdkit.Chem import Draw, AllChem from rdkit.Chem import rdFingerprintGenerator from rdkit.Chem.Draw import IPythonConsole import numpy as np from scipy.spatial import distance mol = Chem.MolFromSmiles('CN1C(=O)CN=C(C2=C1C=CC(=C2)Cl)C3=CC=CC=C3') #diazepam gen_mo = rdFingerprintGenerator.GetMorganGenerator(fpSize=256, radius=2) a = gen_mo.GetFingerprint(mol) b = AllChem.GetMorganFingerprintAsBitVect(mol,2,256,useFeatures=False) a_f = [int(i) for i in a.ToBitString()] b_f = [int(i) for i in b.ToBitString()] print('NumBits a: %s, NumBits b: %s' % (np.sum(a_f), np.sum(b_f))) print('Dice Distance %s' % distance.dice(a_f,b_f)) NumBits a: 47, NumBits b: 38 Dice Distance 0.9058823529411765 |