def ungroupslice(groups, gslice):
    """this is a helper for contigsub."""
    """coordinate transform: takes a match from seqingroups() and transforms to ungrouped coordinates"""
    eltsbefore = 0
    for i in range(gslice[0]):
        eltsbefore += len(groups[i]) - 1
    x = eltsbefore + gslice[1]
    return [x - 1, x + gslice[2] - 1]
