def exonic_transcript_effect(variant, exon, exon_number, transcript):
    """Effect of this variant on a Transcript, assuming we already know
    that this variant overlaps some exon of the transcript.

    Parameters
    ----------
    variant : Variant

    exon : pyensembl.Exon
        Exon which this variant overlaps

    exon_number : int
        Index (starting from 1) of the given exon in the transcript's
        sequence of exons.

    transcript : pyensembl.Transcript
    """

    genome_ref = variant.trimmed_ref
    genome_alt = variant.trimmed_alt
    variant_start = variant.trimmed_base1_start
    variant_end = variant.trimmed_base1_end

    # clip mutation to only affect the current exon
    if variant_start < exon.start:
        # if mutation starts before current exon then only look
        # at nucleotides which overlap the exon
        logger.info('Mutation in variant %s starts before exon %s', variant, exon)
        assert len(genome_ref) > 0, "Unexpected insertion into intron"
        n_skip_start = exon.start - variant_start
        genome_ref = genome_ref[n_skip_start:]
        genome_alt = genome_alt[n_skip_start:]
        genome_start = exon.start
    else:
        genome_start = variant_start

    if variant_end > exon.end:
        # if mutation goes past exon end then only look at nucleotides
        # which overlap the exon
        logger.info('Mutation in variant %s ends after exon %s', variant, exon)
        n_skip_end = variant_end - exon.end
        genome_ref = genome_ref[:-n_skip_end]
        genome_alt = genome_alt[:len(genome_ref)]
        genome_end = exon.end
    else:
        genome_end = variant_end

    transcript_offset = interval_offset_on_transcript(
        genome_start, genome_end, transcript)

    if transcript.on_backward_strand:
        cdna_ref = reverse_complement(genome_ref)
        cdna_alt = reverse_complement(genome_alt)
    else:
        cdna_ref = genome_ref
        cdna_alt = genome_alt

    n_ref = len(cdna_ref)

    expected_ref = str(
        transcript.sequence[transcript_offset:transcript_offset + n_ref])

    if cdna_ref != expected_ref:
        raise ValueError(
            ("Found ref nucleotides '%s' in sequence"
             " of %s at offset %d (chromosome positions %d:%d)"
             " but variant %s has '%s'") % (
                 expected_ref,
                 transcript,
                 transcript_offset,
                 genome_start,
                 genome_end,
                 variant,
                 cdna_ref))

    utr5_length = min(transcript.start_codon_spliced_offsets)

    # does the variant start inside the 5' UTR?
    if utr5_length > transcript_offset:
        # does the variant end after the 5' UTR, within the coding region?
        if utr5_length < transcript_offset + n_ref:
            # TODO: we *might* lose the Kozak sequence or the start codon
            # but without looking at the modified sequence how can we tell
            # for sure that this is a start-loss variant?
            return StartLoss(variant, transcript)
        else:
            # if variant contained within 5' UTR
            return FivePrimeUTR(variant, transcript)

    utr3_offset = max(transcript.stop_codon_spliced_offsets) + 1

    if transcript_offset >= utr3_offset:
        return ThreePrimeUTR(variant, transcript)

    exon_start_offset = interval_offset_on_transcript(
        exon.start, exon.end, transcript)
    exon_end_offset = exon_start_offset + len(exon) - 1

    # Further below we're going to try to predict exonic splice site
    # modifications, which will take this effect_annotation as their
    # alternative hypothesis for what happens if splicing doesn't change.
    # If the mutation doesn't affect an exonic splice site, then
    # we'll just return this effect.
    coding_effect_annotation = predict_variant_coding_effect_on_transcript(
        variant=variant,
        transcript=transcript,
        trimmed_cdna_ref=cdna_ref,
        trimmed_cdna_alt=cdna_alt,
        transcript_offset=transcript_offset)

    if changes_exonic_splice_site(
            transcript=transcript,
            transcript_ref=cdna_ref,
            transcript_alt=cdna_alt,
            transcript_offset=transcript_offset,
            exon_start_offset=exon_start_offset,
            exon_end_offset=exon_end_offset,
            exon_number=exon_number):
        return ExonicSpliceSite(
            variant=variant,
            transcript=transcript,
            exon=exon,
            alternate_effect=coding_effect_annotation)
    return coding_effect_annotation
Effect of this variant on a Transcript, assuming we already know
    that this variant overlaps some exon of the transcript.

    Parameters
    ----------
    variant : Variant

    exon : pyensembl.Exon
        Exon which this variant overlaps

    exon_number : int
        Index (starting from 1) of the given exon in the transcript's
        sequence of exons.

    transcript : pyensembl.Transcript