API Reference

The API reference is generated from the package docstrings. Rebuilding the docs is enough to pick up docstring updates.

Workflow objects

MethylSegPathway

High-level API that coordinates preparation, training, and segmentation.

MethylDataPrep

Normalize methylation input tables into the canonical SampleInfo schema.

SampleInfo

Simple container for sample metadata and prepared methylation rows.

MethylSegConfig

Lightweight helper that knows how to build a serializable dictionary from a MethylSegPathway instance and how to write/read YAML.

MethylStateAssigner

Create per-CpG window summaries and assign coarse methylation states.

MethylStateAnalyzer

Analyze learned state separation and define rule-based CpG states.

MethylSegmentor

Class to handle segmentation of methylation data using HMMs.

Enums and labels

MethylStateAssignmentMethod

Strategies for mapping emissions to biological methylation states.

MethylationStates

Canonical biological methylation states used throughout the package.

HMMType

Supported HMM model types for segmentation.

HMM backends

MethylSegHMM

Abstract base class for methylseg HMM backends.

StickyCategoricalMethylSegHMM

Categorical HMM with strong self-transition priors for smoother segments.

CTMethylSegHMM

Continuous-time HMM backend for sparsely spaced CpGs along a chromosome.

Utility helpers

get_biological_state_colors

Return a fixed biological-state palette keyed by the canonical enum values.

get_cluster_colors

Return a discrete colormap and color lookup for integer cluster labels.

Advanced utilities and constants

The following helpers are available from methylseg.utils. They are useful when building custom plots or integrating MethylSeg results into another visualization workflow. They are documented here without adding them to the top-level methylseg import surface.

methylseg.utils.DEFAULT_BIOLOGICAL_STATE_COLORS = {'HIGH': '#FDE725', 'INTERMEDIATE': '#35B779', 'LOW': '#440154', 'PMD': '#31688E'}

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object’s

(key, value) pairs

dict(iterable) -> new dictionary initialized as if via:

d = {} for k, v in iterable:

d[k] = v

dict(**kwargs) -> new dictionary initialized with the name=value pairs

in the keyword argument list. For example: dict(one=1, two=2)

get_biological_state_colors

Return a fixed biological-state palette keyed by the canonical enum values.

get_cluster_colors

Return a discrete colormap and color lookup for integer cluster labels.

resolve_state_color_lookup

Merge biological-state color overrides with the package defaults.

build_region_overlay_df

Build a one-row overlay table describing a highlighted genomic interval.

resolve_region_overlay_df

Normalize explicit region overlays for plotting helpers.

resolve_overlay_plot_args

Normalize convenience plotting options into overlay arguments.

annotate_plot_df_with_regions

Annotate a plotting table with colors derived from overlapping regions.

plot_state_labels

Render prepared state labels with consistent overlays and view controls.

plot_interactive_beta_scatter

Create an interactive beta scatter plot.