Combines a VariantSequence with the reading frame implied by a
        ReferenceContext, reverse complementing if necessary and finding the
        offset to the first complete codon in the cDNA sequence.
        Parameters
        ----------
        variant_sequence : VariantSequence

        reference_context : ReferenceContext

        Returns a VariantSequenceInReadingFrame object

def from_variant_sequence_and_reference_context(
            cls, variant_sequence, reference_context):
        """
        Combines a VariantSequence with the reading frame implied by a
        ReferenceContext, reverse complementing if necessary and finding the
        offset to the first complete codon in the cDNA sequence.
        Parameters
        ----------
        variant_sequence : VariantSequence

        reference_context : ReferenceContext

        Returns a VariantSequenceInReadingFrame object
        """
        (cdna_prefix, cdna_alt, cdna_suffix,
            reference_prefix, reference_suffix, n_trimmed_from_reference) = trim_sequences(
                variant_sequence, reference_context)

        logger.info(
            ("cdna_predix='%s', cdna_alt='%s', cdna_suffix='%s', "
             "reference_prefix='%s', reference_suffix='%s', n_trimmed=%d"),
            cdna_prefix,
            cdna_alt,
            cdna_suffix,
            reference_prefix,
            reference_suffix,
            n_trimmed_from_reference)

        n_mismatch_before_variant = count_mismatches_before_variant(reference_prefix, cdna_prefix)
        n_mismatch_after_variant = count_mismatches_after_variant(reference_suffix, cdna_suffix)

        ref_codon_offset = reference_context.offset_to_first_complete_codon

        # ReferenceContext carries with an offset to the first complete codon
        # in the reference sequence. This may need to be adjusted if the reference
        # sequence is longer than the variant sequence (and thus needs to be trimmed)
        offset_to_first_complete_codon = compute_offset_to_first_complete_codon(
            offset_to_first_complete_reference_codon=ref_codon_offset,
            n_trimmed_from_reference_sequence=n_trimmed_from_reference)

        cdna_sequence = cdna_prefix + cdna_alt + cdna_suffix
        variant_interval_start = len(cdna_prefix)
        variant_interval_end = variant_interval_start + len(cdna_alt)

        return VariantSequenceInReadingFrame(
            cdna_sequence=cdna_sequence,
            offset_to_first_complete_codon=offset_to_first_complete_codon,
            variant_cdna_interval_start=variant_interval_start,
            variant_cdna_interval_end=variant_interval_end,
            reference_cdna_sequence_before_variant=reference_prefix,
            reference_cdna_sequence_after_variant=reference_suffix,
            number_mismatches_before_variant=n_mismatch_before_variant,
            number_mismatches_after_variant=n_mismatch_after_variant)