Reads a population file.

    :param inputFileName: the name of the population file.
    :param requiredPopulation: the required population.

    :type inputFileName: str
    :type requiredPopulation: list

    :returns: a :py:class:`dict` containing the population of each samples.

def readPopulations(inputFileName, requiredPopulation):
    """Reads a population file.

    :param inputFileName: the name of the population file.
    :param requiredPopulation: the required population.

    :type inputFileName: str
    :type requiredPopulation: list

    :returns: a :py:class:`dict` containing the population of each samples.

    """
    populations = {}
    requiredPopulation = set(requiredPopulation)
    with open(inputFileName, "r") as inputFile:
        for line in inputFile:
            row = line.rstrip("\r\n").split("\t")

            # Getting the informations
            famID = row[0]
            indID = row[1]
            pop = row[2]

            # Check if we already saw this sample
            if (famID, indID) in populations:
                if pop != populations[(famID, indID)]:
                    msg = ("{} {}: sample has multiple population ({} and "
                           "{})".format(famID, indID, pop,
                                        populations[(famID, indID)]))
                    raise ProgramError(msg)

            # Save the population if we need it
            if pop in requiredPopulation:
                # We need this population
                populations[(famID, indID)] = pop

    popMissing = requiredPopulation - set(populations.values())
    if len(popMissing) != 0:
        msg = "Population that were asked for doesn't exists in " \
              "population file: %s" % str(popMissing)
        raise ProgramError(msg)

    return populations