def main(argString=None):
    """The main function.

    :param argString: the options.

    :type argString: list

    These are the steps performed by this module:

    1. Prints the options of the module.
    2. Computes the number of markers in the input file
       (:py:func:`computeNumberOfMarkers`).
    3. If there are no markers, the module stops.
    4. Computes the Bonferroni therhold (:math:`0.05 / \\textrm{nbMarkers}`).
    5. Runs Plink to find failed markers with the Bonferroni threshold.
    6. Runs Plink to find failed markers with the default threshold.
    7. Compares the ``bim`` files for the Bonferroni threshold.
    8. Compares the ``bim`` files for the default threshold.
    9. Computes the "in between" marker list, which is the markers from the
       default threshold and the Bonferroni threshold.

    """
    # Getting and checking the options
    args = parseArgs(argString)
    checkArgs(args)

    logger.info("Options used:")
    for key, value in vars(args).iteritems():
        logger.info("  --{} {}".format(key.replace("_", "-"), value))

    # Compute the number of markers
    logger.info("Counting the number of markers")
    nbMarkers = computeNumberOfMarkers(args.bfile + ".bim")

    if nbMarkers <= 0:
        logger.info("  - There are no markers: STOPPING NOW!")
    else:
        logger.info("  - There are {} markers".format(nbMarkers))

        customThreshold = str(0.05 / nbMarkers)

        # Run the plink command
        logger.info("Computing the HW equilibrium for {}".format(
            customThreshold,
        ))
        computeHWE(args.bfile, customThreshold,
                   args.out + ".threshold_" + customThreshold)
        logger.info("Computing the HW equilibrium for {}".format(args.hwe))
        computeHWE(args.bfile, args.hwe, args.out + ".threshold_" + args.hwe)

        # Compare the BIM files
        logger.info("Creating the flagged SNP list for {}".format(
            customThreshold,
        ))
        custom_snps = compareBIMfiles(
            args.bfile + ".bim",
            args.out + ".threshold_" + customThreshold + ".bim",
            args.out + ".snp_flag_threshold_" + customThreshold,
        )
        logger.info("Creating the flagged SNP list for {}".format(args.hwe))
        hwe_snps = compareBIMfiles(
            args.bfile + ".bim",
            args.out + ".threshold_" + args.hwe + ".bim",
            args.out + ".snp_flag_threshold_" + args.hwe,
        )

        logger.info("Creating the in between SNP list ([{}, {}[)".format(
            args.hwe,
            customThreshold,
        ))
        file_name = args.out + ".snp_flag_threshold_between_{}-{}".format(
            args.hwe,
            customThreshold,
        )
        try:
            with open(file_name, 'w') as output_file:
                differences = hwe_snps - custom_snps
                if len(differences) > 0:
                    print >>output_file, "\n".join(differences)
        except IOError:
            msg = "{}: can't write file".format(file_name)
            raise ProgramError(msg)
def main ( argString = None ) : args = parseArgs ( argString ) checkArgs ( args ) logger . info ( "Options used:" ) for key , value in vars ( args ) . iteritems ( ) : logger . info ( "  --{} {}" . format ( key . replace ( "_" , "-" ) , value ) ) logger . info ( "Counting the number of markers" ) nbMarkers = computeNumberOfMarkers ( args . bfile + ".bim" ) if nbMarkers <= 0 : logger . info ( "  - There are no markers: STOPPING NOW!" ) else : logger . info ( "  - There are {} markers" . format ( nbMarkers ) ) customThreshold = str ( 0.05 / nbMarkers ) logger . info ( "Computing the HW equilibrium for {}" . format ( customThreshold , ) ) computeHWE ( args . bfile , customThreshold , args . out + ".threshold_" + customThreshold ) logger . info ( "Computing the HW equilibrium for {}" . format ( args . hwe ) ) computeHWE ( args . bfile , args . hwe , args . out + ".threshold_" + args . hwe ) logger . info ( "Creating the flagged SNP list for {}" . format ( customThreshold , ) ) custom_snps = compareBIMfiles ( args . bfile + ".bim" , args . out + ".threshold_" + customThreshold + ".bim" , args . out + ".snp_flag_threshold_" + customThreshold , ) logger . info ( "Creating the flagged SNP list for {}" . format ( args . hwe ) ) hwe_snps = compareBIMfiles ( args . bfile + ".bim" , args . out + ".threshold_" + args . hwe + ".bim" , args . out + ".snp_flag_threshold_" + args . hwe , ) logger . info ( "Creating the in between SNP list ([{}, {}[)" . format ( args . hwe , customThreshold , ) ) file_name = args . out + ".snp_flag_threshold_between_{}-{}" . format ( args . hwe , customThreshold , ) try : with open ( file_name , 'w' ) as output_file : differences = hwe_snps - custom_snps if len ( differences ) > 0 : print >> output_file , "\n" . join ( differences ) except IOError : msg = "{}: can't write file" . format ( file_name ) raise ProgramError ( msg )
The main function.

    :param argString: the options.

    :type argString: list

    These are the steps performed by this module:

    1. Prints the options of the module.
    2. Computes the number of markers in the input file
       (:py:func:`computeNumberOfMarkers`).
    3. If there are no markers, the module stops.
    4. Computes the Bonferroni therhold (:math:`0.05 / \\textrm{nbMarkers}`).
    5. Runs Plink to find failed markers with the Bonferroni threshold.
    6. Runs Plink to find failed markers with the default threshold.
    7. Compares the ``bim`` files for the Bonferroni threshold.
    8. Compares the ``bim`` files for the default threshold.
    9. Computes the "in between" marker list, which is the markers from the
       default threshold and the Bonferroni threshold.