# Predict gene-level expression given sequences

**URL:** <https://www.alphagenomecommunity.com/t/predict-gene-level-expression-given-sequences/472>\
**Category:** Feedback & Feature Requests\
**Created:** [July 18, 2025, 7:47am UTC](https://www.alphagenomecommunity.com/t/predict-gene-level-expression-given-sequences/472 "2025-07-18T07:47:56Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![pumpkinguagua](https://yyz2.discourse-cdn.com/watermelon/user_avatar/www.alphagenomecommunity.com/pumpkinguagua/32/377_2.png) [@pumpkinguagua](https://www.alphagenomecommunity.com/u/pumpkinguagua)\
**Post date:** [July 18, 2025, 7:47am UTC](https://www.alphagenomecommunity.com/t/predict-gene-level-expression-given-sequences/472/1 "2025-07-18T07:47:56Z")

</div>

Hi, Thank you for the great work!  
I’m interested in how mutated sequences affect gene expression, and I read there is a post showing how to do the RNA expression prediction given a sequence ([Uploading sequences to AlphaGenome](https://www.alphagenomecommunity.com/t/uploading-sequences-to-alphagenome/303/1)). I found that the RNA-seq expression predictions are given for each nucliotide.

I’m wondering if it is possible to predict the RNA-seq expression on gene level, given a sequence? If not, could you share how to aggregate the predictions per basepair on gene level?

Thank you!

---

<div class="post-metadata">

**Author:** ![tward](https://yyz2.discourse-cdn.com/watermelon/user_avatar/www.alphagenomecommunity.com/tward/32/17_2.png) [@tward](https://www.alphagenomecommunity.com/u/tward)\
**Post date:** [July 18, 2025, 1:00pm UTC](https://www.alphagenomecommunity.com/t/predict-gene-level-expression-given-sequences/472/2 "2025-07-18T13:00:59Z")

</div>

Hi @pumpkinguagua,

Assuming you don’t want to provide a custom sequence, you can calculate the expression by gene by using [`score_interval`](https://www.alphagenomedocs.com/api/generated/alphagenome.models.dna_client.DnaClient.html#alphagenome.models.dna_client.DnaClient.score_interval), which takes an interval and generates a “score”, which if you use the `GeneMaskScorer` will give you a score per gene in the region. Example:

```python
from alphagenome.data import genome
from alphagenome.models import dna_client
from alphagenome.models import interval_scorers

model = dna_client.create('MY_KEY')

interval = genome.Interval('chr1', start=2 **20, end=2** 20 + 2**20)

scores = model.score_interval(
    interval,
    interval_scorers=[
        interval_scorers.GeneMaskScorer(
            requested_output=dna_client.OutputType.RNA_SEQ,
            width=200_001,
            aggregation_type=interval_scorers.IntervalAggregationType.MEAN,
        )
    ],
)[0]

```

If you want to do this on a custom sequence, unfortunately you’ll have to manually aggregate the predictions for each gene region in the prediction. We don’t have much in the way of helpers here, but you’d make a `predict_sequence` request, get the RNA\_SEQ response and then slice and aggregate for each gene.

Hope that helps!

---

<div class="post-metadata">

**Author:** ![Ilya\_Dyugay](https://yyz2.discourse-cdn.com/watermelon/user_avatar/www.alphagenomecommunity.com/ilya_dyugay/32/580_2.png) [@Ilya\_Dyugay](https://www.alphagenomecommunity.com/u/Ilya_Dyugay)\
**Post date:** [September 25, 2025, 8:20am UTC](https://www.alphagenomecommunity.com/t/predict-gene-level-expression-given-sequences/472/3 "2025-09-25T08:20:16Z")

</div>

Hi! Is it possible to make it in an ontology specific way?

---

<div class="post-metadata">

**Author:** ![dpanc](https://yyz2.discourse-cdn.com/watermelon/user_avatar/www.alphagenomecommunity.com/dpanc/32/662_2.png) [@dpanc](https://www.alphagenomecommunity.com/u/dpanc)\
**Post date:** [November 17, 2025, 3:44pm UTC](https://www.alphagenomecommunity.com/t/predict-gene-level-expression-given-sequences/472/4 "2025-11-17T15:44:44Z")

</div>

Hi,

I tested the `model.score_interval` and compared its predictions with those from `model.score_variant`.  
I found that the correlation between the two outputs is quite high (~0.98), which is great, but the absolute values differ substantially for highly expressed genes.

1. Why could this difference occur, especially for genes with high predicted expression?

2. Also, could someone clarify what the `width` parameter in `GeneMaskScorer` actually means in practice?

I’ve read [this thread](https://www.alphagenomecommunity.com/t/question-about-genemaskscorer-and-width-parameter-in-gene-level-predictions/681), but the explanation there (“The width of the target interval to include in the aggregation”) is still not fully clear to me — does it define the window size around the gene body used for aggregation, or something else?

Thanks in advance!

---

<div class="post-metadata">

**Author:** ![tward](https://yyz2.discourse-cdn.com/watermelon/user_avatar/www.alphagenomecommunity.com/tward/32/17_2.png) [@tward](https://www.alphagenomecommunity.com/u/tward)\
**Post date:** [November 17, 2025, 3:52pm UTC](https://www.alphagenomecommunity.com/t/predict-gene-level-expression-given-sequences/472/5 "2025-11-17T15:52:47Z")

</div>

@Ilya_Dyugay sorry for slow reply! Currently we return all ontology predictions so you’d need to filter to the ontologies of interest on the client-side.

@dpanc see [this question](https://www.alphagenomecommunity.com/t/versioning-for-alphagenome-api-and-model/676/2) for why there might be small differences, and the `width` parameter is effectively a center-mask that’s applied around the center of the interval before aggregating.
