Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

View DocsExample Notebook

PubChem

PubChem

Note

License: PubChem retrieves data from the PubChem database, in the public domain (U.S. Government public domain). The client wrapper code is MIT-licensed. Please refer to the data terms for full terms.

Overview

PubChem is a public repository of chemical structures, their computed properties, and bioactivity data, maintained by the National Center for Biotechnology Information (NCBI). The pubchem-fetch tool resolves a single small-molecule identifier (CID, name, SMILES, InChI, or InChIKey) against the PubChem PUG REST API and returns the canonical structure descriptors, computed physicochemical properties, and optionally synonyms, textual descriptions, and BioAssay identifiers. It runs on CPU and requires only network access.

Background

PubChem (Kim et al., 2023) is a freely accessible chemistry resource hosted by NCBI. It aggregates compound records with well-defined chemical structures, depositor-supplied substance records, and bioassay results contributed by hundreds of data sources. Each unique compound is assigned a stable Compound Identifier (CID), and standardized structure representations and computed descriptors are derived from a uniform processing pipeline.

Internally, the tool calls the PUG REST endpoint at https://pubchem.ncbi.nlm.nih.gov/rest/pug. It first resolves the supplied identifier to one or more CIDs. A name, SMILES, or InChIKey is sent as a URL-encoded GET against the matching /compound/{domain}/{value}/cids/JSON endpoint, an InChI is submitted via POST, and a CID skips resolution entirely. It then fetches the configured property bundle from /compound/cid/{cid}/property/{properties}/JSON, and optionally retrieves synonyms, descriptions, and BioAssay identifiers through additional endpoints. Results reflect the live database at query time rather than a fixed release snapshot.

Learning Resources

  • PUG REST documentation (PubChem) - official reference for the request grammar, compound domains, property names, and response formats.
  • Programmatic access (PubChem) - overview of the programmatic interfaces and the published usage policies and rate limits.

Tools

PubChem Fetch (pubchem-fetch)

Resolves a single small-molecule identifier to a PubChem CID and returns the requested property bundle, the full list of matched CIDs, and optionally synonyms, textual descriptions, BioAssay identifiers, the source URL, and the raw property record.

Applications

Use this to resolve a ligand to its canonical structure and properties before structure-based or chemical-constraint work: convert a user-supplied name or SMILES into a canonical CID and standardized SMILES/InChI/InChIKey before docking, deduplicate or join compound sets on canonical identifiers, or pull descriptor counts for rule-of-five style filtering. PubChem CIDs anchor cross-references into other chemistry resources. Pair this with NCBI E-utilities to pull linked literature or biomolecule records once a CID is resolved.

Usage Tips

  • Ambiguous names resolve to multiple CIDs. A generic name can match many compounds. The tool deterministically selects the first CID and records the full list in all_matched_cids. Pass a CID directly when the identity must be exact.
  • Prefer CID inputs for large batches. Supplying a CID skips the resolution call and reduces the request count per query, which matters under the rate limits.
  • Synonym, description, and BioAssay retrieval each add a request. Enabling them issues an extra HTTP call, and for common compounds the BioAssay list can return thousands of identifiers.
  • Results track the live database. The same call can return updated structures or properties as PubChem ingests new depositions. It is not pinned to a release.

Toolkit Notes

Tool Persistence guide Device Management guide Parallel Execution guide Cloud Inference guide

These apply to every PubChem tool in this toolkit (pubchem-fetch).

  • Requires network access. The tool calls the live PubChem PUG REST API. It does not run offline and keeps no local copy of the database.
  • Subject to PUG REST throttling. PubChem applies dynamic per-user throttling, with limits of no more than 5 requests per second, 400 requests per minute, and 300 seconds of running time per minute. Exceeding them returns HTTP 503.