def countGaps(sequence):
    """
    Counts the gaps in a sequence preceding each non-gap position

    Parameters
    ----------

    sequence: numpy array
        sequence

    Returns
    -------
    gapNumbers: list
        list of ints of the length of the sequence without gaps

    """
    gapNumbers = []
    gapCounter = 0
    for element in sequence:
        if element == '-':
            gapCounter += 1
        else:
            gapNumbers.append(gapCounter)
    return gapNumbers
