smftools.analysis.compute.ep_classification

smftools.analysis.compute.ep_classification#

Enhancer/promoter NDR state classification per read.

Classifies each read's chromatin state at two genomic anchor positions (typically TSS = 0 and enhancer peak) by checking HMM feature layers in priority order: GpC_nucleosome_depleted_region_merged_lengths (NDR), GpC_large_accessible_patch_merged_lengths (Large), GpC_mid_accessible_patch_merged_lengths (Mid), GpC_small_accessible_patch_merged_lengths (Small), or None.

Key functions: classify_position(), add_ep_obs_columns().

Functions

add_ep_obs_columns(adata, references[, ...])

Add Promoter_HMM_class, Enhancer_HMM_class, Promoter_open, Enhancer_open to adata.obs.

classify_position(adata, ref_strand, target_bp)

Classify each read's patch state at the position nearest target_bp.

smftools.analysis.compute.ep_classification.classify_position(adata, ref_strand, target_bp, patch_layers=[('GpC_nucleosome_depleted_region_merged_lengths', 'NDR'), ('GpC_large_accessible_patch_merged_lengths', 'Large'), ('GpC_mid_accessible_patch_merged_lengths', 'Mid'), ('GpC_small_accessible_patch_merged_lengths', 'Small')], ref_obs_col='Reference_strand')#

Classify each read's patch state at the position nearest target_bp.

Return type:

ndarray

Parameters#

adataAnnData

AnnData with layers named in patch_layers and var column {ref_strand}_reindexed.

ref_strandstr

e.g. "6B6_top" — used to find the reindexed coordinate column.

target_bpfloat

TSS-centred bp coordinate of the anchor (e.g. 0 for TSS, -1690 for enhancer).

patch_layerslist

Priority-ordered list of (layer_name, class_label) tuples.

ref_obs_colstr

obs column that identifies which reference a read mapped to.

Returns#

np.ndarray

Object array of length n_obs; values in CATEGORIES. Reads not assigned to this ref_strand remain "None".

smftools.analysis.compute.ep_classification.add_ep_obs_columns(adata, references, tss_position=0.0, enhancer_position=-1690.0, patch_layers=[('GpC_nucleosome_depleted_region_merged_lengths', 'NDR'), ('GpC_large_accessible_patch_merged_lengths', 'Large'), ('GpC_mid_accessible_patch_merged_lengths', 'Mid'), ('GpC_small_accessible_patch_merged_lengths', 'Small')], ref_obs_col='Reference_strand')#

Add Promoter_HMM_class, Enhancer_HMM_class, Promoter_open, Enhancer_open to adata.obs.

Return type:

AnnData

Parameters#

adataAnnData

AnnData to annotate (modified in-place).

referenceslist of str

ref_strand values to classify (e.g. ["6B6_top", "6BALB_cJ_top"]).

tss_positionfloat

TSS anchor in TSS-centred bp coordinates (default 0).

enhancer_positionfloat

Enhancer anchor in TSS-centred bp (default -1690).

Returns#

AnnData

Input adata with four new obs columns added.