PubChem¶
Access chemical compound data via the PubChem PUG REST API.
Overview¶
PubChem is the world's largest collection of freely accessible chemical information. biodbs provides access to:
- Compound Data - Properties, structures, synonyms
- Search - By name, SMILES, InChIKey, formula
- Bioassays - Biological activity data
- Safety/Pharmacology - Drug information
Quick Start¶
from biodbs.fetch import (
pubchem_get_compound,
pubchem_search_by_name,
pubchem_get_properties,
)
# Get compound by CID
compound = pubchem_get_compound(2244) # Aspirin
print(compound.results)
Compound Retrieval¶
Get by CID¶
from biodbs.fetch import pubchem_get_compound, pubchem_get_compounds
# Single compound
compound = pubchem_get_compound(2244)
# Multiple compounds
compounds = pubchem_get_compounds([2244, 2519, 5090])
Get Properties¶
from biodbs.fetch import pubchem_get_properties
props = pubchem_get_properties(
2244,
properties=[
"MolecularWeight",
"MolecularFormula",
"CanonicalSMILES",
"InChIKey",
"XLogP",
"TPSA"
]
)
Searching¶
By Name¶
from biodbs.fetch import pubchem_search_by_name
results = pubchem_search_by_name("aspirin")
cids = results.get_cids()
By SMILES¶
from biodbs.fetch import pubchem_search_by_smiles
results = pubchem_search_by_smiles("CC(=O)OC1=CC=CC=C1C(=O)O")
By InChIKey¶
from biodbs.fetch import pubchem_search_by_inchikey
results = pubchem_search_by_inchikey("BSYNRYMUTXBXSQ-UHFFFAOYSA-N")
By Formula¶
Additional Data¶
Synonyms¶
Description¶
Safety Data¶
Pharmacology¶
Drug Information¶
Using the Fetcher Class¶
from biodbs.fetch.pubchem import PubChem_Fetcher
fetcher = PubChem_Fetcher()
compound = fetcher.get_compound(2244)
Related Resources¶
- ChEMBL - Access bioactivity data, drug mechanisms, and target interactions for chemical compounds.
- FDA - Get FDA approval status and drug labeling information.
- KEGG - Find compound involvement in metabolic pathways.
- ID Translation - Translate between PubChem CIDs and other chemical identifiers (SMILES, InChIKey, ChEMBL ID).