score_enhancers

score_enhancers#

alphagenome.interpretation.enhancer_scoring.score_enhancers(gradients_output, enhancers, *, window_size=2400, sigma=300.0)[source]#

Scores candidate enhancers for the target gene of an input gradient.

The per-position score is |sum_b gradients[pos, b]|, i.e. the gradients are summed across nucleotides before taking the absolute value (as in InputGradientsOutput.to_track_data). The score of an enhancer is the Gaussian-weighted mean of these per-position scores, centered on the enhancer midpoint ((start + end) // 2). Positions are restricted to [midpoint - window_size // 2, midpoint + window_size // 2] and clipped to the input interval.

Enhancers whose midpoint lies outside the gradient interval are not scored: they get is_scored=False and a NaN gradient_score.

Parameters:
  • gradients_output (InputGradientsOutput) – Output of DnaClient.predict_interval_gradients.

  • enhancers (Sequence[Interval]) – Candidate enhancer intervals.

  • window_size (int (default: 2400)) – Width of the window around the enhancer midpoint (bp).

  • sigma (float (default: 300.0)) – Standard deviation of the Gaussian kernel (bp).

Return type:

DataFrame

Returns:

DataFrame with one row per enhancer, in input order, with columns chromosome, start, end, name (of the enhancer interval), biosample_name, gene_id (target gene of the gradient), gradient_score, and is_scored, plus a trailing gene_name column when present in gradients_output.target_gene.

Raises:

ValueError – If window_size is negative or sigma is not positive.