def map_positions(s, positions):
    """ Maps positions in an ungapped sequence to corresponding positions in a gapped sequence """
    # count number of gaps before each position
    counter = 0
    gaps = []
    for i, x in enumerate(s):
        if x == "-":
            counter += 1
        gaps.append(counter)

    # transform boundaries to corresponding positions in new sequence
    positions_transformed = []
    for x in positions:
        my_gaps = gaps[x]
        x_transformed = x + my_gaps
        positions_transformed.append(x_transformed)
    return positions_transformed