# Path: hgvs/utils/norm.py
# def normalize_alleles(ref, start, stop, alleles, bound, ref_step, left, shuffle=True):
#     if left:
#         return normalize_alleles_left(ref, start, stop, alleles, bound, ref_step, shuffle)
#     else:
#         return normalize_alleles_right(ref, start, stop, alleles, bound, ref_step, shuffle)
# 
# Path: hgvs/exceptions.py
# class HGVSDataNotAvailableError(HGVSError):
#     pass
# 
# class HGVSUnsupportedOperationError(HGVSError):
#     pass
# 
# class HGVSInvalidVariantError(HGVSError):
#     """Exception raised when variant is inconsistent or invalid"""
#     pass


import copy
import logging
import hgvs
import hgvs.validator
import hgvs.variantmapper
from bioutils.sequences import reverse_complement
from hgvs.utils.norm import normalize_alleles
from hgvs.exceptions import HGVSDataNotAvailableError, HGVSUnsupportedOperationError, HGVSInvalidVariantError

        # ensure the end is not outside of reference sequence
        tgt_len = self._get_tgt_length(var)
        if ref_end == tgt_len + 1:
            ref = self._fetch_bounded_seq(var, tgt_len - 1, tgt_len, 0, boundary)
            alt = ref + alt
            edit = hgvs.edit.NARefAlt(ref=ref, alt=alt)
            ref_start = tgt_len
            ref_end = tgt_len

        var_norm = copy.deepcopy(var)
        var_norm.posedit.edit = edit
        var_norm.posedit.pos.start.base = ref_start
        var_norm.posedit.pos.end.base = ref_end

        if type == "c":
            var_norm = self.vm.n_to_c(var_norm)

        return var_norm

    def _get_boundary(self, var):
        """Get the position of exon-intron boundary for current variant
        """
        if var.type == "r" or var.type == "n":
            if self.cross_boundaries:
                return 0, float("inf")
            else:
                # Get genomic sequence access number for this transcript
                map_info = self.hdp.get_tx_mapping_options(var.ac)
                if not map_info:

# Path: hgvs/utils/norm.py
# def normalize_alleles(ref, start, stop, alleles, bound, ref_step, left, shuffle=True):
#     if left:
#         return normalize_alleles_left(ref, start, stop, alleles, bound, ref_step, shuffle)
#     else:
#         return normalize_alleles_right(ref, start, stop, alleles, bound, ref_step, shuffle)
# 
# Path: hgvs/exceptions.py
# class HGVSDataNotAvailableError(HGVSError):
#     pass
# 
# class HGVSUnsupportedOperationError(HGVSError):
#     pass
# 
# class HGVSInvalidVariantError(HGVSError):
#     """Exception raised when variant is inconsistent or invalid"""
#     pass


# Path: hgvs/normalizer.py
import copy
import logging
import hgvs
import hgvs.validator
import hgvs.variantmapper
from bioutils.sequences import reverse_complement
from hgvs.utils.norm import normalize_alleles
from hgvs.exceptions import HGVSDataNotAvailableError, HGVSUnsupportedOperationError, HGVSInvalidVariantError


        # ensure the end is not outside of reference sequence
        tgt_len = self._get_tgt_length(var)
        if ref_end == tgt_len + 1:
            ref = self._fetch_bounded_seq(var, tgt_len - 1, tgt_len, 0, boundary)
            alt = ref + alt
            edit = hgvs.edit.NARefAlt(ref=ref, alt=alt)
            ref_start = tgt_len
            ref_end = tgt_len

        var_norm = copy.deepcopy(var)
        var_norm.posedit.edit = edit
        var_norm.posedit.pos.start.base = ref_start
        var_norm.posedit.pos.end.base = ref_end

        if type == "c":
            var_norm = self.vm.n_to_c(var_norm)

        return var_norm

    def _get_boundary(self, var):
        """Get the position of exon-intron boundary for current variant
        """
        if var.type == "r" or var.type == "n":
            if self.cross_boundaries:
                return 0, float("inf")
            else:
                # Get genomic sequence access number for this transcript
                map_info = self.hdp.get_tx_mapping_options(var.ac)
                if not map_info:

                    raise HGVSDataNotAvailableError(