Skip to content

Instantly share code, notes, and snippets.

@aschreyer
Created September 14, 2011 15:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aschreyer/1216888 to your computer and use it in GitHub Desktop.
Save aschreyer/1216888 to your computer and use it in GitHub Desktop.
ChEMBL extension in credoscript
from credoscript.extensions import chembl
m = ma.fetch_by_molregno(410891)
# get all activity cliffs of this molecule
m.get_activity_cliffs(chembl.ActivityCliff.sali>10)
>>> [<ActivityCliff(455590, 2030543, 2030536)>,
<ActivityCliff(455592, 2030585, 2030582)>,
<ActivityCliff(455594, 2030630, 2030623)>,
<ActivityCliff(455591, 2030571, 2030564)>,
<ActivityCliff(455590, 2030543, 2030535)>,
<ActivityCliff(455592, 2030585, 2030581)>,
<ActivityCliff(455591, 2030571, 2030563)>]
# get the activity cliff with the highest SALI index
cliff = m.get_activity_cliffs(chembl.ActivityCliff.sali>10)[0]
cliff.delta_activity, cliff.delta_tanimoto, cliff.sali
>>> (1.44235914846045, 0.0517241379310345, 27.8856102035687)
cliff.ActivityBgn.standard_value, cliff.ActivityBgn.standard_units
>>> (13.0, 'nM')
cliff.ActivityEnd.standard_value, cliff.ActivityEnd.standard_units
>>> (360.0, 'nM')
cliff.MoleculeBgn.Structure.canonical_smiles, cliff.MoleculeEnd.Structure.canonical_smiles
>>> ('CCNC(=O)N1CCC(CC1)Nc2ncc(Cl)c(n2)c3c[nH]c4ccccc34',
'CCNC(=O)N1CCC(C1)Nc2ncc(Cl)c(n2)c3c[nH]c4ccccc34')
# PDB structures linked to this assay
cliff.Assay.Structures
>>> [<Structure(2P33)>]
from credoscript.extensions import chembl
pa = chembl.ProductAdaptor()
products = pa.fetch_all_by_trade_name('GLEEVEC')
for product in products:
for f in product.Formulations:
print f.Molecule, f.Molecule.pref_name
>>> <Molecule(485100)> IMATINIB MESYLATE
<Molecule(485100)> IMATINIB MESYLATE
<Molecule(485100)> IMATINIB MESYLATE
<Molecule(485100)> IMATINIB MESYLATE
m = products[0].Formulations[0].Molecule
m.Hierarchy.Active
>>> <Molecule(88797)>
a = m.Hierarchy.Active
# ligands in CREDO
a.Ligands
>>> [<Ligand(A 3 STI)>,
<Ligand(A 1 STI)>,
<Ligand(A 600 STI)>,
<Ligand(B 600 STI)>,
<Ligand(C 600 STI)>,
<Ligand(D 600 STI)>,
<Ligand(A 233 STI)>,
<Ligand(B 233 STI)>]
from credoscript import *
from credoscript.extensions import chembl
ca = ChemCompAdaptor()
j07 = ca.fetch_by_het_id('J07')
ma = chembl.MoleculeAdaptor()
# fetch compounds from ChEMBL using circular fingerprints and tanimoto similarity
ma.fetch_all_by_sim(j07.ism, fp='circular', threshold=0.8)
>>> [(<Molecule(410891)>, 1.0),
(<Molecule(410898)>, 0.948275862068966),
(<Molecule(410900)>, 0.868852459016393),
(<Molecule(410902)>, 0.868852459016393),
(<Molecule(410899)>, 0.85),
(<Molecule(410892)>, 0.819672131147541),
(<Molecule(410905)>, 0.80952380952381),
(<Molecule(410907)>, 0.806451612903226)]
# fetch compounds by substructure
ma.fetch_all_by_substruct(j07.ism)
>>> [<Molecule(410907)>, <Molecule(410911)>, <Molecule(410891)>]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment