MGHome page

GWAS course

Course map

0 of 64 steps done

Start with step 0.1Install R

Saved in this browser only.

Step 3.2

Module 3 · Sample quality control · step 2 of 8

3.2Sample call rate

Commands tested on Windows

In short

We remove samples with more than 2% of their genotype calls missing. This keeps samples with enough information for the later analysis.

Do this

You should see: 42 more wells are removed. 1,971 samples and 296,360 variants 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.

1run_plink(cfg, c("--pfile", guided_path(cfg, "3.1"), "--mind", "0.02", "--make-pgen", "--out", guided_path(cfg, "3.2")))# Course bookkeeping: records the counts for the next step. Do not change.ops <- guided_replay_lists(cfg, "3.2", "3.1")guided_register(cfg, "3.2", "3.1", 1971, 296360, operations = ops)
  1. Note 1: Remove samples with more than 2% of calls missing.

You need

State 3.1 and the call-rate definition from step 2.4.

What we do

We keep only samples with a call rate of at least 98%. We apply this rule after the rough cleaning.

Why

The call rate of a sample is the share of its sites that were read successfully. A threshold (cut-off value) of 98% means at most 2% missing results. It does not mean 98% missing results.

A sample with a low call rate gives less information. This reduces the effective sample size, which is the amount of usable data. A low call rate can also be associated with a laboratory group or a recruitment group.

In another study, look at the distribution of call rates before you choose a threshold.

One sample well shown as a strip of genotype cells. Most cells are filled and labelled as called; a few are empty with a dashed outline and labelled no-call. A bracket explains that call rate is called cells divided by all cells.

What each option does

Each option, with the modifiers under the option they belong to.
Option or modifierWhat it does
--pfile

Reads the PGEN, PVAR and PSAM input files that share the given name prefix.

--mind

Removes samples with more than 2% missing calls, keeping a call rate of at least 98%.

--make-pgen

Saves a new dataset as PGEN, PVAR and PSAM files.

--out

Sets the shared beginning of the output file names.

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.

Command

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

42 more wells are removed. 1,971 samples and 296,360 variants 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. Your numbers should be the same.

If something goes wrong

If something goes wrong

Stop at the first error. Check the input file named in the message and the previous step. Keep the 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

Moderate sample failures that the rough screen did not catch. Missingness can be associated with the phenotype (opens in a new tab), here case or control status (a case has the disease, a control does not). It can also be associated with a batch (opens in a new tab), which is a group of samples processed together. For this reason, write down every exclusion.

Try it

Move the call-rate threshold

See how a call-rate rule translates into missingness and into the PLINK 2 option.

A well passes if its call rate is at least
98%
so its missing calls are at most
2%
PLINK 2 option
--mind 0.02

42 of 2,013 samples fall below 98% and would be removed; 1,971 would remain.

Removed share, darker segment: 2.1%. Counts are samples strictly below the threshold in the state after step 3.1.

Quick check

A well has 1% missing calls. What is its call rate? Does it pass this rule?

Show the answer

The call rate is 99%. The well passes the 98% call-rate rule.

Files created

s3-2_state.*, the list of removed samples and the replay metadata.

Try other thresholds (optional)

Try other thresholds (optional)

Try it

Call rate of samples: --mind

Each point starts from the same input (2,013 samples, 296,360 variants) and changes one threshold.

What the chart shows
Call rate of samples: samples removed for --mind from 0.01 to 0.20651300.01course value0.020.050.10.2--mind (log scale)

--mind 0.02: 42 samples removed (course value).

Counts for every threshold tried. The course value is marked.
ThresholdRemovedRemaining
0.011181,895
0.02(course value)421,971
0.0502,013
0.102,013
0.202,013

This box is not part of the main path. No later step uses it. It does not change your results.

The call rate of a sample is the share of its calls that are not missing. --mind 0.02 removes samples with more than 2% missing calls, which is a call rate below 98%. A lower limit keeps more samples but lets in samples with poor DNA. A higher limit removes more samples and may throw away good data. A call rate of 95% to 98% is a common choice in genome-wide studies, and 98% is the stricter end of it. Each trial starts from the cohort saved at 3.1 and changes the limit only.

# Optional. Each trial starts from the same input and changes one threshold only.
thresholds <- c(0.01, 0.02, 0.05, 0.10, 0.20)
trial <- threshold_counts(cfg, guided_path(cfg, "3.1"), "--mind", thresholds)
trial$course_value <- trial$threshold == 0.02
trial
# Plot the removed samples. The course value is the large diamond.
plot_threshold_trials(trial, "Samples removed")
# Optional: add engine = "ggplot2" to plot_threshold_trials() to draw the plot with ggplot2 (install.packages("ggplot2") once first).

Plain PLINK 2 command for one trial. It writes only small files with the name that you give to --out, never a new dataset:

bin/plink2 --pfile results/guided/s3-1_state --mind 0.05 --make-just-psam --out results/trials/s3-2_trial --threads 2 --memory 2048

The log file results/trials/s3-2_trial.log states how many samples were removed. To repeat the trial, change the number after --mind and use a new --out name.

The expected result of the trials:

ThresholdSamples removedSamples remaining
0.011181,895
0.02 (course value)421,971
0.0502,013
0.102,013
0.202,013

How to read it. At 0.02 the course removes 42 wells. At 0.05 none are removed, so all 42 wells have between 2% and 5% missing calls. At 0.01 another 76 wells go (118 in total). The step is a clear case of a choice: the course value removes the wells that are poor but not broken.

Expected plot. For --mind, the horizontal axis shows the threshold and the vertical axis shows the number of samples removed. A red diamond marks the course value (0.02), where 42 samples are removed. The line joins the points in the order of the thresholds, so you can see how fast the count changes. The same plot with ggplot2 looks the same and has a light grid.