moleculekit.rcsb module#
- moleculekit.rcsb.fetchResidueCIF(resname, outdir, overwrite=False)#
Download a residue’s reference structure from the RCSB Chemical Component Dictionary and store it as
<resname>.cifinoutdir.Used at packaging time to populate moleculekit’s
share/residue_cifswith the modified-residue templates thatsystemPrepareinjects into PDB2PQR so those residues can be protonated. NOT called at runtime - runtime reads the already-shipped cifs. No-op if the file exists unlessoverwriteis set.
- moleculekit.rcsb.rcsbFetchLigandInfo(comp_id)#
Fetch the full RCSB Chemical Component Dictionary record for a ligand.
Queries the RCSB data API for a 3-letter chemical component (CCD) code and returns the complete record, including identifiers, formula, weight and all descriptor variants (InChI plus SMILES from RCSB, CACTVS, OpenEye and ACDLabs).
- Parameters:
comp_id (
str) – The chemical component (CCD) 3-letter code, e.g."BEN". Case-insensitive.- Returns:
info – The parsed JSON record. The curated descriptors live under
info["rcsb_chem_comp_descriptor"](SMILES,SMILES_stereo,InChI,InChIKey); per-program variants live underinfo["pdbx_chem_comp_descriptor"].- Return type:
Examples
>>> info = rcsbFetchLigandInfo('BEN') >>> info['rcsb_chem_comp_descriptor']['comp_id'] 'BEN'
- moleculekit.rcsb.rcsbFetchLigandSmiles(comp_id, stereo=True, program='OpenEye')#
Fetch a SMILES string for a ligand by its RCSB CCD code.
Thin wrapper over
rcsbFetchLigandInfo(). RCSB stores SMILES computed by several toolkits (OpenEye, CACTVS, ACDLabs). By default this returns the OpenEye descriptor, which RCSB also curates into its top-levelrcsb_chem_comp_descriptorblock. Passprogramto pick a different toolkit; for full control readpdbx_chem_comp_descriptoroffrcsbFetchLigandInfo()directly.- Parameters:
comp_id (
str) – The chemical component (CCD) 3-letter code, e.g."BEN". Case-insensitive.stereo (
bool) – If True (default) return the isomeric SMILES (stereochemistry included); if False return the plain SMILES. RCSB labels the isomeric variantSMILES_CANONICAL. Falls back to the other variant when the preferred one is absent for the chosen program.program (
str) – Which toolkit’s descriptor to return."OpenEye"(default) uses RCSB’s curated descriptor. Other typical values are"CACTVS"and"ACDLabs". Matched case-insensitively as a substring of the program name reported by RCSB; raises if the component has no SMILES from a matching program.
- Returns:
smiles – The SMILES string.
- Return type:
Examples
>>> rcsbFetchLigandSmiles('BEN', stereo=False) '[H]N=C(c1ccccc1)N' >>> rcsbFetchLigandSmiles('BEN', program='CACTVS') 'NC(=N)c1ccccc1'
- moleculekit.rcsb.rcsbFindLigands(pdbid)#
Find the ligands present in a PDB entry.
Scrapes the RCSB PDB entry page for its table of ligands and returns their residue names.
- Parameters:
pdbid (
str) – The 4-letter PDB code to look up.- Returns:
ligands – The residue names of the ligands found in the entry (e.g.
['SO4', 'GOL']). Empty if no ligands are found.- Return type:
Examples
>>> rcsbFindLigands('3onq') ['SO4', 'GOL']
- moleculekit.rcsb.rcsbFindMutatedResidues(pdbid)#
Find the modified/mutated residues of a PDB entry.
Scrapes the RCSB PDB entry page for its table of modified residues and maps each non-standard residue name to the standard residue it derives from.
- Parameters:
pdbid (
str) – The 4-letter PDB code to look up.- Returns:
tomutate – A mapping from each modified residue name to its parent standard residue name (e.g.
{'MSE': 'MET'}). Empty if no modified residues are found.- Return type:
Examples
>>> rcsbFindMutatedResidues('3onq') {'MSE': 'MET'}