methylseg.utils.annotate_plot_df_with_regions

methylseg.utils.annotate_plot_df_with_regions(df_plot, regions_df, *, chrom_col, pos_col, overlay_style='state', region_label_col='state', state_colors=None)[source]

Annotate a plotting table with colors derived from overlapping regions.

Parameters:
  • df_plot (DataFrame) – Probe-level table that will be plotted.

  • regions_df (DataFrame) – Region table containing chromosome, interval, and label columns.

  • chrom_col (str) – Column in df_plot containing chromosome labels.

  • pos_col (str) – Column in df_plot containing genomic positions to test against the overlay intervals.

  • overlay_style (str) – Overlay mode, either "state" for region-state coloring or "highlight" for selected-versus-outside coloring.

  • region_label_col (str) – Column in regions_df whose values should control region colors.

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

Returns:

(plot_df, color_col, color_map, category_orders, color_label, legend_title) ready for Plotly scatter construction.

Return type:

tuple