# Path: abstar/utils/indels.py
# class Indel(object):
# class Insertion(Indel):
# class Deletion(Indel):
#     def __init__(self, indel):
#     def __contains__(self, item):
#     def __getitem__(self, key):
#     def _get_frame(self):
#     def __init__(self, indel):
#     def imgt_formatted(self):
#     def abstar_formatted(self):
#     def json_formatted(self):
#     def __init__(self, indel):
#     def imgt_formatted(self):
#     def abstar_formatted(self):
#     def json_formatted(self):
# def find_insertions(antibody, segment):
# def _annotate_insertion(segment, start, length, sequence, fixed=False):
# def _fix_frameshift_insertion(antibody, segment, s, e):
# def find_deletions(antibody, segment):
# def _annotate_deletion(segment, start, length, sequence, fixed=False):
# def _fix_frameshift_deletion(antibody, segment, s, e):
# 
# Path: abstar/utils/mixins.py
# class LoggingMixin(object):
#     """docstring for LoggingMixin"""
#     def __init__(self):
#         self._log = None
#         self._exceptions = None
# 
# 
#     @property
#     def logs(self):
#         if self._log is not None:
#             return self._log
#         return []
# 
# 
#     @property
#     def exceptions(self):
#         if self._exceptions is not None:
#             return self._exceptions
#         return []
# 
# 
#     def log(self, *args, **kwargs):
#         '''
#         Records a log message
#         '''
#         sep = kwargs.get('sep', ' ')
#         lstring = sep.join([str(a) for a in args])
#         if self._log is None:
#             self._log = [lstring, ]
#         else:
#             self._log.append(lstring)
# 
# 
#     def exception(self, *args, **kwargs):
#         '''
#         Records an exception.
#         '''
#         sep = kwargs.get('sep', '\n')
#         estring = sep.join([str(a) for a in args])
#         if self._exceptions is None:
#             self._exceptions = [estring, ]
#         else:
#             self._exceptions.append(estring)
# 
# 
#     def format_log(self):
#         '''
#         Formats the log, including exceptions.
# 
#         Log formatting will only be performed on sequences that had an
#         error during annotation, unless AbStar is run in debug
#         mode. In debug mode, all sequences will be logged.
# 
#         Returns:
#         --------
# 
#             str: Formatted log string.
#         '''
#         output = ''
#         output += '\n'.join(self.logs)
#         if self._check_for_exceptions():
#             output += '\n\n'
#             output += self._format_exceptions()
#         output += '\n\n'
#         return output
# 
# 
#     def _check_for_exceptions(self):
#         if self.exceptions:
#             return True
#         if self.v is not None:
#             if self.v._exceptions:
#                 return True
#         if self.d is not None:
#             if self.d._exceptions:
#                 return True
#         if self.j is not None:
#             if self.j._exceptions:
#                 return True
#         return False
# 
# 
#     def _format_exceptions(self):
#         exceptions = []
#         exceptions += self.exceptions
#         estring = '\n\nEXCEPTIONS\n'
#         estring += '----------\n\n'
#         if self.v is not None:
#             exceptions += self.v.exceptions
#         if self.d is not None:
#             exceptions += self.d.exceptions
#         if self.j is not None:
#             exceptions += self.j.exceptions
#         estring += '\n\n'.join([e for e in exceptions])
#         return estring


import math
import os
import traceback
from Bio import SeqIO
from Bio.Seq import Seq
from abutils.core.sequence import Sequence
from abutils.utils.alignment import global_alignment, local_alignment
from abutils.utils.codons import codon_lookup
from abutils.utils.decorators import lazy_property
from ..utils import indels
from ..utils.mixins import LoggingMixin
    """
    docstring for Germline

    Args:
    -----

        full (str): Full name of the germline gene, following IMGT naming conventions
            (eg: IGHV3-23*02).

        species (str): Species from which the germline gene was derived. Choices include
            'human', 'macaque', mouse', rabbit'.

        score (float): Score of the top germline alignment. Optional. If ``score`` is not
            provided, the realignment score will be used instead.

        strand (str): Strand of the alignment. Options are ``'+'`` for the positive strand
            (meaning the germline gene and the query sequence are in the same orientation)
            or ``'-'`` for the negative strand (query sequence is the reverse complement of
            the germline gene). Optional.

        others (list(Germline)): An optional list of additional high scoring germline genes.
            Can be a list of arbitrary length, with each member of the list being another
            ``Germline`` instance.

        assigner_name (str): The assigner name. Will be converted to lowercase. Optional.
            If not provided, ``assigner_name`` will be set to ``'unknown'``.
    """
    def __init__(self, raw, species, db_name, receptor, score=None, strand=None,
                 others=None, assigner_name=None, initialize_log=True):
        super(GermlineSegment, self).__init__()

