methylseg.MethylSegHMM
- class methylseg.MethylSegHMM(n_states)[source]
Bases:
objectAbstract base class for methylseg HMM backends.
- Parameters:
n_states (int)
- __init__(n_states)[source]
Initialize an abstract HMM backend.
- Parameters:
n_states (int) – Number of hidden methylation states the backend will model.
Methods
__init__(n_states)Initialize an abstract HMM backend.
Instantiate and initialize the backend-specific HMM object.
fit(emissions[, sample_info, chrom])Fit backend-specific HMM parameters on the provided emissions.
format_fit(emissions)Convert raw emissions into the representation expected by
fit.format_predict(emissions)Convert raw emissions into the representation expected by
predict.predict(emissions)Decode hidden states for the supplied emissions.
- fit(emissions, sample_info=None, chrom=None)[source]
Fit backend-specific HMM parameters on the provided emissions.
- Parameters:
emissions – Observation sequence or feature matrix already prepared for the backend.
sample_info – Optional sample metadata used by backends that require genomic coordinates or other sample-level context.
chrom – Chromosome label for single-chromosome fitting when relevant.
- predict(emissions)[source]
Decode hidden states for the supplied emissions.
- Parameters:
emissions – Observation sequence or feature matrix prepared for prediction.
- Returns:
Hidden-state assignments in backend-specific numeric form.
- Return type:
numpy.ndarray