Checks the arguments and options.

    :param args: an object containing the options of the program.
    :type args: argparse.Namespace

    :returns: ``True`` if everything was OK.

    If there is a problem with an option, an exception is raised using the
    :py:class:`ProgramError` class, a message is printed to the
    :class:`sys.stderr` and the program exists with code 1.

def checkArgs(args):
    """Checks the arguments and options.

    :param args: an object containing the options of the program.
    :type args: argparse.Namespace

    :returns: ``True`` if everything was OK.

    If there is a problem with an option, an exception is raised using the
    :py:class:`ProgramError` class, a message is printed to the
    :class:`sys.stderr` and the program exists with code 1.

    """
    # Check in input file
    if not os.path.isfile(args.file):
        msg = "%s: no such file" % args.file
        raise ProgramError(msg)

    # Check the population file
    if args.population_file is None:
        msg = "population-file: no population file"
        raise ProgramError(msg)
    elif not os.path.isfile(args.population_file):
        msg = "%s: no such file" % args.population_file
        raise ProgramError(msg)

    # Split the order
    args.population_order = args.population_order.split(",")
    nbPop = len(args.population_order)

    # Format the legend position
    args.legend_position = args.legend_position.replace("-", " ")

    # Format the color
    colors = []
    for color in args.population_colors.split(","):
        colors.append("#" + color)
    args.population_colors = colors
    if len(args.population_colors) < nbPop:
        msg = "not enough colors for the required populations"
        raise ProgramError(msg)

    # Format the point size
    sizes = []
    for size in args.population_sizes.split(","):
        try:
            sizes.append(int(size))
        except ValueError:
            msg = "%(size)s: not a valid size" % locals()
            raise ProgramError(msg)
    args.population_sizes = sizes
    if len(args.population_sizes) < nbPop:
        msg = "not enough sizes for the required populations"
        raise ProgramError(msg)

    # Format the point marker
    args.population_markers = args.population_markers.split(",")

    # Format the alpha values
    alphas = []
    for alpha in args.population_alpha.split(","):
        try:
            alphas.append(float(alpha))
        except ValueError:
            msg = "%(alpha)s: not a valid alpha value" % locals()
            raise ProgramError(msg)
    args.population_alpha = alphas

    # Check the legend alpha value
    if (args.legend_alpha < 0) or (args.legend_alpha > 1):
        msg = "%s: alpha for legend must be between " \
              "0 and 1" % str(args.legend_alpha)
        raise ProgramError(msg)

    return True