Visualizing Protein-Ligand B-factor Map

Problem

You want to visualize the B-factor of an active site in order to reveal regions with high flexibility. See example in Figure 1. Atoms with high B-factor (i.e. high flexibility) are colored red, while blue color indicates low B-factors.

hover the mouse over any residue circle to display its B-factor

Figure 1. Example of depicting the B-factor map of 2A1B complex

See also

Ingredients

  • OEChem TK - cheminformatics toolkit (including OEBio TK)
  • OEDepict TK - molecule depiction toolkit
  • Grapheme TK - molecule and property visualization toolkit

Difficulty level

../_images/chilly7.png

Download

Download code

bfactormap2img.py

See also Usage subsection.

Solution

The depict_bfactormap 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. When generating the B-factor map the interactions are only used to position the nearby residues around the depicted ligand.

  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 OERenderBFactorMap function generates the interactive image in which the B-factor is projected into the ligand using a color gradient (red indicates atoms with high B-factor while blue color indicates low B-factors)

    The residue cycles in the image act as hover buttons that reveal the atomic representation of the residue that is color coded by the B-factor. The color of the residue cycle indicates the average B-factor of the residue.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
def depict_bfactormap(image, protein, ligand, opts):
    """
    :type image: oedepict.OEImageBase
    :type protein: oechem.OEMolBase
    :type ligand: oechem.OEMolBase
    :type opts: oegrapheme.OE2DActiveSiteDisplayOptions
    """

    # perceive interactions

    asite = oechem.OEInteractionHintContainer(protein, ligand)
    if not asite.IsValid():
        oechem.OEThrow.Fatal("Cannot initialize active site!")
    asite.SetTitle(ligand.GetTitle())

    oechem.OEPerceiveInteractionHints(asite)

    # depiction

    oegrapheme.OEPrepareActiveSiteDepiction(asite)
    adisp = oegrapheme.OE2DActiveSiteDisplay(asite, opts)
    oegrapheme.OERenderBFactorMap(image, adisp)

Usage

Usage

bfactormap2img.py

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

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

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

    active site display options:
      -interactive-legend : Visualize legend on mouse hover (SVG feature)

Discussion

See Discussion subsection of the Visualizing Protein-Ligand B-factor recipe.

See also in OEChem TK manual

Theory

API

See also in OEDepict TK manual

Theory

API

See also in GraphemeTM TK manual

API