Checks the arguments and options.

    :param args: an object containing the options and arguments of the program.

    :type args: :py:class:`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 exits with error code 1.

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

    :param args: an object containing the options and arguments of the program.

    :type args: :py:class:`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 exits with error code 1.

    """
    # Checking the configuration file
    if not os.path.isfile(args.conf):
        msg = "{}: no such file".format(args.conf)
        raise ProgramError(msg)

    # Check the input files
    if args.bfile is None and args.tfile is None and args.file is None:
        msg = "needs one input file prefix (--bfile, --tfile or --file)"
        raise ProgramError(msg)
    if args.bfile is not None and args.tfile is None and args.file is None:
        for fileName in [args.bfile + i for i in [".bed", ".bim", ".fam"]]:
            if not os.path.isfile(fileName):
                msg = "{}: no such file".format(fileName)
                raise ProgramError(msg)
    elif args.tfile is not None and args.bfile is None and args.file is None:
        for fileName in [args.tfile + i for i in [".tped", ".tfam"]]:
            if not os.path.isfile(fileName):
                msg = "{}: no such file".format(fileName)
                raise ProgramError(msg)
    elif args.file is not None and args.bfile is None and args.tfile is None:
        for fileName in [args.file + i for i in [".ped", ".map"]]:
            if not os.path.isfile(fileName):
                msg = "{}: no such file". format(fileName)
                raise ProgramError(msg)
    else:
        msg = "needs only one input file prefix (--bfile, --tfile or --file)"
        raise ProgramError(msg)

    return True