It’s a good news for RDKitters!
New version of rdkit is released and it can be installed with Anaconda!
There are many implementations and enhancements. You can find details of that from URL below.
One of interesting feature is a fingerprint bit information rendering function.
There is nice blog post about that. http://rdkit.blogspot.com/2018/10/using-new-fingerprint-bit-rendering-code.html
And I am interested in new finger print calculation method. This is a project of GSoc.
rdFingerprintGenerator can provide finger print generators. The generator can access directory to fingerprint methods.
I used the method and wrote some code…
from rdkit import Chem from rdkit.Chem import AllChem from rdkit.Chem import rdFingerprintGenerator from rdkit import rdBase from rdkit import RDPaths import os rdBase.rdkitVersion >'2018.09.1'
mols = Chem.SDMolSupplier(os.path.join(RDPaths.RDDocsDir,'Book/data/cdk2.sdf')) mols = [ mol for mol in mols if mol != None]
Get FP generator and calculate FP.
# Default radi of molecule is 3! (ECFP6 like) morgan_fp_gen = rdFingerprintGenerator.GetMorganGenerator() fp01 = morgan_fp_gen.GetFingerprint(mols) fp02 = AllChem.GetMorganFingerprintAsBitVect(mols,3)
The generator returns molecular finger print as bit vect.
And the generator has several useful method listed below.
dir(morgan_fp_gen) >['GetCountFingerprint', > 'GetFingerprint', > 'GetInfoString', > 'GetSparseCountFingerprint', >'GetSparseFingerprint', >snip >]
This example is limited to Morgan FP but the method can get other fingerprints as same manner, AtomPair FP, RDKit FP etc.
The official repository provides example code.
I think the code is written in python2 environments. If reader who want to run the code, I recommend replace ‘print xxx’ to ‘print(xxx)’
And I uploaded my snippet to my repo, ULR is below.