Ramachandran Plot

Problem

You want to visualize dihedral angles phi (φ) and psi (ψ) of a protein. See example in Figure 1. The contours indicate the extent of allowed (light) and most favored (dark) combinations of (φ, ψ). See also Discussion section.

hover over the red circles to reveal the names of the outliers residues

Figure 1. Example of visualizing Ramachandran plot(PDB: 1CX2)

Ingredients

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

Difficulty level

../_images/chilly6.png

Download

Download code

rama2img.py and ramagrid2img.py

See also the Usage subsection.

Solution

The depict_rama function illustrates how simple it is to generate a Ramachandran as shown on. Figure 2. After initializing an OERamachandranPlot object a protein is added to the plot and the OERenderRamachandranPlot function is called to render the plot into the given image.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
def depict_rama(image, protein):
    """
     Depicts Ramachandran plots in one interactive image.

    :type image: oechem.OEImage
    :type protein: oechem.OEGraphMol
    """

    rama_plot = oegrapheme.OERamachandranPlot()
    rama_plot.AddMolecule(protein)

    oegrapheme.OERenderRamachandranPlot(image, rama_plot)


#############################################################################
# INTERFACE
#############################################################################

The depict_rama_in_grid function illustrates how the six plots can be depicted in a grid and how the Ramachandran plot can be customized to generate the image shown in Figure 3.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
def depict_rama_in_grid(image, protein):
    """
    Depicts individual Ramachandran plots in a grid

    :type image: oechem.OEImage
    :type protein: oechem.OEGraphMol
    """

    grid = oedepict.OEImageGrid(image, 2, 3)
    grid.SetMargins(5.0)
    grid.SetCellGap(10.0)

    rama_plot = oegrapheme.OERamachandranPlot()

    outpen = oedepict.OEPen(oechem.OEDarkRed, oechem.OEDarkRed, oedepict.OEFill_On, 1.0)
    outmarker = oegrapheme.OEPlotMarker(outpen, oegrapheme.OEPlotMarkerStyle_Square, 3.0)
    inpen = oedepict.OEPen(oechem.OEBlack, oechem.OEBlack, oedepict.OEFill_On, 1.0)
    inmarker = oegrapheme.OEPlotMarker(inpen, oegrapheme.OEPlotMarkerStyle_Circle, 1.5)

    rama_plot.AddMolecule(protein, outmarker, inmarker)

    pinkpen = oedepict.OEPen(oechem.OEBlack, oechem.OEPinkTint, oedepict.OEFill_Off, 2.0)
    bluepen = oedepict.OEPen(oechem.OEBlack, oechem.OEBlueTint, oedepict.OEFill_Off, 2.0)
    greypen = oedepict.OEPen(oechem.OEBlack, oechem.OELightGrey, oedepict.OEFill_Off, 2.0)

    rama_types = range(oechem.OERamaType_General, oechem.OERamaType_Max)
    for cell, ramatype in zip(grid.GetCells(), rama_types):
        oegrapheme.OERenderRamachandranPlot(cell, rama_plot, ramatype)

        nr_outliers = rama_plot.NumDataPoints(ramatype, oechem.OERamaCategory_Outlier)
        nr_alloweds = rama_plot.NumDataPoints(ramatype, oechem.OERamaCategory_Allowed)
        nr_favoreds = rama_plot.NumDataPoints(ramatype, oechem.OERamaCategory_Favored)
        if nr_outliers != 0:
            oedepict.OEDrawCurvedBorder(cell, pinkpen, 10)
        elif nr_favoreds != 0 or nr_alloweds != 0:
            oedepict.OEDrawCurvedBorder(cell, bluepen, 10)
        else:
            oedepict.OEDrawCurvedBorder(cell, greypen, 10)


#############################################################################
# INTERFACE
#############################################################################

Usage

Download code

rama2img.py and ramagrid2img.py

Usage

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

prompt > wget https://files.rcsb.org/download/2rox.pdb
prompt > python3 rama2img.py -in 2rox.pdb -out 2rox.svg

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

prompt > wget https://files.rcsb.org/download/2rox.pdb
prompt > python3 ramagrid2img.py -in 2rox.pdb -out 2rox.svg

Discussion

The Ramachandran plot is a graph of the main backbone dihedral angles phi (φ) and psi (ψ) of amino acid residues in protein structure. The plot in Figure 2 shows the empirical distribution of (φ, ψ) observed in a single protein structure (in this case 2ROX) that can be used for structure validation. The data points are classified by their residue types ([Vincent-2010]) and plotted into corresponding image tabs.

The black circles in the plot indicate the locations of the ideal (φ, ψ) values. Outside the contours, the conformations are disfavored and they are colored red. When hovering over these red dots the names of the outlier residues are revealed.

If there is any outlier in a specific type the label of the corresponding image tab is colored pink (see Figure 1). If there are only favored or allowed (φ, ψ) values in a specific type the label is colored blue (see Figure 2). Gray label indicates that there is no data point for the specific type. This coloring scheme enables rapid structure validation.

The three numbers in each tab shows the percentages of outlier (red), allowed (black) and favored (blue) data points in a specific plot.

Figure 2. Example of visualizing Ramachandran plot (PDB: 2ROX)

Figure 3. Example of visualizing individual Ramachandran plots (PDB: 2ROX)

See also

See also

See also in OEChem TK manual

Theory

API

See also in OEDepict TK manual

API

See also in GraphemeTM TK manual

API