Module 6 · Association · step 7 of 8
6.7First look and association checkpoint
Commands tested on Windows
In short
We summarise the sample and variant counts, valid tests and results below the course significance threshold of 5 × 10⁻⁸ (0.00000005). We also measure whether test values are generally larger than expected without effects and save the key files in a checked checkpoint for restarting.
Do this
- Paste in the RStudio ConsoleThe R command in the Command section below
You should see: 1,811 retained samples, 238,513 retained variants and 236,815 tests with finite p-values.
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.
1results <- guided_association(guided_path(cfg, "6.4", "association"))summary <- data.frame(samples = 1811, retained_variants = 238513, finite_tests = sum(valid_p(results$P)), genome_wide = sum(results$P[valid_p(results$P)] < 5e-8), lambda_autosomes = lambda_gc(results$P[results$CHROM %in% as.character(1:22)]))2guided_write(summary, guided_path(cfg, "6.7", "summary.tsv"))print(summary)# Course bookkeeping: records the counts for the next step. Do not change.files <- c(paste0(guided_path(cfg, "6.4", "association"), ".Disease.glm.logistic.hybrid"), guided_path(cfg, "6.3", "covariates.tsv"), guided_path(cfg, "6.5", "top20.tsv"), guided_path(cfg, "6.7", "summary.tsv"))guided_artifact_checkpoint(cfg, "6.7", files)check_step("6.7", data_dir = cfg$out, work_dir = cfg$out)- Note 1: Read the results and summarise the study size and test values.
- Note 2: Save and print the summary table.
You need
The association output from 6.4 and the table you reviewed at 6.5.
What we do
Summarise the valid tests. Save the key association files so that you can restart from here.
Why
A list of small p-values is not yet an interpretation. Before you plot, write down the model, the cohort, the number of tests and the fitting status. The next module explains multiple testing (opens in a new tab), correlated peaks and confounding. Never call a simulated top result a clinical finding. Never assume that the nearest gene is the cause.
PLINK terminal equivalent. Optional: you do not need it for the course.
Not applicable. This step needs no PLINK operation. The R chunk is the complete command.
R reads or calculates the values it shows. It does not change the genotype files.
Expected result
Show the expected result
1,811 retained samples, 238,513 retained variants and 236,815 tests with finite p-values. Eight variants are genome-wide significant. The autosomal lambda (opens in a new tab) is about 1.016. The key analysis files get a manifest: a list of files with their SHA-256 (opens in a new tab) checksums.
The tested PLINK version is defined in config.R and recorded in
software_versions.txt. Validation: executable chunks passed on Windows; main test counts and significance match the expected values.
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 log. Do not use files from a different version of the dataset. See troubleshooting (opens in a new tab).
Quick check
Do eight significant variants always mean eight independent association signals?
Show the answer
No. Nearby variants can share one signal because of linkage disequilibrium (LD) (opens in a new tab). Clumping at 7.5 groups the correlated associations.
Files created
s6-7_summary.tsv, the association checkpoint files and checkpoints/6.7/MANIFEST.tsv.