Visualizing Protein-Ligand Contacts

Problem

You want to generate an interactive image (in svg file format) that depicts the active site i.e. the ligand and the nearby residues. The interactive images allows to reveal or hide those atoms that are interacting with a given residue. See example in Figure 1.

click on any residues to reveal which part of the ligand it interacts with

Figure 1. Example of depicting the contact map of 1A1B complex

../_images/contactmap2img-pdb1a1b.svg

Ingredients

  • OEChem TK - cheminformatics toolkit (including OEBio TK)

  • OEDepict TK - molecule depiction toolkit

  • Grapheme TK - molecule and property visualization toolkit

Difficulty level

../_images/chilly.png

Download

Download code

contactmap2img.py

See also the Usage subsection.

Solution

The depict_contactmap function illustrates how simple it is to generate these images.

  1. First the OEInteractionHintContainer object is constructed that stores information about possible interactions between the ligand and the protein.

  2. The interactions are perceived by calling the OEPerceiveInteractionHints function.

  3. The active site is then prepared for 2D depiction by invoking the OEPrepareActiveSiteDepiction function.

  4. When the OE2DActiveSiteDisplay object is constructed, residues are positioned around the ligand close to those atoms which they are interacting with.

  5. The OERenderContactMap function generates an image in which each residue cycle behaves as a toggle button. By clicking on a residue cycle, the ligand atoms with which the given residue interacts are revealed or hidden. The generated images has to be written out in svg image file format that supports interactive elements.

 1def depict_contactmap(image, protein, ligand, opts):
 2    """
 3    :type image: oedepict.OEImageBase
 4    :type protein: oechem.OEMolBase
 5    :type ligand: oechem.OEMolBase
 6    :type opts: oedepict.OE2DMolDisplayOptions
 7    """
 8
 9    # perceive interactions
10
11    asite = oechem.OEInteractionHintContainer(protein, ligand)
12    if not asite.IsValid():
13        oechem.OEThrow.Fatal("Cannot initialize active site!")
14    asite.SetTitle(ligand.GetTitle())
15
16    oechem.OEPerceiveInteractionHints(asite)
17
18    # depiction
19
20    oegrapheme.OEPrepareActiveSiteDepiction(asite)
21    adisp = oegrapheme.OE2DActiveSiteDisplay(asite, opts)
22
23    oegrapheme.OERenderContactMap(image, adisp)

Usage

Usage

contactmap2img.py

The following commands will generate the image shown in Figure 1.

prompt > wget https://files.rcsb.org/download/1a1b.pdb
prompt > python3 contactmap2img.py -complex 1a1b.pdb -out 1a1b.svg

Command Line Parameters

Simple parameter list
    -height : Height of output image
    -width : Width of output image

    SplitMolComplex options :
      -covalentligand : Split covalent ligands
      -ligandname : Ligand name

    molecule display options :
      -aromstyle : Aromatic ring display style

    input/output options :
      -complex : Input filename of the protein-ligand complex
      -protein : Input filename of the protein
      -ligand : Input filename of the ligand
      -out : Output filename of the generated image

Discussion

Currently the OEPerceiveInteractionHints function perceives the following interaction types:

All of these interaction types are considered when positioning the residues around the ligand.

The default geometric parameters used by the OEPerceiveInteractionHints function have been set based on literature data ([Kumar-2002], [Cavallo-2016], [Bissantz-2010], and [Marcou-2007] ). The interaction parameters can be customized by using the OEPerceiveInteractionOptions class.

Hint

Since the interaction perception dependents on the position of hydrogens, it is highly recommended to optimize those positions prior to the perception. See more details in the Protein Preparation chapter of the OEChem TK manual.

See also in OEChem TK manual

Theory

API

See also in OEDepict TK manual

Theory

API

See also in GraphemeTM TK manual

API