Skip to content

Commit

Permalink
Merge pull request prody#1908 from jamesmkrieger/parse_ligands
Browse files Browse the repository at this point in the history
Parse ligands fixes
  • Loading branch information
jamesmkrieger authored Aug 22, 2024
2 parents 70072a1 + 5c882c1 commit 3a86c38
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions prody/compounds/pdbligands.py
Original file line number Diff line number Diff line change
Expand Up @@ -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']

Expand All @@ -18,13 +19,20 @@ 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):
"""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.
Expand All @@ -50,6 +58,7 @@ def fetchPDBLigand(cci, filename=None):
ideal (energy minimized) coordinate sets:
.. ipython:: python
:okexcept:
from prody import *
ligand_data = fetchPDBLigand('STI')
Expand Down Expand Up @@ -233,8 +242,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)

0 comments on commit 3a86c38

Please sign in to comment.