# 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

    def _get_tgt_length(self, var):
        """Get the total length of the whole reference sequence
        """
        if var.type == "g" or var.type == "m":
            return float("inf")
        else:
            # Get genomic sequence access number for this transcript
            identity_info = self.hdp.get_tx_identity_info(var.ac)
            if not identity_info:
                raise HGVSDataNotAvailableError(
                    "No identity info available for {ac}".format(ac=var.ac))
            tgt_len = sum(identity_info["lengths"])
            return tgt_len

    def _fetch_bounded_seq(self, var, start, end, window_size, boundary):
        """Fetch reference sequence from hgvs data provider.

        The start position is 0 and the interval is half open
        """
        var_len = end - start - window_size

        start = start if start >= boundary[0] else boundary[0]
        end = end if end <= boundary[1] else boundary[1]
        if start >= end:
            return ""

        seq = self.hdp.get_seq(var.ac, start, end)

        if len(seq) < end - start and len(seq) < var_len:

# 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


    def _get_tgt_length(self, var):
        """Get the total length of the whole reference sequence
        """
        if var.type == "g" or var.type == "m":
            return float("inf")
        else:
            # Get genomic sequence access number for this transcript
            identity_info = self.hdp.get_tx_identity_info(var.ac)
            if not identity_info:
                raise HGVSDataNotAvailableError(
                    "No identity info available for {ac}".format(ac=var.ac))
            tgt_len = sum(identity_info["lengths"])
            return tgt_len

    def _fetch_bounded_seq(self, var, start, end, window_size, boundary):
        """Fetch reference sequence from hgvs data provider.

        The start position is 0 and the interval is half open
        """
        var_len = end - start - window_size

        start = start if start >= boundary[0] else boundary[0]
        end = end if end <= boundary[1] else boundary[1]
        if start >= end:
            return ""

        seq = self.hdp.get_seq(var.ac, start, end)

        if len(seq) < end - start and len(seq) < var_len:

            raise HGVSInvalidVariantError(