itpseq.Sample.hmap_grid#
- Sample.hmap_grid(pos=None, col='auto', transform=<ufunc 'log2'>, cmap='vlag', vmax=None, center=None, **kwargs)[source]#
Creates a grid of heatmaps for all combinations of ribosome positions passed in pos.
Each cell in the upper triangle of the grid represents a heatmap of enrichment between two positions, with the visualization parameters inherited from the hmap method.
- Parameters:
pos (iterable, optional) – An iterable of ribosome positions for generating combinations (e.g., [‘-2’, ‘E’, ‘P’, ‘A’]). If not provided, defaults to the set of positions [‘-2’, ‘E’, ‘P’, ‘A’].
how (str, optional) – If ‘aax’ is provided, sequences with stop codons in the peptide are excluded.
col (str, optional) – The dataset column used for computations. Displays the enrichment by default.
transform (callable, optional) – A function or callable to apply to the dataset before generating the heatmaps. Defaults to numpy.log2.
cmap (str or matplotlib.colors.Colormap, optional) – The colormap to use for the heatmap visualizations. Defaults to ‘vlag’.
vmax (float, optional) – The maximum value for color scaling in the heatmaps.
center (float, optional) – The midpoint value for centering the colormap.
kwargs (key, value pairings) – Additional parameters used to filter the dataset or control heatmap generation via the hmap method.
- Returns:
The figure object containing the grid of heatmaps.
- Return type:
matplotlib.figure.Figure
Examples
Create the default heatmap grid for all combinations of -2/E/P/A:
>>> sample.hmap_grid()
Create a heatmap grid for combinations of E/P/A:
>>> sample.hmap_grid(['E', 'P', 'A'])