# 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
                "Unsupported normalization of protein level variants: {0}".format(var))
        if var.posedit.edit.type == "con":
            raise HGVSUnsupportedOperationError(
                "Unsupported normalization of conversion variants: {0}", format(var))

        var.fill_ref(self.hdp)

        if var.posedit.edit.type == "identity":
            var_norm = copy.deepcopy(var)
            return var_norm

        # For c. variants normalization, first convert to n. variant
        # and perform normalization at the n. level, then convert the
        # normalized n. variant back to c. variant.
        if type == "c":
            var = self.vm.c_to_n(var)

        if var.type in "nr":
            if var.posedit.pos.start.offset != 0 or var.posedit.pos.end.offset != 0:
                raise HGVSUnsupportedOperationError(
                    "Normalization of intronic variants is not supported")

        def is_valid_pos(ac, pos):
            # tests whether the sequence position actually exists
            # This is *way* janky.
            # TODO: push functionality to hdp which can implement differently
            # based on capabilities of sequence backend
            try:
                s = self.hdp.get_seq(ac, pos-1, pos)  # 0-based!
                return s != ""

# 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

                "Unsupported normalization of protein level variants: {0}".format(var))
        if var.posedit.edit.type == "con":
            raise HGVSUnsupportedOperationError(
                "Unsupported normalization of conversion variants: {0}", format(var))

        var.fill_ref(self.hdp)

        if var.posedit.edit.type == "identity":
            var_norm = copy.deepcopy(var)
            return var_norm

        # For c. variants normalization, first convert to n. variant
        # and perform normalization at the n. level, then convert the
        # normalized n. variant back to c. variant.
        if type == "c":
            var = self.vm.c_to_n(var)

        if var.type in "nr":
            if var.posedit.pos.start.offset != 0 or var.posedit.pos.end.offset != 0:
                raise HGVSUnsupportedOperationError(
                    "Normalization of intronic variants is not supported")

        def is_valid_pos(ac, pos):
            # tests whether the sequence position actually exists
            # This is *way* janky.
            # TODO: push functionality to hdp which can implement differently
            # based on capabilities of sequence backend
            try:
                s = self.hdp.get_seq(ac, pos-1, pos)  # 0-based!
                return s != ""

            except HGVSDataNotAvailableError as e: