MGHome page

GWAS course

Course map

0 of 64 steps done

Start with step 0.1Install R

Saved in this browser only.

Step 3.8

Module 3 · Sample quality control · step 8 of 8

3.8Sample QC summary and checkpoint

Commands tested on Windows

In short

We save the complete dataset after sample quality control and review the recorded counts. This gives us a checked starting point for variant quality control in module 4.

Do this

You should see: Module 3 boundary: 1,844 samples and 296,360 variants.

Command

Module setup, needed before this step

R: module setup

source("R/guided.R")cfg <- guided_init()

R command

Type or paste into the RStudio console.

1guided_snapshot(cfg, "3.8", guided_path(cfg, "3.7"), 1844, 296360, parent = "3.7")2print(read.delim(file.path(cfg$out, "step_counts.tsv")))3check_step("3.8", data_dir = cfg$out, work_dir = cfg$out)
  1. Note 1: Save a complete copy of the dataset after sample checks.
  2. Note 2: Print the recorded sample and variant counts.
  3. Note 3: Check that the saved files have the expected counts.

You need

State 3.7 and the recorded replay metadata of the steps in between.

What we do

We save the complete fileset that remains after all sample QC. This saved fileset is a checkpoint (opens in a new tab). Then we review how many samples each step removed.

Why

A table of counts must separate removals that happen one after another from flags that overlap. At this point, 1,844 wells remain from the first 2,016. This does not mean that variant QC or the checks of population structure are finished.

Keep the reason for every exclusion and the threshold that you used.

PLINK terminal equivalent. Optional: you do not need it for the course.

Not applicable: this is an R-only step, so it needs no PLINK command. The R chunk is the complete command.

R reads or calculates the displayed values without changing the genotype files.

Expected result

Show the expected result

Module 3 boundary: 1,844 samples and 296,360 variants. The restart operations for the steps in between are stored. The complete main-path package supplies full genotype copies at steps 2.8, 3.8, 4.6 and 5.7. Steps 4.6 and 5.7 are the ends of later modules. You can rebuild the states in between from the previous full checkpoint and the stored replay operations. To restart, give R the first step that you will run, for example restore_checkpoint("4.1") to start module 4. Use an empty output folder.

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).

Quick check

Does a finished sample QC checkpoint prove that every kept variant is suitable for association?

Show the answer

No. Variant QC follows in module 4.

Files created

The full checkpoint checkpoints/3.8/state.*, the working files s3-8_state.* and the updated index and count table.