pychembldb is a Python interface for ChEMBLdb
- Python 3.7 or later (not support 2.x)
- MySQL-python >= 1.2.4 or psycopg2 >= 2.5.1
- SQLAlchemy >= 1.3.1
- pychembldb-0.1.x support chembl_14 and Python2.7
- pychembldb-0.2.x support chembl_15, 16 and Python2.7
- pychembldb-0.3.x support chembl_17,18,19 and Python2.7
- pychembldb-0.4.0 support chembl_25 and Python3.7
pip install pychembldb
or install from github
git clone https://github.com/kzfm/pychembldb.git cd pychembldb sudo python setup.py install or pip install -e .
if you change engine_url, you should set CHEMBL_URI environment variable (default:mysql://root@localhost/chembl_25)
ex) PostgreSQL
export CHEMBL_URI="postgresql+psycopg2://localhost/chembl_25" or export CHEMBL_URI="postgresql+psycopg2://USER:PASSWORD@localhost/chembl_25"
from pychembldb import * for target in chembldb.query(Target).filter_by(pref_name="Tyrosine-protein kinase ABL"): for assay in target.assays: for activity in assay.activities: print(activity.value, activity.compound.molecule.structure.standard_inchi_key)
filter activities and compound structures by Target(Protein).
from pychembldb import * for target in chembldb.query(Target).filter_by(pref_name="Tyrosine-protein kinase ABL"): for assay in target.assays: for activity in assay.activities: print(activity.value, activity.compound.molecule.structure.standard_inchi_key)
Search activities and compound structures from Journal-ID(doi).
for journal in chembldb.query(Doc).filter_by(doi="10.1016/S0960-894X(01)80693-4"): for assay in journal.assays: for activity in assay.activities: print(activity.standard_value, activity.compound.molecule.structure.standard_inchi_key)
Get SMILES from Molecule synonyms.
chembldb.query(MoleculeSynonym).filter_by(synonyms="Gleevec").first().molecule.structure.canonical_smiles # 'CN1CCN(Cc2ccc(cc2)C(=O)Nc3ccc(C)c(Nc4nccc(n4)c5cccnc5)c3)CC1'
Get Target, MoA, and Molecular name
for dm in chembldb.query(DrugMechanism).limit(10): print("{0}/{1}: ({2})".format(dm.target.pref_name, dm.mechanism_of_action, dm.molecule.pref_name)) # Carbonic anhydrase VII/Carbonic anhydrase VII inhibitor: (METHAZOLAMIDE) # Carbonic anhydrase I/Carbonic anhydrase I inhibitor: (METHOCARBAMOL) # Carbonic anhydrase I/Carbonic anhydrase I inhibitor: (ACETAZOLAMIDE SODIUM) # Carbonic anhydrase I/Carbonic anhydrase I inhibitor: (DICHLORPHENAMIDE) # Carbonic anhydrase I/Carbonic anhydrase I inhibitor: (ACETAZOLAMIDE) # Carbonic anhydrase I/Carbonic anhydrase I inhibitor: (METHAZOLAMIDE) # Cytochrome b/Cytochrome b inhibitor: (ATOVAQUONE) # Muscarinic acetylcholine receptor M3/Muscarinic acetylcholine receptor M3 antagonist: (TRIDIHEXETHYL CHLORIDE) # Muscarinic acetylcholine receptor M3/Muscarinic acetylcholine receptor M3 antagonist: (TOLTERODINE TARTRATE) # Muscarinic acetylcholine receptor M3/Muscarinic acetylcholine receptor M3 antagonist: (PROPANTHELINE BROMIDE)
Display trade names and their target proteins
for p in chembldb.query(Product).limit(10): for m in p.molecules: for t in m.targets: print("{0} ({1}) - {2}".format(p.trade_name, m.pref_name, t.pref_name))
See also.
- https://docs.sqlalchemy.org/en/13/
- ftp://ftp.ebi.ac.uk/pub/databases/chembl/ChEMBLdb/latest/chembl_25_schema.png
- Fix some relations
- Support ChEMBLdb 25
- Only Support Python 3.7
- Support ChEMBLdb 19
- Update document
- Support ATC Classifications
- Support ChEMBLdb 18
- Fix bug
- Support ChEMBLdb 17
- Support ChEMBLdb 16
- Support ChEMBLdb 15
- Several bug fixes
- Add synonyms relation
- first release