omicverse.pl.cell_cor_heatmap¶
- omicverse.pl.cell_cor_heatmap(adata, group_by, *, ref_adata=None, ref_group_by=None, features=None, n_features=2000, method='pearson', layer=None, use_raw=False, standard_scale='var', cmap='RdBu_r', figsize=(6, 6), show_values=True, value_fmt='.2f', row_cluster=True, col_cluster=True, vmin=None, vmax=None, legend=True, legend_style='tight', border=False, save=False, save_pathway='', show=False)[source]¶
Compute pairwise correlation/similarity between cell groups and plot as heatmap.
Mirrors scop::CellCorHeatmap — computes group-level mean expression and plots the resulting similarity matrix.
- Parameters:
adata (
AnnData) – Annotated data matrix.group_by (
str) – Key inadata.obsfor grouping cells (e.g.'cell_type').ref_adata (
AnnData(default:None)) – Optional second AnnData for cross-dataset comparison. If None, the queryadatais used as both query and reference.ref_group_by (
str(default:None)) – Grouping key inref_adata. Defaults togroup_by.features (default:
None) – Specific features to use. If None, highly-variable genes are used.n_features (
int(default:2000)) – Number of top variable features to select whenfeaturesis None.method (
str(default:'pearson')) – Similarity metric:'pearson','spearman', or'cosine'.layer (
str(default:None)) – Which expression slot to read.use_raw (
bool(default:False)) – Which expression slot to read.standard_scale (
str(default:'var')) –'var'(per-gene) or'obs'(per-cell) z-scoring.cmap (
str(default:'RdBu_r')) – Colour map for the heatmap.figsize (
tuple(default:(6, 6))) – Figure size(width, height)in inches.show_values (
bool(default:True)) – Whether to print correlation values inside cells.value_fmt (
str(default:'.2f')) – Format string for printed values (e.g.'.2f').row_cluster (
bool(default:True)) – Whether to hierarchically cluster rows / columns.col_cluster (
bool(default:True)) – Whether to hierarchically cluster rows / columns.vmin (
float(default:None)) – Colour limits.vmax (
float(default:None)) – Colour limits.legend (
bool(default:True)) – Show colour bar.save (
bool|str(default:False)) – Output controls.savemay beTrue/Falseor a concrete path.save_pathway (
str(default:'')) – Output controls.savemay beTrue/Falseor a concrete path.show (
bool(default:False)) – Output controls.savemay beTrue/Falseor a concrete path.
- Returns:
Returns the Marsilea plotter by default, or the rendered figure when rendering is triggered for saving/showing/tight legends.
- Return type:
marsilea.Heatmap or matplotlib.figure.Figure