scviva.tools.harreman.HarremanPlottingAccessor#
- class scviva.tools.harreman.HarremanPlottingAccessor(ha)[source]#
Plotting methods accessible as
ha.pl.<method>.Created automatically by
HarremanAnalysis; users do not instantiate it directly.- Parameters:
- ha
HarremanAnalysis The analysis object whose AnnData is used when
adatais not passed.
- ha
Methods table
|
Plot the average pairwise correlation Z-scores between modules. |
|
Plot a hierarchical-clustered heatmap of pairwise correlation Z-scores. |
|
Plot correlations between module scores across cells. |
|
Plot cell-type–specific interacting cell scores across spatial coordinates. |
|
Plot spatial maps of interacting cell scores for selected gene pairs or metabolites. |
|
Plot interaction-module correlation heatmap. |
Methods
- HarremanPlottingAccessor.average_local_correlation_plot(adata=None, *, mod_cmap='tab10', vmin=-10, vmax=10, cor_cmap='RdBu_r', yticklabels=False, row_cluster=True, col_cluster=True, use_super_modules=False, super_module_dict=None, show=True)[source]#
Plot the average pairwise correlation Z-scores between modules.
Forwards to
average_local_correlation_plot().adatadefaults to the AnnData held by the analysis object.- Parameters:
- adata AnnData | None
AnnData object containing: -
uns['lc_zs']: DataFrame of pairwise correlation Z-scores -uns['modules']oruns['super_modules']-uns['mod_reordered']: ordering fromlocal_correlation_plot- mod_cmap str, default "tab10"
Colormap for module annotations.
- vmin float, default -10 and 10, respectively
Color scale limits for Z-scores.
- vmax float, default -10 and 10, respectively
Color scale limits for Z-scores.
- cor_cmap str, default "RdBu_r"
Colormap for the averaged correlation matrix.
- yticklabels bool, default False
Whether to display module labels on the heatmap.
- row_cluster bool, default True
Whether to apply clustering along rows/columns.
- col_cluster bool, default True
Whether to apply clustering along rows/columns.
- use_super_modules bool, default False
Whether to use super-modules.
- super_module_dict dict, optional
Map of super-module → list of modules, used to color modules by their parent super-module.
- show bool, default True
Whether to display the plot.
- HarremanPlottingAccessor.local_correlation_plot(adata=None, *, mod_cmap='tab10', vmin=-10, vmax=10, z_cmap='RdBu_r', yticklabels=False, use_super_modules=False, show=True)[source]#
Plot a hierarchical-clustered heatmap of pairwise correlation Z-scores.
Forwards to
local_correlation_plot().adatadefaults to the AnnData held by the analysis object.- Parameters:
- adata AnnData | None
AnnData object containing: -
uns['lc_zs']: DataFrame of pairwise correlation Z-scores -uns['modules']oruns['super_modules']-uns['linkage']: scipy linkage matrix- mod_cmap str, default "tab10"
Colormap for module color annotations.
- vmin float, default -10 and 10, respectively
Limits for the heatmap color scale.
- vmax float, default -10 and 10, respectively
Limits for the heatmap color scale.
- z_cmap str, default "RdBu_r"
Colormap for the Z-score heatmap.
- yticklabels bool, default False
Whether to show y-axis tick labels.
- use_super_modules bool, default False
Whether to use
uns['super_modules']instead ofuns['modules'].- show bool, default True
If
True, display the plot.
- HarremanPlottingAccessor.module_score_correlation_plot(adata=None, *, mod_cmap='tab10', vmin=-1, vmax=1, cor_cmap='RdBu_r', yticklabels=False, method='pearson', use_super_modules=False, super_module_dict=None, row_cluster=True, col_cluster=True, show=True)[source]#
Plot correlations between module scores across cells.
Forwards to
module_score_correlation_plot().adatadefaults to the AnnData held by the analysis object.- Parameters:
- adata AnnData | None
Must contain: -
obsm['module_scores']orobsm['super_module_scores']-uns['modules']oruns['super_modules']-uns['mod_reordered']- mod_cmap str, default "tab10"
Colormap for module annotations.
- vmin float, default -1 and 1, respectively
Color scale limits for the correlation heatmap.
- vmax float, default -1 and 1, respectively
Color scale limits for the correlation heatmap.
- cor_cmap str, default "RdBu_r"
Colormap for correlation values.
- yticklabels bool, default False
Whether to show y-axis labels.
- method {"pearson", "spearman"}, default "pearson"
Correlation method.
- use_super_modules bool, default False
Whether to use super-module scores.
- super_module_dict dict, optional
Coloring scheme based on parent super-modules.
- row_cluster bool, default True
Whether to cluster rows/columns before plotting.
- col_cluster bool, default True
Whether to cluster rows/columns before plotting.
- show bool, default True
Whether to display the plot.
- HarremanPlottingAccessor.plot_ct_interacting_cell_scores(adata=None, *, deconv_adata=None, cell_type_pair=None, interactions=None, coords_obsm_key=None, test=None, agg_only=False, normalize_values=False, sample_specific=False, s=None, vmin=None, vmax=None, figsize=(10, 10), cmap='Reds', colorbar=True, swap_y_axis=False)[source]#
Plot cell-type–specific interacting cell scores across spatial coordinates.
Forwards to
plot_ct_interacting_cell_scores().adatadefaults to the AnnData held by the analysis object.For gene pairs or metabolites.
- Parameters:
- adata AnnData | None
AnnData containing per-cell-type interaction scores.
- deconv_adata
AnnData|None If provided, interaction results are copied from this object into
adata.- cell_type_pair
list|None Cell type pairs to visualize - tuple: (“T cell”, “Macrophage”) - string: “T cell” (matches any pair containing this cell type)
- interactions
list|None Gene pairs or metabolites to visualize.
- coords_obsm_key
str|None Key for spatial coordinates in
obsm.- test
Union[Literal['parametric'],Literal['non-parametric'],None] Statistical test used during computation.
- agg_only
bool|None Whether to plot only aggregated per-cell-type interactions.
- normalize_values
bool|None Apply min–max normalization to each column.
- sample_specific
bool|None Plot one figure per sample.
- s
float|None Dot size.
- vmin
float|None Color scale limits; percentiles allowed.
- vmax
float|None Color scale limits; percentiles allowed.
- figsize
tuple|None Figure size.
- cmap
str|None Colormap for plotting.
- colorbar
bool|None Whether to display the colorbar.
- swap_y_axis
bool|None Flip y-axis orientation.
- HarremanPlottingAccessor.plot_interacting_cell_scores(adata=None, *, interactions=None, coords_obsm_key=None, test=None, only_sig_values=False, use_FDR=True, normalize_values=False, sample_specific=False, s=None, vmin=None, vmax=None, figsize=(10, 10), cmap='Reds', colorbar=True, swap_y_axis=False)[source]#
Plot spatial maps of interacting cell scores for selected gene pairs or metabolites.
Forwards to
plot_interacting_cell_scores().adatadefaults to the AnnData held by the analysis object.- Parameters:
- adata AnnData | None
Must contain interacting cell statistics in:
uns['interacting_cell_results'][test]['gp'/'m'].- interactions
list|None Gene pairs or metabolites to plot.
- coords_obsm_key
str|None Key in
adata.obsmcontaining spatial coordinates.- test
Union[Literal['parametric'],Literal['non-parametric'],None] Determines which statistical results to load.
- only_sig_values
bool|None If True, plot only significant values (FDR or p-value).
- use_FDR
bool|None If
only_sig_values=True, choose FDR instead of raw p-values.- normalize_values
bool|None Apply per-interaction min–max normalization.
- sample_specific
bool|None Plot each sample separately, using
uns['sample_key'].- s
float|None Dot size.
- vmin
float|None Color scale limits; percentiles allowed.
- vmax
float|None Color scale limits; percentiles allowed.
- figsize
tuple|None Figure size.
- cmap
str|None Colormap for the score intensity.
- colorbar
bool|None Show or hide the colorbar.
- swap_y_axis
bool|None Flip the y-axis for visualization conventions.
- HarremanPlottingAccessor.plot_interaction_module_correlation(adata=None, *, x_rotation=0, y_rotation=0, use_FDR=True, subset_interactions=None, subset_modules=None, cmap='RdBu_r', figsize=(10, 10), threshold=None)[source]#
Plot interaction-module correlation heatmap.
Forwards to
plot_interaction_module_correlation().adatadefaults to the AnnData held by the analysis object.Draws a clustered heatmap of correlation coefficients between interactions (rows) and modules (columns). Only interactions with at least one significant correlation (adjusted p-value or p-value < 0.05) are kept, non-significant entries are masked, and significant entries are annotated with
*(< 0.05),**(< 0.005) or***(< 0.0005).- Parameters:
- adata AnnData | None
AnnData object containing (as produced by
harreman.tl.compute_interaction_module_correlation):uns['interaction_module_correlation_coefs']: DataFrame of correlation coefficients (modules x interactions)uns['interaction_module_correlation_FDR']oruns['interaction_module_correlation_pvals']: matching DataFrame of adjusted p-values or p-valuesuns['cor_method']: correlation method, used to label the colorbar ("Spearman R"if"spearman", else"Pearson R")
- x_rotation
int|None Rotation (in degrees) of the x-axis (module) tick labels.
- y_rotation
int|None Rotation (in degrees) of the y-axis (interaction) tick labels.
- use_FDR
bool|None If True, use
uns['interaction_module_correlation_FDR']for significance; otherwise useuns['interaction_module_correlation_pvals'].- subset_interactions
list|None Interactions (rows) to restrict the plot to. If None, all interactions are used.
- subset_modules
list|None Modules (columns) to restrict the plot to. If None, all modules are used.
- cmap
str|None Colormap for the heatmap.
- figsize
tuple|None Figure size passed to
seaborn.clustermap().- threshold
float|None If set, keep only interactions with a significant coefficient greater than
thresholdfor at least one module.