OverlaidGeneExpression

OverlaidGeneExpression#

class alphagenome.visualization.plot_components.OverlaidGeneExpression(gdata, show_value=True, colors=None, log_scale=False, cmap='viridis', track_height=1.0, ylabel_template='{name}:{strand}', ylabel_horizontal=True, shared_y_scale=False, global_ylims=None, alpha=0.8, legend_loc='upper right', **kwargs)[source]#

Component for visualizing overlaid scalar gene expression.

Used to visualize overlaid gene-level predictions for denoised single-cell gene expression (SC_GENE_EXPRESSION_DENOISED; one channel per strand, in CPM) and SC_GENE_EXPRESSION.

Initializes the OverlaidGeneExpression component.

Parameters:
  • gdata (Mapping[str, GeneExpressionData]) – A mapping from names to GeneExpressionData objects.

  • show_value (bool (default: True)) – Whether to show the value of the gene expression.

  • colors (Mapping[str, str] | None (default: None)) – An optional dictionary mapping keys in gdata to colors.

  • log_scale (bool (default: False)) – Whether to use a log scale for the gene expression values.

  • cmap (str | None (default: 'viridis')) – The colormap to use if colors is not provided.

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

  • 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).

  • alpha (float (default: 0.8)) – The transparency of the plotted lines/points.

  • legend_loc (str | None (default: 'upper right')) – The location of the legend (such as ‘upper left’ or ‘best’). See the matplotlib Axes legend documentation for more details and options. If None, no legend is shown.

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

Raises:

ValueError – If the shapes or track metadata of the gdata values do not match, or if the genome intervals in gdata do not match, or if colors are provided but do not match the keys in gdata.

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.