crested.pl.patterns.clustermap_with_pwm_logos#
- crested.pl.patterns.clustermap_with_pwm_logos(pattern_matrix, classes, pattern_dict, subset=None, figsize=(25, 8), 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, pwm_or_contrib='pwm')#
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 (
Optional
[list
[str
]] (default:None
)) – List of class labels to subset the matrix.figsize (
tuple
[int
,int
] (default:(25, 8)
)) – Size of the clustermap figure (width, height). Default is (25, 8).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 (
Optional
[str
] (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
)) – Vertical padding for the PWM logos relative to the heatmap. Default is 0.3.pwm_or_contrib (
str
(default:'pwm'
)) – Whether to use the pwm or contrib score representation of the pattern in the plotting.
- Return type:
ClusterGrid
- Returns:
sns.matrix.ClusterGrid: A seaborn ClusterGrid object containing the clustermap with the PWM logos.