crested.pl.patterns.clustermap_tf_motif

crested.pl.patterns.clustermap_tf_motif#

crested.pl.patterns.clustermap_tf_motif(data, heatmap_dim='gex', dot_dim='contrib', class_labels=None, subset_classes=None, pattern_labels=None, fig_size=None, save_path=None, cluster_rows=True, cluster_columns=True)#

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

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

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

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

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

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

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

  • fig_size (tuple[int, int] | None) – Size of figure. If None, it will be auto-configured.

  • save_path (str | None) – File path to save figure to.

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

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

Return type:

None

Examples

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