Recreating figures

Hi,

I have been using Alphagenome to see how variants affect alternative splicing I was trying to recreate the plot from Figure 3b in the Nature paper. However I have not been able to get the same numbers on my Sashimi plot. What would influence the junction read counts for me to get such different read counts?

Hi @Tony_Nguyen, welcome to the forum!

The differences are todo with the Sashimi plotting component by default normalizes the values. Setting this to False should reproduce the figure. Example code:

from alphagenome.data import genome
from alphagenome.models import dna_client
from alphagenome.models import dna_output
from alphagenome.visualization import plot_components
import numpy as np

model = dna_client.create('API_KEY')

variant = genome.Variant.from_str('chr3:197081044:TACTC>T')
interval = variant.reference_interval.resize(2**20)

variant_predictions = model.predict_variant(
    interval,
    variant,
    requested_outputs=[
        dna_output.OutputType.SPLICE_JUNCTIONS,
        dna_output.OutputType.SPLICE_SITE_USAGE,
        dna_output.OutputType.RNA_SEQ,
    ],
    ontology_terms=['UBERON:0007610'],
)
predictions = dna_output.VariantOutput(
    reference=variant_predictions.reference,
    alternate=variant_predictions.alternate,
)

ref_alt_colors = {'REF': 'grey', 'ALT': 'red'}
plot_interval = genome.Interval.from_str('chr3:197076044-197086544')
rng = np.random.default_rng(seed=42)

_ = plot_components.plot(
    [
        plot_components.Sashimi(
            predictions.reference.splice_junctions.filter_to_strand('-'),
            ylabel_template='Splice junctions (REF)',
            rng=rng,
            normalize_values=False,
        ),
        plot_components.Sashimi(
            predictions.alternate.splice_junctions.filter_to_strand('-'),
            ylabel_template='Splice junctions (ALT)',
            rng=rng,
            normalize_values=False,
        ),
        plot_components.OverlaidTracks(
            tdata={
                'REF': (
                    predictions.reference.splice_site_usage.filter_to_negative_strand()
                ),
                'ALT': (
                    predictions.alternate.splice_site_usage.filter_to_negative_strand()
                ),
            },
            colors=ref_alt_colors,
            ylabel_template='Splice sites/splice sites usage',
        ),
        plot_components.OverlaidTracks(
            tdata={
                'REF': predictions.reference.rna_seq.filter_to_unstranded(),
                'ALT': predictions.alternate.rna_seq.filter_to_unstranded(),
            },
            colors=ref_alt_colors,
            ylabel_template='RNA-seq (predicted)',
        ),
    ],
    annotations=[plot_components.VariantAnnotation([variant])],
    interval=plot_interval,
    fig_width=14,
    xlabel='{}:{}-{} (10.5 kb)'.format(
        plot_interval.chromosome, plot_interval.start, plot_interval.end
    ),
)

hope this helps!

T