pestifer.charmmff.ligand_paramgen.rcsb module

Look up SMILES for a PDB chemical-component ID via the RCSB Data API.

The RCSB Data API exposes per-component records at https://data.rcsb.org/rest/v1/core/chemcomp/{COMP_ID}. Each record’s pdbx_chem_comp_descriptor array carries several SMILES variants (OpenEye/CACTVS/ACDLabs, with and without stereo); we prefer the OpenEye canonical-stereo form when present.

Used by the CGenFF ligand-parameterization pipeline so a HETATM resname can be turned into a usable SMILES without the user having to supply one for any ligand the PDB already knows about.

exception pestifer.charmmff.ligand_paramgen.rcsb.RCSBLookupError[source]

Bases: RuntimeError

Raised when an RCSB SMILES lookup fails.

pestifer.charmmff.ligand_paramgen.rcsb.fetch_ligand_smiles(comp_id: str, *, timeout: float = 10.0) str[source]

Fetch the best-available SMILES for a PDB chemical component.

Parameters:
  • comp_id – PDB chemical-component ID (e.g. "ATP", "NAG"). Case-insensitive; whitespace stripped.

  • timeout – HTTP request timeout in seconds.

Returns:

SMILES string. Preference order: OpenEye canonical (stereo) > CACTVS canonical (stereo) > OpenEye non-canonical > CACTVS non-canonical > any remaining SMILES_CANONICAL > any remaining SMILES.

Return type:

str

Raises:

RCSBLookupError – If the component ID is not found, the network call fails, or the response carries no SMILES descriptor.