IntervalAnnotation

IntervalAnnotation#

class alphagenome.visualization.plot_components.IntervalAnnotation(intervals, colors='darkgray', alpha=0.2, labels=None, use_default_labels=True, label_angle=15)[source]#

Visualizes intervals as rectangles across all plot components.

A rectangle is drawn for each interval and overlaid on top of the final plot, spanning all plot components.

Initializes the IntervalAnnotation class.

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

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

  • alpha (float (default: 0.2)) – The transparency of the interval annotation.

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

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

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

Methods

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

Adds a single angled label to an axis.

plot_ax(ax, interval[, hspace])

Adds the interval annotation to an individual axis.

plot_labels(ax, interval, label_height_factor)

Adds interval labels to an axis.