tacco.plots.co_occurrence_matrix¶
- co_occurrence_matrix(adata, analysis_key, score_key='log_occ', log_base=None, colors=None, show_only=None, show_only_center=None, axsize=None, hspace=None, wspace=None, x_padding=2.0, y_padding=2.0, value_cluster=False, group_cluster=False, restrict_intervals=None, p_corr='fdr_bh', cmap='bwr', cmap_vmin_vmax=None, legend=True, ax=None, scale_legend=1.0)[source]¶
Plot co-occurrence as determined by
co_occurrence()
orco_occurrence_matrix()
as a matrix.- Parameters:
adata – An
AnnData
with the co-occurence analysis in .uns. Can also be a mapping of labels toAnnData
to specify multiple datasets.analysis_key – The .uns key with the co-occurence analysis result.
score_key –
The .uns[analysis_key] key of the score to use. Available keys .uns[analysis_key] include:
’occ’: co-occurrence
’log_occ’: logarithm of the co-occurrence
’log2_occ’: base-2-logarithm of the co-occurrence; this is a not a real key but a convenience function to rescale the ‘log_occ’ values
’z’: z-score of the log of the neighbourship counts with respect to random neighbourships
’composition’: distance dependent composition, p(anno|center, dist)
’log_composition’: log of ‘composition’
’distance_distribution’: distribution of distances between anno and center ´p(dist|anno,center)´
’log_distance_distribution’: log of ‘distance_distribution’
’relative_distance_distribution’: ‘distance_distribution’ normalized to p(dist|*,center), the distance distribution of any annotation to the center
’log_relative_distance_distribution’: log of ‘relative_distance_distribution’
log_base – The base of the logarithm to use for plotting if score_key is a log quantity. If None, use the natural logarithm.
colors – The mapping of value names to colors. If None, a set of standard colors is used.
show_only – A subset of annotation values to restrict the plotting to.
show_only_center – A subset of the center annotation values to restrict the plotting to.
axsize – Tuple of width and size of a single axis. If None, some heuristic value is used.
hspace – Relative horizontal and vertical spacing between plots
vspace – Relative horizontal and vertical spacing between plots
x_padding – Absolute horizontal and vertical spacing between plots; this setting overrides hspace and vspace; if None, use the value from hspace vspace; if None, use the value from vspace
y_padding – Absolute horizontal and vertical spacing between plots; this setting overrides hspace and vspace; if None, use the value from hspace vspace; if None, use the value from vspace
value_cluster – Whether to cluster and reorder the values.
group_cluster – Whether to cluster and reorder the groups.
restrict_intervals – A list-like containing the indices of the intervals to plot. If None, all intervals are included.
cmap – A string/colormap to override the colors with globally.
cmap_vmin_vmax – A tuple giving the range of values for the colormap.
legend – Whether to include the legend
scale_legend – Set to scale height and width of legend.
ax – The
Axes
to plot on. If None, creates a fresh figure for plotting. Incompatible with dendrogram plotting.
- Returns:
A
Figure
.