This document explains the functions of eSBMTools used in the example Contact Map Visualization.
Since there are 3 python scripts used, we will explain them in turn.
Contact maps provide a more reduced representation of a protein structure rather than its full 3-D structure. The advantage of contact maps is that they are invariant to rotations and translations and they are more easily predicted by machine learning methods.
Plotting a contact map with eSBMTools is fairly easy. First a graph is set up using matplotlib.pyplot adjusting its various parameters. Next we calculate the Q and Qi values of the protein using functions from the module Qvalue. Once the Q & Qi values are calculated, we go to the desired frame number and fill the contact lists. Finally we plot the graph from the derived contact lists.
→ For this file, 1 module from eSBMTools was imported into PlotContactMap.py:
-Qvalue.py
However, another module “matplotlib.pyplot” is imported for the graphs.
→ The code following “# set up figure” adjusts various properties of the graph such as:
fig = plt.figure(figsize=(5, 5)) sets the height in inches
add_subplot adds a sublplot
set_xlabel, set_ylabel, set_title are for labeling the X-axis, the Y-axis and
setting the title of the graph.
All these functions are a part of matplotlib.
→ The function
getQvalues(path_to_current_directory, topFileName)
is used to get the Q values and the index file for the protein file in the folder and
getQiValues(path_to_current_directory, topFileName)
is used to get the Qi map.
These functions belong to Qvalue.py
→ The code following the above functions adjust the frame at which the map is to be drawn, fill the
contact lists and finally plot the graph using matplotlib.pyplot.
Instead of using Q and Qi values to plot the contact map of the protein, here we use the topology file of the protein to obtain the list of pairs in the protein. Once we have that the contact lists are generated and the contact map is plotted.
→ This script is identical to PlotContactMap.py with the difference being that the graph is drawn by obtaining the index pairs from the .top file. This is done using the following function:
getPairsReference(path_to_current_directory, topFileName)
The function returns the list of pairs and the contacts are then plotted using the function plt.plot().
To understand this method of plotting the grap, we must first understand this:
→ The structure based models of proteins take a protein and provide the user with the native contacts
along with it's Lennard Jones Energy.
The energy of all the bonds when they form are equal for all the normal bonds. But, if an experiment
requires changing the values of these energies, then the flavor version of the contact map plotting
allows us to do so, as can be seen from the following image, where the initial value of the energy
between the bonds is changed:
The current example takes the values of these energies from the given text file mj_1996_table_3.txt but
it can be edited according to the experiment.
To use this python script for another file, simply do the following:
→ Change the entries in the mj_1996_table_3.txt file
(or)
change the value of flavorFileName in PlotContactMapFlavor.py
→ Change the PDB code in PlotContactMapFlavor.py to the protein being used in the experiment. The line to
be changed is:
# get atoms and their coordinates from the PDB file
atomsTmp, allAtomCoordinatesTmp = GoModel.parsePdbFileCA(path, 'PDB_Name')
Cheers!