Checks the arguments and options.

    :param args: a :py:class:`Namespace` object containing the options 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 exists with code 1.

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

    :param args: a :py:class:`Namespace` object containing the options 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 exists with code 1.

    """
    # Check if we have the binary files
    for prefix in [args.bfile, args.gold_bfile]:
        if prefix is None:
            msg = "no input file"
            raise ProgramError(msg)
        for fileName in [prefix + i for i in [".bed", ".bim", ".fam"]]:
            if not os.path.isfile(fileName):
                msg = "{}: no such file".format(fileName)
                raise ProgramError(msg)

    # Check for the same sample file
    if not os.path.isfile(args.same_samples):
        msg = "{}: no such file".format(args.same_samples)
        raise ProgramError(msg)

    # Check we have either a manifest or a allele file
    if (args.source_manifest is None) and (args.source_alleles is None):
        msg = ("need an allele file (either an Illumina manifest "
               "[--source-manifest] or a file containing alleles for each "
               "marker [--source-alleles]")
        raise ProgramError(msg)
    if ((args.source_manifest is not None) and
            (args.source_alleles is not None)):
        msg = ("use either --source-manifest or --source-alleles, not both")
        raise ProgramError(msg)
    # Check for the manifests
    if args.source_manifest is not None:
        if not os.path.isfile(args.source_manifest):
            msg = "{}: no such file".format(args.source_manifest)
            raise ProgramError(msg)
    if args.source_alleles is not None:
        if not os.path.isfile(args.source_alleles):
            msg = "{}: no such file".format(args.source_alleles)
            raise ProgramError(msg)

    return True