def _index_keys(columns):
    """
    Take all the key columns and build a list of possible index
    tuples that can arise from them.

    For example, given the following schema: "varId|dbSNP,gene"
    these are the possible index key lists:

    [['varId', 'gene'],
     ['dbSNP', 'gene']]
    """
    keys = [k.split('|') for k in columns]

    # recursively go through the keys
    def build_keys(primary, secondary):
        for key in primary:
            if len(secondary) == 0:
                yield [key]
            else:
                for rest in build_keys(secondary[0], secondary[1:]):
                    yield [key, *rest]

    # generate a list of all possible key tuples
    return list(build_keys(keys[0], keys[1:])) if len(keys) > 0 else []