Lesson 15 of 15

Variant Effect Prediction

This is What AlphaGenome Does

You have now built all the conceptual pieces of AlphaGenome:

ConceptAlphaGenome equivalent
DNA sequence1 million bp one-hot encoded input
GC windows / motif findingConvolutional layers
Long-range contextTransformer layers
Regulatory scoringMulti-task output heads (expression, accessibility, histone marks…)
Variant = apply_variantCompare ref vs alt predictions

Variant effect prediction is the core use-case: given a reference sequence and a variant (position + alternative base), compute a delta score — the predicted change in regulatory activity.

def regulatory_score(seq):
    score = 0
    score += seq.count("TATA")  * 10
    score += seq.count("CACCC") * 5
    score += seq.count("CG")    * 2
    return score

def variant_effect(ref_seq, pos, alt_base):
    alt_seq = ref_seq[:pos] + alt_base + ref_seq[pos+1:]
    return regulatory_score(alt_seq) - regulatory_score(ref_seq)

A positive delta means the variant increases regulatory activity (activating). A negative delta means it reduces it (repressive). Zero means neutral.

ref = "AATACGCG"     # score = 4  (2 CpGs)
print(variant_effect(ref, 0, "T"))   # T at pos 0 creates TATA → +10

AlphaGenome runs this comparison not for one score but for thousands of molecular outputs simultaneously — gene expression in each tissue, chromatin accessibility, histone marks, and more.

Your Task

Implement variant_effect(ref_seq, pos, alt_base) that returns the score delta, and classify_variant(delta) that returns "activating", "repressive", or "neutral".

Python runtime loading...
Loading...
Click "Run" to execute your code.