crested.pl.modisco.clustermap_with_pwm_logos

crested.pl.modisco.clustermap_with_pwm_logos#

crested.pl.modisco.clustermap_with_pwm_logos(pattern_matrix, classes, pattern_dict, subset=None, grid=False, cmap='coolwarm', center=0, method='average', save_path=None, dendrogram_ratio=(0.05, 0.2), importance_threshold=0, logo_height_fraction=0.35, logo_y_padding=0.3, logo_x_multiplier=1, pwm_or_contrib='pwm', width=25, height=8, plot_kws=None, figsize='deprecated')#

Create a clustermap with additional PWM logo plots below the heatmap.

Parameters:
  • pattern_matrix (ndarray) – A 2D array representing the data matrix for clustering.

  • classes (list[str]) – The class labels for the rows of the matrix.

  • pattern_dict (dict) – A dictionary containing PWM patterns for x-tick plots.

  • subset (list[str] | None (default: None)) – List of class labels to subset the matrix.

  • grid (bool (default: False)) – Whether to overlay grid lines on the heatmap. Default is False.

  • cmap (str (default: 'coolwarm')) – Colormap for the heatmap. Default is “coolwarm”.

  • center (float (default: 0)) – The value at which to center the colormap. Default is 0.

  • method (str (default: 'average')) – Linkage method for hierarchical clustering. Default is “average”.

  • save_path (str | None (default: None)) – Path to save the final figure. If None, the figure is not saved. Default is None.

  • dendrogram_ratio (tuple[float, float] (default: (0.05, 0.2))) – Ratios for the size of row and column dendrograms. Default is (0.05, 0.2).

  • importance_threshold (float (default: 0)) – Threshold for filtering columns based on maximum absolute importance. Default is 0.

  • logo_height_fraction (float (default: 0.35)) – Fraction of clustermap height to allocate for PWM logos. Default is 0.35.

  • logo_y_padding (float (default: 0.3)) – Relative vertical padding for the PWM logos relative to the heatmap. Default is 0.3.

  • logo_x_multiplier (float (default: 1)) – Relative width multiplier of the PWM logos. Lower this to shrink their width.

  • pwm_or_contrib (str (default: 'pwm')) – Whether to use the pwm or contrib score representation of the pattern in the plotting.

  • width (int | float (default: 25)) – Width of the newly created figure. Default is 25.

  • height (int | float (default: 8)) – Height of the newly created figure. Default is 8.

  • plot_kws (dict | None (default: None)) – Extra keyword arguments passed to clustermap(). Default is {'cbar_pos': (1.05, 0.4, 0.01, 0.3)}.

Return type:

ClusterGrid

Returns:

sns.matrix.ClusterGrid: A seaborn ClusterGrid object containing the clustermap with the PWM logos.