PDB Ligands

This module defines functions for fetching PDB ligand data.

fetchPDBLigand(cci, filename=None)[source]

Fetch 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.

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. confProDy(ligand_xml_save=True). Compressed XML files will be save to ProDy package folder, e.g. /home/user/.prody/pdbligands. Each file is around 5Kb when compressed.

This function is compatible with PDBx/PDBML v 4.0.

Ligand data is returned in a dictionary. Ligand coordinate atom data with model and ideal coordinate sets are also stored in this dictionary. Note that this dictionary will contain data that is present in the XML file and all Ligand Expo XML files do not contain every possible data field. So, it may be better if you use dict.get() instead of indexing the dictionary, e.g. to retrieve formula weight (or relative molar mass) of the chemical component use data.get('formula_weight') instead of data['formula_weight'] to avoid exceptions when this data field is not found in the XML file. URL and/or path of the XML file are returned in the dictionary with keys url and path, respectively.

Following example downloads data for ligand STI (a.k.a. Gleevec and Imatinib) and calculates RMSD between model (X-ray structure 1IEP) and ideal (energy minimized) coordinate sets:

In [1]: from prody import *

In [2]: ligand_data = fetchPDBLigand('STI')
---------------------------------------------------------------------------
IOError                                   Traceback (most recent call last)
<ipython-input-2-191f33957f83> in <module>()
----> 1 ligand_data = fetchPDBLigand('STI')

/usr/local/lib/python2.7/site-packages/prody/proteins/pdbligands.pyc in fetchPDBLigand(cci, filename)
     85             except IOError:
     86                 raise IOError('XML file for ligand {0} is not found online'
---> 87                               .format(cci))
     88             else:
     89                 xml = inp.read()

IOError: XML file for ligand STI is not found online

In [3]: ligand_data['model_coordinates_db_code']
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-3-c63c8b385b19> in <module>()
----> 1 ligand_data['model_coordinates_db_code']

NameError: name 'ligand_data' is not defined

In [4]: ligand_model = ligand_data['model']
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-4-25a6c9625415> in <module>()
----> 1 ligand_model = ligand_data['model']

NameError: name 'ligand_data' is not defined

In [5]: ligand_ideal = ligand_data['ideal']
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-5-f02b0c12b3f2> in <module>()
----> 1 ligand_ideal = ligand_data['ideal']

NameError: name 'ligand_data' is not defined

In [6]: transformation = superpose(ligand_ideal.noh, ligand_model.noh)
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-6-6a3db6e49687> in <module>()
----> 1 transformation = superpose(ligand_ideal.noh, ligand_model.noh)

NameError: name 'ligand_ideal' is not defined

In [7]: calcRMSD(ligand_ideal.noh, ligand_model.noh)
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-7-6c5a94597e64> in <module>()
----> 1 calcRMSD(ligand_ideal.noh, ligand_model.noh)

NameError: name 'ligand_ideal' is not defined