VariantAnnotation

VariantAnnotation#

class alphagenome.visualization.plot_components.VariantAnnotation(variants, colors='orange', alpha=0.8, labels=None, use_default_labels=True, label_angle=15, label_position='left')[source]#

Visualizes variants as thin line-like rectangles across plot components.

Initializes the VariantAnnotation class.

Parameters:
  • variants (Sequence[Variant]) – A sequence of Variant objects to annotate.

  • colors (str | Sequence[str] (default: 'orange')) – An optional string or sequence of strings specifying the colors of the variant annotation.

  • alpha (float (default: 0.8)) – The transparency of the variant annotation.

  • labels (Sequence[str] | None (default: None)) – An optional sequence of strings to use as labels for the variants.

  • use_default_labels (bool (default: True)) – Whether to use default labels for the variants if labels is not provided.

  • label_angle (float (default: 15)) – The angle of the variant labels.

  • label_position (str (default: 'left')) – The (horizontal) placement of the variant label, relative to the variant position. Can be any position string accepted by the horizontalalignment argument of matplotlib.axes.Axes.text.

Methods

add_label(ax, label_x_position, label, ...)

Adds a single angled label to an axis.

plot_ax(ax, interval[, hspace])

Adds a variant annotation to an individual axis.

plot_labels(ax, interval, label_height_factor)

Adds variant labels to an axis.