vampire.anno.pl.motif_msa

Contents

vampire.anno.pl.motif_msa#

vampire.anno.pl.motif_msa(adata, store_key='motif_msa', sample_order=None, base_colors=None, block_size=15, stripe_width=10, phase=0, show_ins_bases=False, figsize=(None, None), save=None, **kwargs)[source]#

Plot motif alignment waterfall with variant pileup.

Visualises sample sequences aligned against a reference motif. The reference row is fixed at the top; each sample occupies one row below it. Only variant positions (substitution, insertion, deletion) are drawn – matching bases are left blank.

Parameters:
  • adata (AnnData) – Annotated data with alignment results stored by tl.motif_msa().

  • store_key (str) – Key in adata.uns that holds the alignment result.

  • sample_order (list[str] | None) – Explicit order for samples on the y-axis. If None, samples are sorted alphabetically.

  • base_colors (dict[str, str] | None) – Mapping from nucleotide to hex colour. Defaults to a DNA palette.

  • block_size (int) – Pixel size of each nucleotide block.

  • stripe_width (int) – Width of alternating background stripes in bp.

  • phase (int) – Circular phase shift. When phase > 0 the motif is rolled right by phase bases before plotting (e.g. phase=1 moves the first base to the end).

  • show_ins_bases (bool) – When True, display the inserted nucleotide sequence in purple text to the right of each insertion symbol.

  • figsize (tuple[int | None, int | None] | None) – Figure size (width, height) in pixels. (None, None) triggers auto-computation from sequence length and sample count.

  • save (str | bool | None) – If True or a str, 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 fig.update_layout().

Returns:

Plotly figure with the alignment waterfall.

Return type:

Figure

Examples

>>> import vampire as vp
>>> vp.anno.pl.set_default_plotstyle()
>>> adata = vp.datasets.wdr7_hprc()
>>> vp.anno.tl.motif_msa(adata)
>>> vp.anno.pl.motif_msa(adata)