crested.pl.modisco.clustermap_tf_motif

crested.pl.modisco.clustermap_tf_motif#

crested.pl.modisco.clustermap_tf_motif(data, heatmap_dim='gex', dot_dim='contrib', class_labels=None, subset_classes=None, pattern_labels=None, cluster_rows=True, cluster_columns=True, imshow_kws=None, scatter_kws=None, fig_size='deprecated', **kwargs)#

Generate a heatmap where one modality is represented as color, and the other as dot size.

Parameters:
  • data (ndarray) – 3D numpy array with shape (len(classes), #patterns, 2).

  • heatmap_dim (str (default: 'gex')) – Either ‘gex’ or ‘contrib’, indicating which third dimension to use for heatmap colors.

  • dot_dim (str (default: 'contrib')) – Either ‘gex’ or ‘contrib’, indicating which third dimension to use for dot sizes.

  • class_labels (list[str] | None (default: None)) – Labels for the classes.

  • subset_classes (list[str] | None (default: None)) – Subset of classes to include in the heatmap. Rows in data are filtered accordingly.

  • pattern_labels (list[str] | None (default: None)) – Labels for the patterns.

  • cluster_rows (bool (default: True)) – Whether to cluster the rows (classes). Default is True.

  • cluster_columns (bool (default: True)) – Whether to cluster the columns (patterns). Default is True.

  • imshow_kws (dict | None (default: None)) – Extra arguments for ax.imshow. Default is {'cmap': 'coolwarm', 'aspect': 'auto'}.

  • scatter_kws (dict | None (default: None)) – Extra arguments for ax.scatter. Default is {'c': "black", 'alpha': 0.6, 'edgecolor': "none"}

  • width – Width of the newly created figure. Default is max(20, data.shape[1]//4).

  • height – Height of the newly created figure. Default is data.shape[0]//2.

  • kwargs – Additional arguments passed to render_plot() to control the final plot output. Please see render_plot() for details.

Return type:

tuple[Figure, list[Axes]] | None

Examples

>>> clustermap_tf_motif(
...     data,
...     heatmap_dim="gex",
...     dot_dim="contrib",
...     class_labels=classes,
...     pattern_labels=patterns,
...     cluster_rows=True,
...     cluster_columns=True,
... )