drug-db-pubchem
Skill174 starsChanged 6 months agoMITView on GitHub
Query PubChem via PUG-REST to retrieve CIDs, computed properties, synonyms, and 2D/3D SDF structures.
In this repository133 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- .cursor/rules/atomisticskills.mdcCursor rule
- .cursor/rules/use-agent-skills.mdcCursor rule
- chem-bond-dissociationSkill
- chem-conformer-searchSkill
- chem-db-mofSkill
- chem-db-qmofSkill
- chem-db-spectraSkill
- chem-dft-orca-advanced-calculationSkill
- chem-dft-orca-optimizationSkill
- chem-dft-orca-singlepointSkill
- chem-docking-voidSkill
- chem-hazard-toxicitySkill
- chem-irc-verificationSkill
- chem-msms-predictSkill
- chem-neb-barrierSkill
- chem-nmr-analysisSkill
- chem-nmr-predictSkill
- chem-react-otSkill
- chem-similarity-searchSkill
- chem-solution-mdSkill
- chem-sorption-gcmcSkill
- chem-sorption-relaxSkill
- chem-sorption-widomSkill
- chem-spectrum-matcherSkill
- chem-thermochemistrySkill
- chem-ts-optimizationSkill
- chem-vibrationSkill
- drug-admet-predictionSkill
- drug-binding-site-definitionSkill
- drug-bioactivity-assaySkill
- drug-complex-system-builderSkill
- drug-db-chemblSkill
- drug-db-pdbSkill
- drug-docking-analysisSkill
- drug-docking-vinaSkill
- drug-ligand-prepSkill
- drug-mmpbsa-gbsaSkill
- drug-molecular-fingerprintsSkill
- drug-pocket-detectionSkill
- drug-pose-validationSkill
- drug-protein-ligand-mdSkill
- drug-protein-prepSkill
- drug-redocking-rmsdSkill
- drug-retrosynthesisSkill
- drug-trajectory-analysisSkill
- general-arxiv-searchSkill
- general-biorxiv-searchSkill
- general-chemical-literatureSkill
- general-chemical-pricingSkill
- general-deep-researchSkill
- general-fair-data-reviewSkill
- general-patent-searchSkill
- general-peer-reviewSkill
- general-plot-digitizerSkill
- general-presentationSkill
- general-property-unitsSkill
- general-publisher-access-guardSkill
- general-query-literature-databaseSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
1 rule. About 0 are common, 0 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 21
Look up a compound by its common name.
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
PubChem Database Query
Goal
To programmatically query the PubChem Compound database using the PUG-REST API and retrieve:
- PubChem Compound IDs (CIDs) from names, SMILES, InChI, InChIKey, or molecular formulas,
- computed molecular properties (e.g., molecular weight, XLogP, TPSA, HBD/HBA),
- optional synonyms (names/identifiers),
- optional structure files (SDF), preferring 3D records when available.
This skill is designed for reproducible, rate-limited queries suitable for automation workflows.
Instructions
1. Search by Compound Name
Look up a compound by its common name. Use --name_type complete (default) for exact match or --name_type word for partial matching.
# Env: base-agent
python .agents/skills/drug-db-pubchem/scripts/query_pubchem.py \
--name "aspirin" \
--name_type complete \
--max_results 5 \
--outdir research/pubchem/aspirin \
--output aspirin.jsonFor partial name matching (can be noisier):
# Env: base-agent
python .agents/skills/drug-db-pubchem/scripts/query_pubchem.py \
--name "atorvastatin" \
--name_type word \
--max_results 10 \
--outdir research/pubchem/atorvastatin \
--output atorvastatin_word.json2. Search by SMILES
SMILES may contain characters reserved by URL syntax; this script uses HTTP POST to avoid common failures.
# Env: base-agent
python .agents/skills/drug-db-pubchem/scripts/query_pubchem.py \
--smiles "CC(=O)Oc1ccccc1C(=O)O" \
--max_results 5 \
--outdir research/pubchem/aspirin_smiles \
--output aspirin_smiles.json3. Search by CID
Most unambiguous lookup method.
# Env: base-agent
python .agents/skills/drug-db-pubchem/scripts/query_pubchem.py \
--cid 2244 \
--outdir research/pubchem/CID_2244 \
--output cid_2244.json4. Search by InChI or InChIKey
InChI uses HTTP POST (like SMILES) to avoid URL syntax issues.
# Env: base-agent
python .agents/skills/drug-db-pubchem/scripts/query_pubchem.py \
--inchikey "BSYNRYMUTXBXSQ-UHFFFAOYSA-N" \
--outdir research/pubchem/aspirin_inchikey \
--output aspirin_inchikey.json5. Search by Molecular Formula
Uses fastformula for synchronous molecular formula search. Optionally allow additional elements for broader results.
# Env: base-agent
python .agents/skills/drug-db-pubchem/scripts/query_pubchem.py \
--formula "C9H8O4" \
--max_results 10 \
--outdir research/pubchem/C9H8O4 \
--output formula_results.jsonAllow other elements (broader search):
# Env: base-agent
python .agents/skills/drug-db-pubchem/scripts/query_pubchem.py \
--formula "C6H12O6" \
--allow_other_elements \
--max_results 10 \
--outdir research/pubchem/C6H12O6_allow_other \
--output formula_allow_other.json6. Download SDF Structures (2D/3D)
PubChem 3D records are computationally generated and may be unavailable for some CIDs; the script falls back to 2D by default.
# Env: base-agent
python .agents/skills/drug-db-pubchem/scripts/query_pubchem.py \
--name "ibuprofen" \
--download_sdf \
--sdf_record_type 3d \
--outdir research/pubchem/ibuprofen \
--output ibuprofen.json7. Disable Synonyms
Synonyms require extra API calls; disable them for high-throughput workflows.
# Env: base-agent
python .agents/skills/drug-db-pubchem/scripts/query_pubchem.py \
--cid 2244 \
--no_synonyms \
--outdir research/pubchem/CID_2244_minimal \
--output cid_2244_minimal.jsonExamples
Caffeine (download 3D SDF if available):
# Env: base-agent
python .agents/skills/drug-db-pubchem/scripts/query_pubchem.py \
--name "caffeine" \
--download_sdf \
--sdf_record_type 3d \
--outdir research/pubchem/caffeine \
--output caffeine.jsonConstraints
- Rate Limiting: PubChem enforces per-user limits (~5 requests/sec, plus per-minute limits). Exceeding limits triggers HTTP 503 responses. The script rate-limits via a sliding window and retries with exponential backoff. It also adapts to PubChem's dynamic throttling feedback via the
X-Throttling-Controlheader. - Request Time Limit: PUG-REST is intended for short synchronous requests (server timeouts ~30 seconds). Keep
--max_resultssmall for interactive use. - 3D Structures: PubChem 3D SDF records are computed (not necessarily experimental) and may not exist for all compounds; the script falls back to 2D when needed.
- Synonyms: Synonyms may be numerous and are optional; disable them with
--no_synonymsfor high-throughput workflows. - Environment: Requires
base-agentconda environment. - Dependencies: Standard library only (
urllib,json,argparse).
Author: Matthew Cox Contact: GitHub @mcox3406
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

