GeneExpression

Contents

GeneExpression#

class alphagenome.visualization.plot_components.GeneExpression(gdata, show_value=True, 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, log_scale=False, track_colors=None, **kwargs)[source]#

Component for visualizing scalar gene expression.

Used to visualize 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 GeneExpression component.

Parameters:
  • gdata (GeneExpressionData) – The GeneExpressionData object to visualize.

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

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

  • log_scale (bool (default: False)) – Whether to use a log scale for the y-axis.

  • 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. If a sequence is passed, its length must match the number of tracks.

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

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.