Skip to main content

scigantic-wwpdb

CI PyPI PyPI - Python Version License

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.1.tar.gz (26.3 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.1-py3-none-any.whl (17.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: scigantic_wwpdb-0.2.1.tar.gz
  • Upload date:
  • Size: 26.3 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.1.tar.gz
Algorithm Hash digest
SHA256 2e18db2f8d02e5c081a4fe416b6278ad804713409cbcd480a3ebccceaf4710fb
MD5 539e9c2e994587ed80733ceca5abf810
BLAKE2b-256 bfc25535a85677b4331c057cebf470ff5b66ab41eb2308bc19934e2f7ab9b0f3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scigantic_wwpdb-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 35a0acbaeb766a726cf028e1d3008df025bd714ccc909f067ba85b9eaac7f33c
MD5 06d0e505c92439b1f05803766a0618d5
BLAKE2b-256 d1e656cd612e8eb94a992e262c9c72b4cf393c444015340ee228c40e0b1aced2

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.2.1 This release

2 files

0.2.0

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