pyGenClean.FlagHW package¶
For more information about how to use this module, refer to the Hardy Weinberg Equilibrium Module.
Module contents¶
Submodules¶
pyGenClean.FlagHW.flag_hw module¶
-
exception
pyGenClean.FlagHW.flag_hw.ProgramError(msg)[source]¶ Bases:
exceptions.ExceptionAn
Exceptionraised in case of a problem.Parameters: msg (str) – the message to print to the user before exiting.
-
pyGenClean.FlagHW.flag_hw.checkArgs(args)[source]¶ Checks the arguments and options.
Parameters: args ( argparse.Namespace) – aargparse.Namespaceobject containing the options of the program.Returns: Trueif everything was OK.If there is a problem with an option, an exception is raised using the
ProgramErrorclass, a message is printed to thesys.stderrand the program exists with code 1.
-
pyGenClean.FlagHW.flag_hw.compareBIMfiles(beforeFileName, afterFileName, outputFileName)[source]¶ Compare two BIM files for differences.
Parameters: Returns: the number of differences between the two files.
The
bimfiles contain the list of markers in a given dataset. Thebeforefile should have more markers than theafterfile. Theafterfile should be a subset of the markers in thebeforefile.
-
pyGenClean.FlagHW.flag_hw.computeHWE(prefix, threshold, outPrefix)[source]¶ Compute the Hardy Weinberg test using Plink.
Parameters: Uses Plink to exclude markers that failed the Hardy-Weinberg test at a specified significance threshold.
-
pyGenClean.FlagHW.flag_hw.computeNumberOfMarkers(inputFileName)[source]¶ Count the number of marker (line) in a BIM file.
Parameters: inputFileName (str) – the name of the bimfile.Returns: the number of marker in the bimfile.
-
pyGenClean.FlagHW.flag_hw.main(argString=None)[source]¶ The main function.
Parameters: argString (list) – the options. These are the steps performed by this module:
- Prints the options of the module.
- Computes the number of markers in the input file
(
computeNumberOfMarkers()). - If there are no markers, the module stops.
- Computes the Bonferroni therhold (\(0.05 / \textrm{nbMarkers}\)).
- Runs Plink to find failed markers with the Bonferroni threshold.
- Runs Plink to find failed markers with the default threshold.
- Compares the
bimfiles for the Bonferroni threshold. - Compares the
bimfiles for the default threshold. - Computes the “in between” marker list, which is the markers from the default threshold and the Bonferroni threshold.
-
pyGenClean.FlagHW.flag_hw.parseArgs(argString=None)[source]¶ Parses the command line options and arguments.
Parameters: argString (list) – the options. Returns: A argparse.Namespaceobject created by theargparsemodule. It contains the values of the different options.Options Type Description --bfilestring The input file prefix (binary Plink file). --hwefloat The Hardy-Weinberg equilibrium threshold. --outstring The prefix of the output files. Note
No option check is done here (except for the one automatically done by argparse). Those need to be done elsewhere (see
checkArgs()).
-
pyGenClean.FlagHW.flag_hw.runCommand(command)[source]¶ Run a command.
Parameters: command (list) – the command to run. Tries to run a command. If it fails, raise a
ProgramError. This function uses thesubprocessmodule.Warning
The variable
commandshould be a list of stings (no other type).
