import collections


def read_biogrid(biogridpath, experimentSys, colName):
    """Read BIOGRID genetic interactions and return dictionary converting each 
    interactor ID to its genetic interaction partners"""
    seedSets = collections.defaultdict(set)
    biogridfile = open(biogridpath)
    header = biogridfile.readline().split('\t')
    geneColNum = header.index(colName)
    expSysColNum = header.index('Experimental System')
    for line in biogridfile:
        tokens = line.split('\t')
        if tokens[expSysColNum] == experimentSys:
            seedSets[tokens[geneColNum]].add(tokens[geneColNum + 1])
            seedSets[tokens[geneColNum + 1]].add(tokens[geneColNum])

    return seedSets