From d30fd6d33c746b16448236c2ed9db9f2a9401413 Mon Sep 17 00:00:00 2001 From: James Krieger Date: Sat, 29 Jun 2024 13:08:08 +0200 Subject: [PATCH 1/3] redo parsePDBLigand for cif --- prody/compounds/pdbligands.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/prody/compounds/pdbligands.py b/prody/compounds/pdbligands.py index 8d2e795c1..b62a917c4 100644 --- a/prody/compounds/pdbligands.py +++ b/prody/compounds/pdbligands.py @@ -8,6 +8,7 @@ from prody import LOGGER, SETTINGS, getPackagePath, PY3K from prody.atomic import AtomGroup, ATOMIC_FIELDS from prody.utilities import openFile, makePath, openURL +from .ccd import parseCCD __all__ = ['PDBLigandRecord', 'fetchPDBLigand', 'parsePDBLigand'] @@ -18,7 +19,11 @@ def __init__(self, data): self._rawdata = data def getCanonicalSMILES(self): - return self._rawdata['CACTVS_SMILES_CANONICAL'] + canonical = None + for row in self._rawdata[2].data: + if row['_pdbx_chem_comp_descriptor.type'] == 'SMILES_CANONICAL': + canonical = row['_pdbx_chem_comp_descriptor.descriptor'] + return canonical def fetchPDBLigand(cci, filename=None): @@ -233,8 +238,8 @@ def fetchPDBLigand(cci, filename=None): return dict_ -def parsePDBLigand(cci, filename=None): +def parsePDBLigand(cci): """See :func:`.fetchPDBLigand`""" - lig_dict = fetchPDBLigand(cci, filename) + lig_dict = parseCCD(cci) return PDBLigandRecord(lig_dict) From c4dfe00be74f2fff420ead3608ccd4343c8af23a Mon Sep 17 00:00:00 2001 From: James Krieger Date: Sat, 29 Jun 2024 13:14:28 +0200 Subject: [PATCH 2/3] handle fetchPDBLigand in docs --- prody/compounds/pdbligands.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/prody/compounds/pdbligands.py b/prody/compounds/pdbligands.py index b62a917c4..de72a193b 100644 --- a/prody/compounds/pdbligands.py +++ b/prody/compounds/pdbligands.py @@ -27,9 +27,12 @@ def getCanonicalSMILES(self): def fetchPDBLigand(cci, filename=None): - """Fetch PDB ligand data from PDB_ for chemical component *cci*. + """Handle PDB ligand data from PDB_ for chemical component *cci*. *cci* may be 3-letter chemical component identifier or a valid XML - filename. If *filename* is given, XML file will be saved with that name. + filename. If *filename* is given, XML file will be saved with that name. + + This function may not work as _PDB is not hosting ligand XML files anymore. + It is kept for use with existing ligand XML files. If you query ligand data frequently, you may configure ProDy to save XML files in your computer. Set ``ligand_xml_save`` option **True**, i.e. From f05b688fc7900d89dcaddc1e744381fd93554bf5 Mon Sep 17 00:00:00 2001 From: James Krieger Date: Wed, 17 Apr 2024 18:02:00 +0200 Subject: [PATCH 3/3] suppress problems with ligands --- prody/compounds/pdbligands.py | 1 + 1 file changed, 1 insertion(+) diff --git a/prody/compounds/pdbligands.py b/prody/compounds/pdbligands.py index de72a193b..31e2f2d90 100644 --- a/prody/compounds/pdbligands.py +++ b/prody/compounds/pdbligands.py @@ -58,6 +58,7 @@ def fetchPDBLigand(cci, filename=None): ideal (energy minimized) coordinate sets: .. ipython:: python + :okexcept: from prody import * ligand_data = fetchPDBLigand('STI')