Path B - Module 32: Visualizing Interaction Matrices#

Identifying contacts in a table is useful, but seeing them in a Matrix Plot is transformative. For an industrial enzyme, you want to see if the plastic substrate is interacting with the entire active site cleft or just a few residues.

In this module, you will learn to combine msm.structure.get_contacts() with Matplotlib to generate a visual heatmap of the binding interface.

import molsysmt as msm
from molsysmt import systems

# Load our engineered complex (Enzyme + BHET substrate)
petase = msm.convert('pdb:6EQE', to_form='molsysmt.MolSys', selection='molecule_type=="protein"')
bhet = msm.convert('C1=CC(=CC=C1C(=O)OCCO)C(=O)OCCO', from_form='string:smiles', to_form='molsysmt.MolSys')
molsys = msm.merge([petase, bhet])

1. The Interaction Heatmap#

The function get_contacts() returns a boolean contact matrix: one entry per pair of atoms, True when the pair is closer than the threshold. Rendering that matrix with Matplotlib gives you a heatmap in which each pixel is one atom pair, so the bright bands are the regions of the enzyme that actually touch the substrate.

import matplotlib.pyplot as plt

# Compute the contact matrix between the substrate and the enzyme
contact_map = msm.structure.get_contacts(molsys, selection='molecule_type=="small molecule"',
                                         selection_2='molecule_type=="protein"', threshold='0.6 nm')

# Render the first structure of the contact map as a heatmap
figure, axis = plt.subplots()
axis.imshow(contact_map[0].astype(int), origin='lower', interpolation='nearest', aspect='auto')
axis.set_xlabel('Enzyme atom index')
axis.set_ylabel('Substrate atom index')
plt.show()

2. Identifying Interaction Clefts#

In the PETase, the active site is an open cleft. Look for the residues that appear as “bands” in the plot: those are the ones providing the stabilization for the plastic monomer.

3. Comparing Wild-type vs Mutant Contacts#

In a real engineering project, you would plot both systems side-by-side to see if your mutation created new contact points.


🏆 Path B Challenge: The Heatmap Analyst#

  1. Pass center_of_atoms=True together with a group-wise selection to get_contacts to obtain a residue-residue matrix instead of an atom-atom one.

  2. Identify the top 5 residues with the strongest signal in the plot.

  3. Use msm.get() with group_name=True on those indices to verify their biological identity.

You now have a powerful tool for reporting! In Module 33, we will calculate global metrics like the Radius of Gyration to see if our enzyme became more compact.