Tracks

Contents

Tracks#

class alphagenome.visualization.plot_components.Tracks(tdata, cmap='viridis', truncate_cmap=True, track_height=1.0, filled=False, ylabel_template='{name}:{strand}', ylabel_horizontal=True, shared_y_scale=False, global_ylims=None, max_num_tracks=50, track_colors=None, **kwargs)[source]#

Component for visualizing tracks.

Initializes the Tracks component.

Parameters:
  • tdata (TrackData) – The TrackData object to visualize.

  • cmap (str (default: 'viridis')) – The colormap to use for the tracks.

  • truncate_cmap (bool (default: True)) – Whether to slightly truncate the colormap to avoid extreme values.

  • track_height (float (default: 1.0)) – The height of each track.

  • filled (bool (default: False)) – Whether to fill the area under the tracks.

  • ylabel_template (str (default: '{name}:{strand}')) – A template for the y-axis labels.

  • ylabel_horizontal (bool (default: True)) – Whether to make the y-axis labels horizontal.

  • shared_y_scale (bool (default: False)) – Whether to use the same y-axis scale for all tracks.

  • global_ylims (tuple[float, float] | None (default: None)) – Optional global y-axis limits (min and max).

  • max_num_tracks (int (default: 50)) – The maximum number of tracks to plot.

  • track_colors (Sequence[str | tuple[float, float, float] | tuple[float, float, float, float]] | str | None (default: None)) – An optional sequence of colors to use for the tracks. If a string is passed, it is used as a single color for all tracks.

  • **kwargs – Additional keyword arguments to pass to the plotting function.

Raises:

ValueError – If the number of tracks exceeds max_num_tracks or if the track data has more than one positional axis or if the interval is not set within the track data.

Methods

get_ax_height(axis_index)

Returns the height of the axis.

plot_ax(ax, axis_index, interval)

Plots the tracks on the given axis.