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)

../_images/rama2img-1cx2.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

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.

 1def depict_rama(image, protein):
 2    """
 3     Depicts Ramachandran plots in one interactive image.
 4
 5    :type image: oechem.OEImage
 6    :type protein: oechem.OEGraphMol
 7    """
 8
 9    rama_plot = oegrapheme.OERamachandranPlot()
10    rama_plot.AddMolecule(protein)
11
12    oegrapheme.OERenderRamachandranPlot(image, rama_plot)

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.

 1def depict_rama_in_grid(image, protein):
 2    """
 3    Depicts individual Ramachandran plots in a grid
 4
 5    :type image: oechem.OEImage
 6    :type protein: oechem.OEGraphMol
 7    """
 8
 9    grid = oedepict.OEImageGrid(image, 2, 3)
10    grid.SetMargins(5.0)
11    grid.SetCellGap(10.0)
12
13    rama_plot = oegrapheme.OERamachandranPlot()
14
15    outpen = oedepict.OEPen(oechem.OEDarkRed, oechem.OEDarkRed, oedepict.OEFill_On, 1.0)
16    outmarker = oegrapheme.OEPlotMarker(outpen, oegrapheme.OEPlotMarkerStyle_Square, 3.0)
17    inpen = oedepict.OEPen(oechem.OEBlack, oechem.OEBlack, oedepict.OEFill_On, 1.0)
18    inmarker = oegrapheme.OEPlotMarker(inpen, oegrapheme.OEPlotMarkerStyle_Circle, 1.5)
19
20    rama_plot.AddMolecule(protein, outmarker, inmarker)
21
22    pinkpen = oedepict.OEPen(oechem.OEBlack, oechem.OEPinkTint, oedepict.OEFill_Off, 2.0)
23    bluepen = oedepict.OEPen(oechem.OEBlack, oechem.OEBlueTint, oedepict.OEFill_Off, 2.0)
24    greypen = oedepict.OEPen(oechem.OEBlack, oechem.OELightGrey, oedepict.OEFill_Off, 2.0)
25
26    rama_types = range(oechem.OERamaType_General, oechem.OERamaType_Max)
27    for cell, ramatype in zip(grid.GetCells(), rama_types):
28        oegrapheme.OERenderRamachandranPlot(cell, rama_plot, ramatype)
29
30        nr_outliers = rama_plot.NumDataPoints(ramatype, oechem.OERamaCategory_Outlier)
31        nr_alloweds = rama_plot.NumDataPoints(ramatype, oechem.OERamaCategory_Allowed)
32        nr_favoreds = rama_plot.NumDataPoints(ramatype, oechem.OERamaCategory_Favored)
33        if nr_outliers != 0:
34            oedepict.OEDrawCurvedBorder(cell, pinkpen, 10)
35        elif nr_favoreds != 0 or nr_alloweds != 0:
36            oedepict.OEDrawCurvedBorder(cell, bluepen, 10)
37        else:
38            oedepict.OEDrawCurvedBorder(cell, greypen, 10)

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)

../_images/rama2img-2rox.svg

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

../_images/ramagrid2img-2rox.svg

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