# Path: abstar/utils/indels.py
# class Indel(object):
# class Insertion(Indel):
# class Deletion(Indel):
#     def __init__(self, indel):
#     def __contains__(self, item):
#     def __getitem__(self, key):
#     def _get_frame(self):
#     def __init__(self, indel):
#     def imgt_formatted(self):
#     def abstar_formatted(self):
#     def json_formatted(self):
#     def __init__(self, indel):
#     def imgt_formatted(self):
#     def abstar_formatted(self):
#     def json_formatted(self):
# def find_insertions(antibody, segment):
# def _annotate_insertion(segment, start, length, sequence, fixed=False):
# def _fix_frameshift_insertion(antibody, segment, s, e):
# def find_deletions(antibody, segment):
# def _annotate_deletion(segment, start, length, sequence, fixed=False):
# def _fix_frameshift_deletion(antibody, segment, s, e):
# 
# Path: abstar/utils/mixins.py
# class LoggingMixin(object):
#     """docstring for LoggingMixin"""
#     def __init__(self):
#         self._log = None
#         self._exceptions = None
# 
# 
#     @property
#     def logs(self):
#         if self._log is not None:
#             return self._log
#         return []
# 
# 
#     @property
#     def exceptions(self):
#         if self._exceptions is not None:
#             return self._exceptions
#         return []
# 
# 
#     def log(self, *args, **kwargs):
#         '''
#         Records a log message
#         '''
#         sep = kwargs.get('sep', ' ')
#         lstring = sep.join([str(a) for a in args])
#         if self._log is None:
#             self._log = [lstring, ]
#         else:
#             self._log.append(lstring)
# 
# 
#     def exception(self, *args, **kwargs):
#         '''
#         Records an exception.
#         '''
#         sep = kwargs.get('sep', '\n')
#         estring = sep.join([str(a) for a in args])
#         if self._exceptions is None:
#             self._exceptions = [estring, ]
#         else:
#             self._exceptions.append(estring)
# 
# 
#     def format_log(self):
#         '''
#         Formats the log, including exceptions.
# 
#         Log formatting will only be performed on sequences that had an
#         error during annotation, unless AbStar is run in debug
#         mode. In debug mode, all sequences will be logged.
# 
#         Returns:
#         --------
# 
#             str: Formatted log string.
#         '''
#         output = ''
#         output += '\n'.join(self.logs)
#         if self._check_for_exceptions():
#             output += '\n\n'
#             output += self._format_exceptions()
#         output += '\n\n'
#         return output
# 
# 
#     def _check_for_exceptions(self):
#         if self.exceptions:
#             return True
#         if self.v is not None:
#             if self.v._exceptions:
#                 return True
#         if self.d is not None:
#             if self.d._exceptions:
#                 return True
#         if self.j is not None:
#             if self.j._exceptions:
#                 return True
#         return False
# 
# 
#     def _format_exceptions(self):
#         exceptions = []
#         exceptions += self.exceptions
#         estring = '\n\nEXCEPTIONS\n'
#         estring += '----------\n\n'
#         if self.v is not None:
#             exceptions += self.v.exceptions
#         if self.d is not None:
#             exceptions += self.d.exceptions
#         if self.j is not None:
#             exceptions += self.j.exceptions
#         estring += '\n\n'.join([e for e in exceptions])
#         return estring


# Path: abstar/core/germline.py
import math
import os
import traceback
from Bio import SeqIO
from Bio.Seq import Seq
from abutils.core.sequence import Sequence
from abutils.utils.alignment import global_alignment, local_alignment
from abutils.utils.codons import codon_lookup
from abutils.utils.decorators import lazy_property
from ..utils import indels
from ..utils.mixins import LoggingMixin

    """
    docstring for Germline

    Args:
    -----

        full (str): Full name of the germline gene, following IMGT naming conventions
            (eg: IGHV3-23*02).

        species (str): Species from which the germline gene was derived. Choices include
            'human', 'macaque', mouse', rabbit'.

        score (float): Score of the top germline alignment. Optional. If ``score`` is not
            provided, the realignment score will be used instead.

        strand (str): Strand of the alignment. Options are ``'+'`` for the positive strand
            (meaning the germline gene and the query sequence are in the same orientation)
            or ``'-'`` for the negative strand (query sequence is the reverse complement of
            the germline gene). Optional.

        others (list(Germline)): An optional list of additional high scoring germline genes.
            Can be a list of arbitrary length, with each member of the list being another
            ``Germline`` instance.

        assigner_name (str): The assigner name. Will be converted to lowercase. Optional.
            If not provided, ``assigner_name`` will be set to ``'unknown'``.
    """
    def __init__(self, raw, species, db_name, receptor, score=None, strand=None,
                 others=None, assigner_name=None, initialize_log=True):
        super(GermlineSegment, self).__init__()

        LoggingMixin.__init__(self)