Path D - Module 32: Visualizing Interaction Matrices#

Generate a contact map of the protein-lipid interface. In this module, you will learn to combine msm.structure.get_contacts() with Matplotlib for large membrane systems.

import molsysmt as msm
import matplotlib.pyplot as plt
from molsysmt import systems

system = [systems['POPC membrane']['popc_membrane.h5msm'], systems['POPC membrane']['popc_membrane.dcd']]

contact_map = msm.structure.get_contacts(system, selection='molecule_type=="protein"',
                                         selection_2='molecule_type=="lipid"')

figure, axis = plt.subplots()
axis.imshow(contact_map[0].astype(int), origin='lower', interpolation='nearest', aspect='auto')
axis.set_xlabel('Lipid atom index')
axis.set_ylabel('Protein atom index')
plt.show()