methylseg.utils.plot_interactive_beta_scatter

methylseg.utils.plot_interactive_beta_scatter(*, df_plot, sample_info, sample_info_removed, chrom, out_dir, label_col, x_col='CpG_beg', y_col='beta', label_title=None, show_plot=True, max_points=120000, overlay_regions_df=None, overlay_style='state', overlay_label_col='state', state_colors=None, region_start=None, region_end=None)[source]

Create an interactive beta scatter plot.

Parameters:
  • df_plot (DataFrame) – Probe-level table containing the plotted methylation values and labels.

  • sample_info (SampleInfo | None) – Optional sample metadata used in the plot title.

  • sample_info_removed (DataFrame | None) – Optional table of removed CpGs to draw as a separate background layer.

  • chrom (str | None) – Optional chromosome restriction for both retained and removed probes.

  • out_dir (str | None) – Optional directory where the HTML plot should be written.

  • label_col (str) – Column in df_plot containing the main point labels when no overlay table is provided.

  • x_col (str) – Column used for the x-axis.

  • y_col (str) – Column used for the y-axis.

  • label_title (str | None) – Optional legend and plot-title label override.

  • show_plot (bool) – If True, display the figure immediately.

  • max_points (int) – Maximum total retained plus removed points to render before downsampling.

  • overlay_regions_df (DataFrame | None) – Optional region table used to recolor points by overlapping regions.

  • overlay_style (str) – Overlay mode, either "state" or "highlight".

  • overlay_label_col (str) – Column in overlay_regions_df that supplies overlay labels.

  • state_colors (dict | None) – Optional biological-state color overrides.

  • region_start (int | None) – Optional region start coordinate for x-axis zooming.

  • region_end (int | None) – Optional region end coordinate for x-axis zooming.

Returns:

Plotly figure object, or None when no data remain after filtering.

Return type:

object or None