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.Exception
An
Exception
raised 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.Namespace
object containing the options of the program.Returns: True
if everything was OK.If there is a problem with an option, an exception is raised using the
ProgramError
class, a message is printed to thesys.stderr
and 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
bim
files contain the list of markers in a given dataset. Thebefore
file should have more markers than theafter
file. Theafter
file should be a subset of the markers in thebefore
file.
-
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 bim
file.Returns: the number of marker in the bim
file.
-
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
bim
files for the Bonferroni threshold. - Compares the
bim
files 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.Namespace
object created by theargparse
module. It contains the values of the different options.Options Type Description --bfile
string The input file prefix (binary Plink file). --hwe
float The Hardy-Weinberg equilibrium threshold. --out
string 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 thesubprocess
module.Warning
The variable
command
should be a list of stings (no other type).