Skip to content

Commit 3a86c38

Browse files
Merge pull request prody#1908 from jamesmkrieger/parse_ligands
Parse ligands fixes
2 parents 70072a1 + 5c882c1 commit 3a86c38

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

prody/compounds/pdbligands.py

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
from prody import LOGGER, SETTINGS, getPackagePath, PY3K
99
from prody.atomic import AtomGroup, ATOMIC_FIELDS
1010
from prody.utilities import openFile, makePath, openURL
11+
from .ccd import parseCCD
1112

1213
__all__ = ['PDBLigandRecord', 'fetchPDBLigand', 'parsePDBLigand']
1314

@@ -18,13 +19,20 @@ def __init__(self, data):
1819
self._rawdata = data
1920

2021
def getCanonicalSMILES(self):
21-
return self._rawdata['CACTVS_SMILES_CANONICAL']
22+
canonical = None
23+
for row in self._rawdata[2].data:
24+
if row['_pdbx_chem_comp_descriptor.type'] == 'SMILES_CANONICAL':
25+
canonical = row['_pdbx_chem_comp_descriptor.descriptor']
26+
return canonical
2227

2328

2429
def fetchPDBLigand(cci, filename=None):
25-
"""Fetch PDB ligand data from PDB_ for chemical component *cci*.
30+
"""Handle PDB ligand data from PDB_ for chemical component *cci*.
2631
*cci* may be 3-letter chemical component identifier or a valid XML
27-
filename. If *filename* is given, XML file will be saved with that name.
32+
filename. If *filename* is given, XML file will be saved with that name.
33+
34+
This function may not work as _PDB is not hosting ligand XML files anymore.
35+
It is kept for use with existing ligand XML files.
2836
2937
If you query ligand data frequently, you may configure ProDy to save XML
3038
files in your computer. Set ``ligand_xml_save`` option **True**, i.e.
@@ -50,6 +58,7 @@ def fetchPDBLigand(cci, filename=None):
5058
ideal (energy minimized) coordinate sets:
5159
5260
.. ipython:: python
61+
:okexcept:
5362
5463
from prody import *
5564
ligand_data = fetchPDBLigand('STI')
@@ -233,8 +242,8 @@ def fetchPDBLigand(cci, filename=None):
233242
return dict_
234243

235244

236-
def parsePDBLigand(cci, filename=None):
245+
def parsePDBLigand(cci):
237246
"""See :func:`.fetchPDBLigand`"""
238-
lig_dict = fetchPDBLigand(cci, filename)
247+
lig_dict = parseCCD(cci)
239248
return PDBLigandRecord(lig_dict)
240249

0 commit comments

Comments
 (0)