Skip to contents

This function is a part of the post-imputation quality control process prior to GWAS. This tests for Hardy-Weinberg Equilibrium (HWE) for X-chromosome variants in females. Males' hemizygous X chromosome prevents testing for HWE on their haploid X calls, and testing for HWE across all samples would have a high failure rate. This function will check for HWE across the X in females (cases and controls combined), following the recommendation in Khramtsova et al., 2023, and can remove these regions from analysis in all samples. The p-value threshold for filtering out SNPs is 0.05/no.of. X-chromosome variants.

Usage

Xhwe(DataDir, ResultDir = tempdir(), finput, filterSNP = TRUE, foutput)

Arguments

DataDir

Character string for the file path of the input PLINK binary files.

ResultDir

Character string for the file path where all output files will be stored. The default is tempdir().

finput

Character string, specifying the prefix of the input PLINK binary files.

filterSNP

Boolean value, TRUE or FALSE for filtering out the X-chromosome variants i.e., SNPs from the input file or not (i.e., only flagged). The default is FALSE.

foutput

Character string, specifying the prefix of the output PLINK binary files if filtering option for the SNPs is chosen. The default is "FALSE".

Value

A list object containing SNPs. If filterSNP = TRUE, the output filtered PLINK binary files will be produced inside DataDir.

Author

Banabithi Bose

Examples

DataDir <- GXwasR:::GXwasR_data()
ResultDir <- tempdir()
finput <- "GXwasR_example"
foutput <- "Test_output"
x <- Xhwe(
    DataDir = DataDir, ResultDir = ResultDir,
    finput = finput, foutput = foutput, filterSNP = TRUE
)
#>  Output PLINK files, prefixed as female, are in /var/folders/d6/gtwl3_017sj4pp14fbfcbqjh0000gp/T//RtmpO7c0S8
#> This test is running on a case-control dataset with female samples.
#>  Failed SNPs are excluded from the output PLINK files prefixed as Test_output is in /var/folders/d6/gtwl3_017sj4pp14fbfcbqjh0000gp/T//RtmpO7c0S8
x
#> [1] "rs56053951" "rs12353847" "rs5940058"