chembl-database
Original:🇺🇸 English
Translated
1 scripts
Query the ChEMBL database for bioactive molecules, drug targets, bioactivity data, approved drugs, and chemical structures. Use when the user asks about compounds, targets, IC50/Ki values, drug mechanisms, or structure searches.
12installs
Added on
NPX Install
npx skill4agent add google-deepmind/science-skills chembl-databaseTags
Translated version includes tags in frontmatterSKILL.md Content
View Translation Comparison →ChEMBL Database Query
Prerequisites
- : Read the
uvskill and follow its Setup instructions to ensureuvis installed and on PATH.uv - User Notification: If LICENSE_NOTIFICATION.txt does not already exist in this skill directory then (1) prominently notify the user to check the terms at https://chembl.gitbook.io/chembl-interface-documentation/about, then (2) create the file recording the notification text and timestamp.
Core Rules
-
[!IMPORTANT] Use the Utility Scripts: You MUST ALWAYS use the provided utility scriptfor all ChEMBL API interactions, including checking status. NEVER use
scripts/chembl_api.pyor custom Python requests to query the ChEMBL API directly. This ensures rate limit is enfoced and also retries on network errors.curl -
Output to File (Required): Theflag is required for every subcommand. All JSON results are written to the specified file. After running the command, read the output file with jq or your own code to extract the data. List results are typically wrapped in a JSON array keyed by the endpoint name (e.g.,
--output,molecules).activities -
Notification: If this skill is used, ensure this is mentioned in the output.
Utility Script
All ChEMBL API queries use one script with subcommands:
bash
uv run scripts/chembl_api.py <subcommand> --output <file> [options]1. Check API Status
bash
uv run scripts/chembl_api.py status --output /tmp/status.json2. Molecule Queries
Fetch by ChEMBL ID:
bash uv run scripts/chembl_api.py molecule --id CHEMBL25 --output /tmp/mol.jsonSearch by name:
bash uv run scripts/chembl_api.py molecule --search "aspirin" --limit 3 --output /tmp/mol_search.jsonBatch fetch:
bash uv run scripts/chembl_api.py molecule --ids "CHEMBL25;CHEMBL1642" --limit 10 --output /tmp/mol_batch.jsonFilter by properties:
bash uv run scripts/chembl_api.py molecule --filter molecule_properties__mw_freebase__lte=500 --limit 5 --output /tmp/mol_filter.jsonFilter by range:
bash uv run scripts/chembl_api.py molecule --filter molecule_properties__mw_freebase__range=150,200 --limit 5 --output /tmp/mol_range.jsonDownload SDF structure file:
bash uv run scripts/chembl_api.py molecule --id CHEMBL25 --dl_format sdf --output /tmp/aspirin.sdfTip: SDF/MOL files can be passed directly to tools like PyMOL or RDKit for 3D visualization and analysis.
3. Target Queries
Search for targets:
bash uv run scripts/chembl_api.py target --search "EGFR" --limit 5 --output /tmp/targets.jsonFetch by ID:
bash uv run scripts/chembl_api.py target --id CHEMBL203 --output /tmp/egfr.json4. Bioactivity Data
Fetch activity by ID:
bash uv run scripts/chembl_api.py activity --id 31863 --output /tmp/act.jsonSearch activities:
bash uv run scripts/chembl_api.py activity --search "EGFR" --limit 5 --output /tmp/act_search.jsonFilter activities for a target:
bash uv run scripts/chembl_api.py activity --filter target_chembl_id=CHEMBL203 standard_type=IC50 --limit 10 --output /tmp/egfr_ic50.jsonNormalize bioactivity units to nM:
bash uv run scripts/chembl_api.py activity --filter target_chembl_id=CHEMBL203 standard_type=IC50 --limit 5 --normalize --output /tmp/egfr_normalized.jsonImportant: Bioactivity values come in various units (nM, µM, pM). Useto convert all values to nM for consistent comparison. Each record will include--normalizeandnormalized_value_nM.normalization_note
5. Drug Information
Fetch drug details:
bash uv run scripts/chembl_api.py drug --id CHEMBL25 --output /tmp/drug.jsonDrug indications:
bash uv run scripts/chembl_api.py drug_indication --filter molecule_chembl_id=CHEMBL25 --limit 10 --output /tmp/indications.jsonFilter indications by phase:
bash uv run scripts/chembl_api.py drug_indication --filter molecule_chembl_id=CHEMBL25 max_phase_for_ind=4.0 --limit 10 --output /tmp/approved_indications.jsonDrug warnings:
bash uv run scripts/chembl_api.py drug_warning --limit 5 --output /tmp/warnings.jsonMechanisms of action:
bash uv run scripts/chembl_api.py mechanism --filter molecule_chembl_id=CHEMBL25 --limit 5 --output /tmp/mech.json6. Structure-Based Searches
Note: Both similarity and substructure searches are performed server-side on ChEMBL's pre-indexed database. They do not require a local RDKit installation.
Similarity search (SMILES + threshold):
bash uv run scripts/chembl_api.py similarity --smiles "CC(=O)Oc1ccccc1C(=O)O" --similarity 85 --limit 5 --output /tmp/similar.jsonSubstructure search (SMILES):
bash uv run scripts/chembl_api.py substructure --smiles "c1ccccc1" --limit 5 --output /tmp/substruct.json7. Compound Image
Download a 2D structure image (SVG by default, scalable for publication):
bash
uv run scripts/chembl_api.py image --id CHEMBL25 --output /tmp/chembl25.svgOptions:
- : Image size in pixels (max 500, default 500).
--dimensions - : Rendering engine (default: rdkit).
--engine - : Output format —
--img_format(default, vector) orsvg(raster).png
8. Cross-Referencing with Other Databases
ChEMBL integrates with UniProt, Ensembl, PubChem, and other databases. Common
cross-referencing patterns:
Find a ChEMBL target from a UniProt accession:
bash uv run scripts/chembl_api.py target --filter target_components__accession=P00533 --limit 5 --output /tmp/uniprot_target.jsonResolve any ChEMBL ID to its entity type:
bash uv run scripts/chembl_api.py chembl_id_lookup --id CHEMBL203 --output /tmp/lookup.jsonLook up cross-reference sources:
bash uv run scripts/chembl_api.py xref_source --limit 10 --output /tmp/xrefs.jsonTip: Use theendpoint to find UniProt accessions, gene names, and protein sequences for any ChEMBL target.target_component
9. Pagination
All list endpoints support and for pagination:
--limit--offsetbash
# First page: 2 results starting at offset 0
uv run scripts/chembl_api.py molecule --limit 2 --offset 0 --output /tmp/page1.json
# Second page: next 2 results starting at offset 2
uv run scripts/chembl_api.py molecule --limit 2 --offset 2 --output /tmp/page2.jsonThe response includes with , , , ,
and links. Use successive values to page through large
result sets.
page_metatotal_countlimitoffsetnextprevious--offset10. Other Endpoints
All remaining endpoints follow the same pattern:
bash
uv run scripts/chembl_api.py <subcommand> --output <file> [--id ID | --ids ID1;ID2 | --search QUERY] [--limit N] [--offset N] [--filter KEY=VAL ...]Key subcommands at a glance:
- (searchable: true): Molecules/compounds — the primary entry point
molecule - (searchable: true): Drug targets (proteins, organisms, etc.)
target - (searchable: true): Bioactivity data (IC50, Ki, EC50, etc.)
activity - (searchable: false): Approved drugs
drug - (searchable: false): Mechanisms of action
mechanism - (searchable: true): Assay descriptions
assay - (searchable: false): Similarity search (special)
similarity - (searchable: false): Substructure search (special)
substructure - (searchable: false): Compound image download (special)
image
Full subcommand list:
- (searchable: false): Supplementary activity data
activity_supp - (searchable: false): Assay classifications
assay_class - (searchable: false): ATC drug classifications
atc_class - (searchable: false): Binding site information
binding_site - (searchable: false): Biotherapeutic molecules
biotherapeutic - (searchable: false): Cell line details
cell_line - (searchable: true): ChEMBL ID resolution
chembl_id_lookup - (searchable: false): Database release info
chembl_release - (searchable: false): Compound records
compound_record - (searchable: false): Structural alerts
compound_structural_alert - (searchable: true): Literature documents
document - (searchable: false): Document similarity
document_similarity - (searchable: false): Drug indications
drug_indication - (searchable: false): Drug safety warnings
drug_warning - (searchable: false): GO slim terms
go_slim - (searchable: false): Metabolism data
metabolism - (searchable: false): Molecule forms (salts/parents)
molecule_form - (searchable: false): Organisms
organism - (searchable: true): Protein classifications
protein_classification - (searchable: false): Data sources
source - (searchable: false): Target protein components
target_component - (searchable: false): Target relationships
target_relation - (searchable: false): Tissue types
tissue - (searchable: false): Cross-reference sources
xref_source - (searchable: false): API status check (special)
status
Common Options
- : Required. Output file path for JSON results.
--output FILE - : Fetch a single record by ID.
--id ID - : Batch fetch multiple records.
--ids ID1;ID2;... - : Free-text search (only for searchable endpoints, marked ✓).
--search QUERY - : Max results to return (default: 5).
--limit N - : Pagination offset.
--offset N - : Filter parameters (can specify multiple).
--filter KEY=VAL - : (activity only) Normalize values to nM.
--normalize - : (molecule only) Download structure file.
--dl_format sdf|mol
Reference
- API Endpoints Reference: See references/api_endpoints.md for the full list of endpoints and filter operators.
Workflow
- Use to verify the API is available.
status --output /tmp/status.json - Search for targets, molecules, or drugs using the relevant subcommand.
- Read the output JSON file to extract IDs and data.
- Use IDs from search results to fetch detailed records.
- Query with filters to get bioactivity data for targets/molecules. Use
activitywhen comparing values across studies.--normalize - Use or
similarityfor server-side structure-based queries.substructure - Download compound images with or structure files with
image.molecule --dl_format sdf - Use to cross- reference with UniProt.
target --filter target_components__accession=<UniProt>