Skip to main content

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.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

scigantic_wwpdb-0.2.0.tar.gz (25.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

scigantic_wwpdb-0.2.0-py3-none-any.whl (17.2 kB view details)

Uploaded Python 3

File details

Details for the file scigantic_wwpdb-0.2.0.tar.gz.

File metadata

  • Download URL: scigantic_wwpdb-0.2.0.tar.gz
  • Upload date:
  • Size: 25.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for scigantic_wwpdb-0.2.0.tar.gz
Algorithm Hash digest
SHA256 9bf6a8debaec0f83a4586c83e869d3fbc15dfff448c54ba1cf0940d86fef5795
MD5 6762a6c2a5fa02ddf88f97f38d95004a
BLAKE2b-256 c96371f090e5cc9e09757e00894b33922c82302b2ced16b6a02397742a87527b

See more details on using hashes here.

File details

Details for the file scigantic_wwpdb-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for scigantic_wwpdb-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ef72a6ae6635cdb31b8cae47f660044707a085e17d76e24b775b9736184c4d17
MD5 08502d7a87e7ac2b763969e9c5318b87
BLAKE2b-256 00c3cc71e005ce6cb645c4c0d1897e26c40b28ef73b347f73d0f4a19c869e7e0

See more details on using hashes here.

Release history Release notifications | RSS feed

0.2.1

2 files

This release

0.2.0 This release

2 files

0.1.1

2 files

0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page