tooluniverse-chemical-compound-retrieval

Retrieve chemical compound data from PubChem and ChEMBL with disambiguation, cross-referencing, and stereochemistry handling. Use for resolving compound names to SMILES/InChI/CID/ChEMBL IDs (including OPSIN deterministic IUPAC-name-to-structure parsing), fetching molecular properties, distinguishing

By mims-harvard · 403 installs

npx skills add mims-harvard/tooluniverse --skill tooluniverse-chemical-compound-retrieval

Source repository · Upstream listing

Chemical Compound Information Retrieval Retrieve comprehensive chemical compound data with proper disambiguation and cross database validation. LOOK UP DON'T GUESS : Never assume a CID, ChEMBL ID, or molecular property value. Always retrieve from PubChem/ChEMBL. English first : Always use English compound names in tool calls. Respond in user's language. Domain Reasoning: Disambiguation "Aspirin" = one compound. "Vitamin D" = multiple forms (D2/D3/active metabolite). For generic class names (steroids, vitamins, acids), present candidates and confirm before proceeding. Workflow Phase 1: Disambiguation Verify: CID + ChEMBL ID + canonical SMILES + stereochemistry + salt forms. Phase 2: Data Retrieval PubChem : PubChem get compound properties by CID , PubChemBioAssay get assay summary , PubChemTox get acute effects , PubChem get compound 2D image by CID ChEMBL : ChEMBL get compound record activities , ChEMBL get molecule targets , ChEMBL get assay activities Optional : PubChem get associated patents by CID , PubChem search compounds by similarity Phase 3: Report Compound Profile with: Identity (CID, ChEMBL ID, IUPAC, SMILES), Chemical Properties (MW, LogP, HBD, HBA, PSA, Lipinski), Bioactivity (targets, IC50/Ki), Drug Info (if approved), Data Sources. Fallback Chains Primary Fallback PubChem name lookup (systematic name) OPSIN name to structure → SMILES/InChIKey → PubChem get CID by SMILES PubChem name lookup ChEMBL search → SMILES → PubChem get CID by SMILES ChEMBL bioactivity PubChem bioassay summary Drug label Note "unavailable" Evidence Grading Grade Criteria Confirmed CID + ChEMBL cross match, InChI/SMILES agree Probable CID found, partial ChEMBL match Uncertain Single database only, or multiple CIDs Unverified No cross reference, single source Bioactivity : ChEMBL PubChem BioAssay for curated data. IC50/Ki < 100nM = potent, 100nM 1uM = moderate, 10uM = weak. Lipinski violations reduce oral bioavailability but don't disqualify. SMILES Verification Always verify novel SMILES: python3 src/tooluniverse/tools/smiles verifier.py smiles "SMILES STRING" . Invalid SMILES produce wrong results or cryptic errors. Identifier Resolution and Cross Database Referencing Beyond PubChem/ChEMBL, two more tools resolve identifiers when a name doesn't hit in PubChem or you need cross references across other chemical databases: NCICACTUS resolve (NCI CACTUS resolver) — converts between chemical names (IUPAC or common), SMILES, InChI, InChIKey, CAS number, and molecular formula. Verified live: NCICACTUS resolve(identifier="ibuprofen", representation="smiles") → CC(C)Cc1ccc(cc1)C(C)C(O)=O ; also resolves a CAS number ( "50 78 2" ) straight to an IUPAC name ( "2 acetyloxybenzoic acid" , i.e. aspirin) or an InChIKey to a formula. Useful as a second name resolution path alongside OPSIN name to structure and PubChem get CID by compound name — CACTUS handles CAS numbers and trivial names OPSIN can't parse. UniChem search compound / UniChem connectivity search — given an InChIKey (or a source database compound ID), returns cross references across UniChem's 25+ registered source databases (ChEMBL, DrugBank, PubChem, Wikipedia, ChEBI, etc. — verified live via UniChem list sources ). connectivity search additionally finds compounds sharing the same connectivity layer (same skeleton, different stereochemistry/salt/isotope) — use this when you want "the same molecule under any name/form" rather than an exact match. Verified live on aspirin's InChIKey ( BSYNRYMUTXBXSQ UHFFFAOYSA N ): both returned real cross database records including a Wikipedia link. Chained identifier workflow (real values): NCICACTUS resolve(identifier="aspirin", representation="smiles") → CC(=O)Oc1ccccc1C(O)=O → resolve the same identifier with representation="stdinchikey" → real result "InChIKey=BSYNRYMUTXBXSQ UHFFFAOYSA N" ( note the InChIKey= prefix — verified live; strip it before passing the bare key to another tool) → feed the bare BSYNRYMUTXBXSQ UHFFFAOYSA N into UniChem search compound for cross database IDs → PubChem get CID by SMILES to re anchor in PubChem if needed. Cheminformatics Calculations and Structure Visualization For calculations and rendering beyond property lookup: RDKit pharmacophore features — extracts pharmacophore feature centers (HBD, HBA, aromatic, hydrophobic, etc.) from a SMILES via SMARTS matching. Verified live on aspirin ( CC(=O)Oc1ccccc1C(=O)O ): 1 HBD with atom index, method documented as "SMARTS based pharmacophore features" . RDKit matched molecular pair — given two SMILES, finds the single cut MMP transformation between them (Hussain Rea algorithm) plus their Tanimoto similarity — useful for "what single substitution turns compound A into compound B" (SAR analysis). visualize molecule 2d — renders a 2D structure (from SMILES, InChI, or a molecule name) to PNG/SVG/interactive HTML. Verified live: returns an embedded HTML visualization on success. visualize molecule 3d — renders a 3D structure via RDKit + py3Dmol. Requires py3Dmol installed — verified live that without it, the tool returns a clean {"status": "error", ...: "py3Dmol is not installed. Please install it with: pip install py3Dmol"} rather than crashing; check for this before assuming a visualization request has failed for another reason. Tool Reference PubChem : PubChem get CID by compound name , PubChem get CID by SMILES , PubChem get compound properties by CID , PubChem get compound 2D image by CID , PubChemBioAssay get assay summary , PubChemTox get acute effects , PubChem get associated patents by CID , PubChem search compounds by similarity , PubChem search compounds by substructure ChEMBL : ChEMBL search drugs , ChEMBL get molecule , ChEMBL get activity , ChEMBL get target , ChEMBL search targets , ChEMBL search assays Name parsing : OPSIN name to structure (param name ) — deterministic IUPAC/systematic name → SMILES/InChI/InChIKey parser; the go to for resolving a systematic name to structure without a DB round trip. Trade/trivial names return parsed=false (use PubChem name lookup for those). Identifier resolution & cross referencing : NCICACTUS resolve , UniChem search compound , UniChem connectivity search , UniChem list sources Cheminformatics & visualization : RDKit pharmacophore features , RDKit matched molecular pair , visualize molecule 2d , visualize molecule 3d