COSIE.downstream_analysis.highlight_joint_clusters_all_sections
- highlight_joint_clusters_all_sections(cluster_labels, data_dict, n_clusters, highlight_labels, vis_basis='spatial', colormap=None, swap_xy=False, invert_x=False, invert_y=False, offset=False, save_dir=None, figscale=35, dpi=300, remove_title=True, remove_legend=True, remove_spine=True, bg_color=[200, 200, 200])[source]
Visualize and highlight specified clusters across all tissue sections. For each section, this function renders a spatial plot of cell clusters, highlighting the clusters specified in highlight_labels using distinct colors, while rendering all other clusters in a uniform background color.
Parameters
- cluster_labelsdict
Dictionary of {section_id: np.ndarray of cluster labels} for each section.
- data_dictdict
Dictionary of input data.
- n_clustersint
Total number of clusters.
- highlight_labelslist of int
List of cluster labels to highlight. Other clusters are rendered with background color.
- vis_basisstr, default “spatial”
Key in obsm specifying the coordinate basis to use.
- colormapstr or list or None, default None
Name of matplotlib colormap to use, or a list of RGB values. If None, uses a default palette.
- swap_xybool, default False
Whether to swap x and y axes in the coordinate system.
- invert_xbool, default False
Whether to flip the image horizontally.
- invert_ybool, default False
Whether to flip the image vertically.
- offsetbool, default False
Whether to shift coordinates to (0, 0) minimum before rendering.
- save_dirstr or None, default None
If provided, saves each figure as a JPEG to the specified directory.
- figscalefloat, default 35
Controls the scaling of the figure size.
- dpiint, default 300
Resolution of the saved figure.
- remove_titlebool, default True
Whether to remove the figure title.
- remove_legendbool, default True
Whether to remove the cluster legend from the plot.
- remove_spinebool, default True
Whether to remove the axis spines (borders around the plot).
- bg_colorlist of int, default [200, 200, 200]
RGB color used for non-highlighted clusters.
Returns
None