# Path: dark/cigar.py
# (CINS_STR, CDEL_STR, CMATCH_STR, CEQUAL_STR, CDIFF_STR,
#  CHARD_CLIP_STR) = 'IDM=XH'
# def dna2cigar(s1, s2, concise=False):
# def makeCigar(reference, query, noEdgeInsertions=True):
# def cigarTuplesToOperations(tuples, includeHardClip=True):
# def softClippedOffset(offset, pairs, cigarOperations):
# def insertionOffset(offset, pairs, cigarOperations):


from dark.cigar import CINS_STR, CDEL_STR, CMATCH_STR, CEQUAL_STR, CDIFF_STR
        if C{aa} and C{concise} are both C{True}.
    @return: A generator that yields C{str} pieces of a CIGAR string. Use
        ''.join(btopString(...)) to get a complete CIGAR string.
    """
    if aa and concise:
        raise ValueError('aa and concise cannot both be True')

    thisLength = thisOperation = currentLength = currentOperation = None

    for item in parseBtop(btopString):
        if isinstance(item, int):
            thisLength = item
            thisOperation = CEQUAL_STR if concise else CMATCH_STR
        else:
            thisLength = 1
            query, reference = item
            if query == '-':
                # The query has a gap. That means that in matching the
                # query to the reference a deletion is needed in the
                # reference.
                assert reference != '-'
                thisOperation = CDEL_STR
            elif reference == '-':
                # The reference has a gap. That means that in matching the
                # query to the reference an insertion is needed in the
                # reference.
                thisOperation = CINS_STR
            else:
                # A substitution was needed.
                assert query != reference

# Path: dark/cigar.py
# (CINS_STR, CDEL_STR, CMATCH_STR, CEQUAL_STR, CDIFF_STR,
#  CHARD_CLIP_STR) = 'IDM=XH'
# def dna2cigar(s1, s2, concise=False):
# def makeCigar(reference, query, noEdgeInsertions=True):
# def cigarTuplesToOperations(tuples, includeHardClip=True):
# def softClippedOffset(offset, pairs, cigarOperations):
# def insertionOffset(offset, pairs, cigarOperations):


# Path: dark/btop.py
from dark.cigar import CINS_STR, CDEL_STR, CMATCH_STR, CEQUAL_STR, CDIFF_STR

        if C{aa} and C{concise} are both C{True}.
    @return: A generator that yields C{str} pieces of a CIGAR string. Use
        ''.join(btopString(...)) to get a complete CIGAR string.
    """
    if aa and concise:
        raise ValueError('aa and concise cannot both be True')

    thisLength = thisOperation = currentLength = currentOperation = None

    for item in parseBtop(btopString):
        if isinstance(item, int):
            thisLength = item
            thisOperation = CEQUAL_STR if concise else CMATCH_STR
        else:
            thisLength = 1
            query, reference = item
            if query == '-':
                # The query has a gap. That means that in matching the
                # query to the reference a deletion is needed in the
                # reference.
                assert reference != '-'
                thisOperation = CDEL_STR
            elif reference == '-':
                # The reference has a gap. That means that in matching the
                # query to the reference an insertion is needed in the
                # reference.
                thisOperation = CINS_STR
            else:
                # A substitution was needed.
                assert query != reference

                thisOperation = CDIFF_STR if concise else CMATCH_STR