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 files
    for suffix in [".tped", ".tfam", ".map"]:
        fileName = args.tfile + suffix
        if not os.path.isfile(fileName):
            msg = "%(fileName)s: no such file" % locals()
            raise ProgramError(msg)

    # Checking the concordance threshold
    if ((args.snp_concordance_threshold < 0) or
            (args.snp_concordance_threshold > 1)):
        msg = "snp-concordance-threshold: must be between 0 and 1 " \
              "(not %f)" % args.snp_concordance_threshold
        raise ProgramError(msg)

    # Checking the completion threshold
    if ((args.snp_completion_threshold < 0) or
            (args.snp_completion_threshold > 1)):
        msg = "snp-completion-threshold: must be between 0 and 1 " \
              "(not %f)" % args.snp_completion_threshold
        raise ProgramError(msg)

    # Checking the difference in frequency
    if (args.frequency_difference < 0) or (args.frequency_difference > 1):
        msg = ("{}: maximal frequency difference: value must be between 0 and "
               "1 (inclusively)".format())
        raise ProgramError(msg)

    return True
def checkArgs ( args ) : for suffix in [ ".tped" , ".tfam" , ".map" ] : fileName = args . tfile + suffix if not os . path . isfile ( fileName ) : msg = "%(fileName)s: no such file" % locals ( ) raise ProgramError ( msg ) if ( ( args . snp_concordance_threshold < 0 ) or ( args . snp_concordance_threshold > 1 ) ) : msg = "snp-concordance-threshold: must be between 0 and 1 " "(not %f)" % args . snp_concordance_threshold raise ProgramError ( msg ) if ( ( args . snp_completion_threshold < 0 ) or ( args . snp_completion_threshold > 1 ) ) : msg = "snp-completion-threshold: must be between 0 and 1 " "(not %f)" % args . snp_completion_threshold raise ProgramError ( msg ) if ( args . frequency_difference < 0 ) or ( args . frequency_difference > 1 ) : msg = ( "{}: maximal frequency difference: value must be between 0 and " "1 (inclusively)" . format ( ) ) raise ProgramError ( msg ) return True
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.