assign_consensus_enhancers#
- alphagenome.interpretation.enhancer_scoring.assign_consensus_enhancers(enhancers_df, *, min_reciprocal_overlap=0.5)[source]#
Assigns cross-biosample consensus peak bounds via reciprocal-overlap NMS.
Calling active enhancers per biosample on a sliding tile grid can place summits of the same regulatory element on slightly shifted overlapping tiles; clustering them into shared consensus coordinates lets callers compare enhancer scores or count active biosamples across conditions.
Within each
(gene_id, chromosome)group, distinct(start, end)enhancer intervals are ranked by their row count inenhancers_df(breaking ties by ascending(start, end)) and clustered greedily: each candidate interval is assigned to the highest-overlapping already-accepted representative peak whose mutual overlapoverlap / max(len_a, len_b)is at leastmin_reciprocal_overlap, or starts a new consensus peak otherwise.- Parameters:
enhancers_df (
DataFrame) – DataFrame of called enhancer-gene links (such as the output ofget_active_enhancers) containing at leastgene_id,chromosome,start, andendcolumns. Any existingconsensus_peak_startandconsensus_peak_endcolumns are replaced.min_reciprocal_overlap (
float(default:0.5)) – Minimum mutual overlap fractionoverlap / max(len_a, len_b)in(0, 1]required to merge an interval into an existing consensus representative.
- Return type:
- Returns:
Copy of
enhancers_df(preserving its index and row order) with integerconsensus_peak_startandconsensus_peak_endcolumns appended.- Raises:
ValueError – If
min_reciprocal_overlapis not in(0, 1], ifenhancers_dfis missing any ofgene_id,chromosome,start, orend, if those columns contain null values, or if any interval does not satisfystart < end.