scigantic-wwpdb
Explore the wwPDB Chemical Component Dictionary (CCD) from Python, by id, no download.
The CCD is the reference chemistry for every small molecule, ligand, ion, and modified residue in the PDB, about 45,000 components. It is the small-molecule reference AlphaFold 3 uses for ligand pose prediction, and what you reach for whenever a structure has a HETATM to reason about.
The whole dictionary is a single 45,000-file directory. Mirroring or FUSE-mounting it is awkward: the public autoindex either truncates (files.wwpdb.org caps at 2,000 entries) or is slow to list (the complete mirror is 50k entries). So this library never lists the tree. It fetches exactly what you ask for, over HTTP, in three tiers so exploring stays fast:
import scigantic_wwpdb as ccd
ids = ccd.search("heme") # 1. ids by name (RCSB text search)
ccd.find(ids) # 2. metadata for the set, ONE request:
# [Summary('HEC', 'HEME C', formula='C34 H34 Fe N4 O4'), ...]
c = ccd.component("HEC") # 3. full structure only for what you want
find batch-fetches name/formula/type/weight/SMILES/InChIKey for a whole result set in a single request (RCSB's data API), so you skim before you fetch. The browsing idiom is find(search("kinase inhibitor")).
Install
pip install scigantic-wwpdb # core: gemmi + requests
pip install "scigantic-wwpdb[rdkit]" # + RDKit for to_rdkit / to_sdf / depiction
Full structure, RDKit, SDF
c = ccd.component("ATP") # one small GET, parsed
c.name # "ADENOSINE-5'-TRIPHOSPHATE"
c.formula # "C10 H16 N5 O13 P3"
c.atoms[0] # Atom(id='PG', element='P', charge=0, x=1.2, y=-0.226, z=-6.85, ...)
ccd.components(["ATP", "ADP", "AMP"]) # many, fetched in parallel
mol = ccd.to_rdkit("ATP") # RDKit Mol with the ideal 3-D coordinates
ccd.to_sdf("ATP", "ATP.sdf") # write an SDF
to_rdkit builds the molecule from the dictionary's atoms and bonds, not from a SMILES round-trip, so organometallics like heme (whose coordinate-bond SMILES a plain parser cannot read) still work.
One-liners smiles / inchi / inchikey / formula / name(id) use the fast metadata API, not a full CIF fetch. find()/component() responses are cached per id on disk, on by default (14-day TTL), so calling several of these one-liners for the same id costs one request, not several. ccd.disable_cache() turns it off; ccd.enable_cache(cache_dir=..., ttl_days=...) changes where or how long.
The whole dictionary
For bulk work, stream the full components.cif.gz once (cached) and parse it with gemmi:
doc = ccd.read_dictionary() # downloads ~117 MB once, then a gemmi Document
For anything less than a few thousand components, component() / components() are faster and use no local disk.
Layout
Small, single-purpose modules: rcsb (search + batch metadata), structure (fetch + parse), _cif (gemmi), chem (RDKit/SDF), dictionary (the bundle), model (records). Per-component data is RCSB (files.rcsb.org/ligands/download/<ID>.cif); search and batch metadata are the RCSB search + data APIs; the bundle is EBI. All overridable via SCIGANTIC_CCD_* environment variables.
Data and license
Library code: MIT (see LICENSE). The CCD data it fetches is wwPDB, released under CC0 1.0; cite the wwPDB when you use it. Built by Scigantic.
Metadata
Release files for scigantic-wwpdb 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| scigantic_wwpdb-0.3.0.tar.gz | 33.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| scigantic_wwpdb-0.3.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 56.4 kB
Release files / scigantic_wwpdb-0.3.0.tar.gz
| Download URL | scigantic_wwpdb-0.3.0.tar.gz |
|---|---|
| Size | 33.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6476f1db79e646cccb2e674bfc6fa03285c3c66ff70c8ed670e8faafa5b836a7
|
|
BLAKE2b-256 checksum How to use checksums |
2b6c81bf6a1d4fea7fc347154d8866ba14c35ccb70c37232601ec1e489157e51
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / scigantic_wwpdb-0.3.0-py3-none-any.whl
| Download URL | scigantic_wwpdb-0.3.0-py3-none-any.whl |
|---|---|
| Size | 22.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
39bff83b12684fdcab0b0f811c0a1dd32fcf28623dea803711f6ae6b6e68d3b4
|
|
BLAKE2b-256 checksum How to use checksums |
e16bcab7527c1b6505cd2e957779c98c89c088b46371fa739db1364f0072c47c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|