luna.analysis.residues module

generate_residue_matrix(interactions_mngrs, by_interaction=True)[source]

Generate a matrix to count interactions per residue.

Parameters
  • interactions_mngrs (iterable of InteractionsManager) – A sequence of InteractionsManager objects from where interactions will be recovered.

  • by_interaction (bool) – If True (the default), count the number of each interaction type per residue. Otherwise, count the overall number of interactions per residue.

Return type

pandas.DataFrame

heatmap(data_df, figsize=None, cmap='Blues', heatmap_kw=None, gridspec_kw=None)[source]

Plot a residue matrix as a color-encoded matrix.

Parameters
  • data_df (pandas.DataFrame) – A residue matrix produced with generate_residue_matrix().

  • figsize (tuple, optional) – Size (width, height) of a figure in inches.

  • cmap (str, iterable of str) – The mapping from data values to color space. The default value is ‘Blues’.

  • heatmap_kw (dict, optional) – Keyword arguments for seaborn.heatmap().

  • gridspec_kw (dict, optional) – Keyword arguments for matplotlib.gridspec.GridSpec. Used only if the residue matrix (data_df) contains interactions.

Return type

matplotlib.axes.Axes or numpy.ndarray of matplotlib.axes.Axes