Last active
March 6, 2019 16:31
-
-
Save avbelyaev/f4c390457d20cfb6561dc3f79f085864 to your computer and use it in GitHub Desktop.
This file contains 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 openbabel as ob | |
import pybel | |
ASPIRIN = "CC(=O)OC1=CC=CC=C1C(=O)O" | |
SALICIL = "C1=CC=C(C(=C1)C(=O)O)O" | |
smiles = [ASPIRIN, SALICIL] | |
mols = [pybel.readstring("smi", x) for x in smiles] | |
for mol in mols: | |
mol.OBMol.AddHydrogens() | |
fps = [x.calcfp() for x in mols] | |
print fps[0].bits, fps[1].bits | |
print fps[0] | fps[1] |
This file contains 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
from rdkit import Chem | |
from rdkit.Chem import AllChem, Draw, Descriptors | |
BENZENE = "C1=CCC=CC=C1" | |
METH = "CC(CC1=CC=CC=C1)NC" | |
m = Chem.MolFromSmiles(BENZENE) | |
# add hydrogen | |
m_hydrogenized = Chem.AddHs(m) | |
Draw.MolToFile(m_hydrogenized, 'cdk2_mol1.o.png') | |
for desc in Descriptors._descList: | |
desc_name = desc[0] | |
desc_value = desc[1](m_hydrogenized) | |
print(str(desc_value) + "\t" + desc_name) | |
# http://www.qsar4u.com/files/rdkit_tutorial/rdkit.html |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment