Created
January 9, 2023 15:00
-
-
Save dehaenw/fecaddb549eb86cc3a4e5c2a02590e10 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import rdkit | |
from rdkit import Chem | |
from rdkit.Chem import ChemicalFeatures | |
from rdkit.Chem.Pharm2D.SigFactory import SigFactory | |
from rdkit.Chem.Pharm2D import Generate | |
from rdkit import RDConfig | |
import os | |
featFactory = ChemicalFeatures.BuildFeatureFactory(os.path.join(RDConfig.RDDataDir,'BaseFeatures.fdef')) | |
sigFactory = SigFactory(featFactory,minPointCount=2,maxPointCount=3,trianglePruneBins=False) | |
sigFactory.SetBins([(0,2),(2,5),(5,8)]) | |
sigFactory.Init() | |
print("length of the fp is",sigFactory.GetSigSize()) | |
print("the features are",featFactory.GetFeatureFamilies()) | |
mol = Chem.MolFromSmiles("[NH3+]CCc1ccccc1C(=O)[O-]") | |
fp = Generate.Gen2DFingerprint(mol,sigFactory) | |
print("# of on bits (= hit 2point and 3point pharmacophores) is",sum(fp)) | |
print("hit pharmacophores are:",[SigFactory.GetBitDescription(sigFactory,i) for i,bit in enumerate(fp) if bit==1]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment