from typing import Counter


def createPositionLookup(frags, pos=1):
    """Create dictionary where key is subsetted fragment coords
    (no start or no stop), value is the list of full fragments
    that share the coordinates in the key.
    Only entries where >1 full fragments share the same coordinate
    are retained"""
    fragsplit = [x.split("|") for x in frags]
    posfrags = ["|".join([x[0], x[pos], x[3]]) for x in fragsplit]
    counts = Counter(posfrags)
    starts = dict()
    for i in range(len(frags)):
        if counts[posfrags[i]] > 1:
            try:
                starts[posfrags[i]]
            except KeyError:
                starts[posfrags[i]] = [frags[i]]
            else:
                starts[posfrags[i]].append(frags[i])
        else:
            pass
    return starts