Module 4 · Variant quality control · step 2 of 6
4.2Differential missingness
Commands tested on Windows
In short
We compare missing results in people with and without the disease to reduce false associations with disease. We remove variants with p-values below 1 × 10⁻⁵ (0.00001), which indicate differences that are very unlikely if missing results occur equally in both groups.
Do this
- Paste in the RStudio ConsoleThe R command in the Command section below
You should see: 120 variants are excluded. 295,439 variants and 1,844 samples remain.
Command
Module setup, needed before this step
R: module setup
source("R/guided.R")cfg <- guided_init()Blue: PLINK option · Orange: value you can change · Green: file name
R command
Type or paste into the RStudio console.
1report <- guided_path(cfg, "4.2", "missing")run_plink(cfg, c("--pfile", guided_path(cfg, "4.1"), "--test-missing", "--out", report))2x <- guided_table(paste0(report, ".missing"))p <- as.numeric(x$P)exclude <- guided_list(x$ID[!is.na(p) & p < 1e-5], guided_path(cfg, "4.2", "exclude.txt"))3run_plink(cfg, c("--pfile", guided_path(cfg, "4.1"), "--exclude", exclude, "--make-pgen", "--out", guided_path(cfg, "4.2")))# Course bookkeeping: records the counts for the next step. Do not change.ops <- guided_replay_lists(cfg, "4.2", "4.1")guided_register(cfg, "4.2", "4.1", 1844, 295439, operations = ops)- Note 1: Compare missing results in people with and without the disease.
- Note 2: Read the test results and list variants with p-values below 0.00001.
- Note 3: Remove the listed variants and save the remaining data.
You need
The dataset from step 4.1, which we call state 4.1. You also need the Disease column, which you joined in step 2.7.
What we do
We test whether missing calls differ between cases and controls.
Why
A variant can have a high overall call rate and still have unequal missingness in the two groups. Cases are people with the disease. Controls are people without it. Together they form the phenotype (opens in a new tab) groups. If failed calls depend on the genotype, this can create a false association.
The test gives a p-value (opens in a new tab). The p-value tells us how unlikely the observed difference would be if both groups had the same amount of missing data. It is not the probability that the variant is an error.
With many variants, some small p-values appear by chance. So we use a screening cutoff that we fixed before the analysis. The cutoff is 0.00001.
What each option does
Command 1: compare missing results
| Option or modifier | What it does |
|---|---|
| --pfile | Reads the PGEN, PVAR and PSAM files named results/guided/s4-1_state. |
| --test-missing | Tests whether missing genotype calls differ between people with and without the disease. |
| --out | Starts the test report file names with results/guided/s4-2_missing. |
Command 2: remove variants with unequal missing results
| Option or modifier | What it does |
|---|---|
| --pfile | Reads the PGEN, PVAR and PSAM files named results/guided/s4-1_state. |
| --exclude | Removes variants listed in results/guided/s4-2_exclude.txt because their missingness test p-value is below 1 × 10⁻⁵ (0.00001). |
| --make-pgen | Saves the remaining data as PGEN, PVAR and PSAM files. |
| --out | Starts the output file names with results/guided/s4-2_state. |
Every command also uses --threads 2 (PLINK runs at most two tasks at the same time) and --memory 2048 (PLINK uses at most about 2 GB of memory).
PLINK terminal equivalent. Optional: you do not need it for the course.
Blue: PLINK option · Orange: value you can change · Green: file name
Terminal equivalent: plain PLINK 2
Select any option to see what it does. Do not paste terminal commands into the R console.
bin/plink2
bin/plink2
No option selected. Each underlined part of the command is an option you can open.
Use bin\plink2.exe on Windows.
Expected result
Show the expected result
120 variants are excluded. 295,439 variants and 1,844 samples remain.
The tested PLINK version is defined in config.R and recorded in
software_versions.txt. Validation: executable chunks and the expected counts passed on Windows.
If something goes wrong
If something goes wrong
Stop at the first error. Check the input file named in the error message, and check the previous step. Keep your command and the console messages. Do not use files from a different version of the dataset. See troubleshooting (opens in a new tab).
What this check can reveal
It can reveal calling that depends on case or control status, differences in how the groups were processed, and some missingness that depends on the genotype. A significant result does not tell you the cause in the laboratory.
Quick check
Can a variant pass the overall 98% call-rate rule and still fail this check?
Show the answer
Yes. Its few missing calls can all fall in one group, for example only in the cases.
Files created
The .missing file, the reviewed exclusion list and s4-2_state.*.