def read_sex_problems(file_name):
    """Reads the sex problem file.

    :param file_name: the name of the file containing sex problems.

    :type file_name: str

    :returns: a :py:class:`frozenset` containing samples with sex problem.

    If there is no ``file_name`` (*i.e.* is ``None``), then an empty
    :py:class:`frozenset` is returned.

    """
    if file_name is None:
        return frozenset()

    problems = None
    with open(file_name, 'r') as input_file:
        header_index = dict([
            (col_name, i) for i, col_name in
            enumerate(input_file.readline().rstrip("\r\n").split("\t"))
        ])
        if "IID" not in header_index:
            msg = "{}: no column named IID".format(file_name)
            raise ProgramError(msg)

        problems = frozenset([
            i.rstrip("\r\n").split("\t")[header_index["IID"]]
            for i in input_file.readlines()
        ])
    return problems
Reads the sex problem file.

    :param file_name: the name of the file containing sex problems.

    :type file_name: str

    :returns: a :py:class:`frozenset` containing samples with sex problem.

    If there is no ``file_name`` (*i.e.* is ``None``), then an empty
    :py:class:`frozenset` is returned.