itpseq.Sample.hmap#

Sample.hmap(r=None, c=None, *, pos=None, col='auto', transform=<ufunc 'log2'>, cmap='vlag', vmax=None, center=None, ax=None, heatmap_kwargs=None, **kwargs)[source]#

Generates a heatmap of enrichment for combinations of 2 positions.

Parameters:
  • r (str) – The row position on the ribosome for the heatmap.

  • c (str) – The column position on the ribosome for the heatmap.

  • pos (str or list) – Either a specific position in the form “r:c” or a list of positions to analyze.

  • how (str) – Defines the method to compute the counts (e.g., ‘mean’, ‘sum’, ‘count’). If ‘aax’ is provided, sequences with stop codons in the peptide are excluded.

  • col (str) – The dataset column used for computations.

  • transform (callable, optional) – A function or callable to apply to the dataset before generating the heatmap.

  • cmap (str or matplotlib.colors.Colormap) – The colormap to use for the heatmap visualization.

  • vmax (float, optional) – The maximum value for color scaling in the heatmap.

  • center (float, optional) – The midpoint value for centering the colormap.

  • ax (matplotlib.axes.Axes, optional) – Pre-existing axes for the plot. If not provided, a new figure and axes are created.

  • heatmap_kwargs (dict) – Parameters passed to the sns.heatmap method

  • kwargs (dict) – Additional parameters used to filter the dataset. This allows for fine-tuning of the data before generating the heatmap.

Returns:

The heatmap axes object containing the visualization.

Return type:

matplotlib.axes.Axes

Examples

Create a heatmap for positions E-P-A:

>>> sample.hmap('E', 'A')
../../_images/sample_hmap.png