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.

    """
    # Checking the input file
    for file_name in [args.tfile + i for i in {".tfam", ".tped"}]:
        if not os.path.isfile(file_name):
            msg = "{}: no such file".format(file_name)
            raise ProgramError(msg)

    # Checking the xlimit
    if args.xlim is not None:
        if args.xlim[0] >= args.xlim[1]:
            msg = "invalid xlim"
            raise ProgramError(msg)

    # Checking the ymax
    if args.ymax is not None:
        if args.ymax <= 0:
            msg = "invalid ymax (must be above 0)"
            raise ProgramError(msg)

    return True