AbstractAnnotation#

class alphagenome.visualization.plot_components.AbstractAnnotation(annotations, colors, labels, use_default_labels)[source]#

Abstract base class for plot annotations.

Annotations are visual elements that can be added to plots to highlight specific features or regions. This class defines the common interface for all annotations.

annotations#

A sequence of Variant or Interval objects representing the annotations.

colors#

An optional string or sequence of strings specifying the colors of the annotations.

labels#

An optional sequence of strings to use as labels for the annotations.

use_default_labels#

Whether to use default labels for the annotations if labels is not provided.

Initializes the AbstractAnnotation class.

Parameters:
  • annotations (Sequence[Variant] | Sequence[Interval]) – A sequence of Variant or Interval objects.

  • colors (str | Sequence[str] | None) – An optional string or sequence of strings specifying colors.

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

  • use_default_labels (bool) – Whether to use default labels if labels is not provided.

Raises:

ValueError – If the length of colors or labels does not match the length of annotations.

Methods

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

Adds a single angled label to an axis.

plot_ax(ax, interval, hspace)

Adds the annotation to an individual axis.

plot_labels(ax, interval, label_height_factor)

Adds labels for the annotation to an axis.