vampire.anno.pl.haplotype_distance_heatmap#
- vampire.anno.pl.haplotype_distance_heatmap(adata, *, store_key='haplotype', metric='structural', deduplicate=False, reorder=True, cluster=False, colormap=None, figsize=(None, None), save=None, **kwargs)[source]#
Plot sample pairwise distance matrix from haplotype analysis.
Visualises one of the distance matrices stored in
obspbyvp.anno.tl.haplotype_neighbor(). Samples are annotated by their haplotype assignment so that the block structure is visible.- Parameters:
adata (
AnnData) – Annotated data with haplotype results fromvp.anno.tl.haplotype_neighbor().store_key (
str) – Key prefix matchingstore_keyused invp.anno.tl.haplotype_neighbor().metric (
str) – Which distance matrix to visualise. Options:"structural","cnv".deduplicate (
bool) – If True, collapse samples with identical motif arrays into a single row. The track label shows the first sample name followed by... (n=X)where X is the number of collapsed samples. The draw order follows the position of the first occurrence insample_order.reorder (
bool) – IfTrue, rows and columns are sorted by haplotype label so that samples from the same haplotype are adjacent.cluster (
bool) – IfTrue, hierarchically cluster rows and columns (overridesreorder).colormap (
str|list[str] |None) – Plotly colormap for the heatmap. IfNone, defaults to a red-to-white scale.figsize (
tuple[int|None,int|None] |None) – Figure size in pixels.(None, None)triggers auto-computation from the matrix dimensions so that heatmap cells are square and labels are not clipped.save (
str|bool|None) – IfTrueor astr, save the figure. A string is appended to the default filename. Infer the filetype if ending on {'.pdf','.png','.svg'}.**kwargs – Additional arguments passed to
heatmap_from_matrix.
- Returns:
Plotly figure with the distance matrix heatmap.
- Return type:
Figure
Examples
>>> import vampire as vp >>> vp.anno.pl.set_default_plotstyle() >>> adata = vp.datasets.wdr7_hprc() >>> vp.anno.tl.sample_msa(adata) >>> vp.anno.tl.haplotype_neighbor(adata) >>> vp.anno.pl.haplotype_distance_heatmap(adata, metric = "structural")