Skip to main content

Appendix A — Cheat sheets

These pages collect the commands, thresholds, and formulas you’ll reach for most. Each table points back to the chapter that explains it.

A.1 The GWAS pipeline at a glance

flowchart LR
    G["Genotypes<br/>bed/bim/fam or pgen"] --> QC["QC<br/>missingness, HWE, MAF,<br/>heterozygosity, sex"]
    QC --> S["Structure<br/>LD pruning, kinship, PCA"]
    S --> N["SAIGE step 1<br/>null model + GRM"]
    N --> T["SAIGE step 2<br/>per-variant tests"]
    T --> P["Plots<br/>Manhattan, QQ, lambda"]
    P --> I["Interpretation<br/>clumping, annotation, eQTL"]

Chapters: Chapter 9, Chapter 10, Chapter 11, Chapter 12, Chapter 15.

A.2 Common QC thresholds

These are typical starting points, not laws. Record the values you used in your analysis plan (Appendix B).

Check Typical threshold PLINK flag Chapter
Variant missingness exclude if > 2% (strict) to 5% --geno 0.02 Chapter 9
Sample missingness exclude if > 2% to 5% --mind 0.02 Chapter 9
Minor allele frequency keep MAF ≥ 1% for common-variant GWAS --maf 0.01 Chapter 9
Hardy–Weinberg exclude if p < 1×10⁻⁶ (controls) --hwe 1e-6 Chapter 9
Heterozygosity exclude samples beyond ±3 SD of the mean --het Chapter 9
Sex check F < 0.2 female, F > 0.8 male --check-sex Chapter 9
Relatedness KING kinship > 0.0884 (second degree or closer) --king-cutoff 0.0884 Chapter 10
Imputation quality INFO / R² ≥ 0.3 to 0.8, depending on use --extract on filtered list Chapter 9

A.4 SAIGE essentials

Step Script Key inputs Key outputs
1 — null model step1_fitNULLGLMM.R PLINK file for GRM, phenotype file, covariates, --traitType .rda model, .varianceRatio.txt
2 — association step2_SPAtests.R Dosages (BGEN/VCF/PLINK), step 1 model and variance ratio Per-variant results: BETA, SE, p.value, AF_Allele2

Details in Chapter 12.

A.5 Reading effect sizes

Quantity Formula Read it as
Odds ratio \(OR = e^{\hat\beta}\) Change in odds per copy of the effect allele
95% CI \(e^{\hat\beta \pm 1.96 \cdot SE}\) Range of plausible ORs
Z-score \(Z = \hat\beta / SE\) Strength of evidence, signed
Two-sided p \(p = 2\,(1 - \Phi(\lvert Z \rvert))\) Probability of a result this extreme under \(H_0\)
Genomic inflation \(\lambda = \text{median}(\chi^2) / 0.4549\) ≈ 1.0 is well controlled; polygenic traits in large samples run higher
β̂ SE p OR Conclusion
0.25 0.05 6×10⁻⁷ 1.28 Moderate effect, strong evidence
0.25 0.25 0.32 1.28 Same estimate, too uncertain to conclude
−0.35 0.07 6×10⁻⁷ 0.70 Protective allele

A.6 Significance thresholds

Threshold Use
p < 5×10⁻⁸ Genome-wide significance for common variants
p < 1×10⁻⁵ “Suggestive”, for follow-up only
0.05 / number of genes (≈ 2.5×10⁻⁶) Gene-based tests across ~20,000 genes
FDR q < 0.05 Exploratory screens, PheWAS

A.7 HPC job scheduling: LSF and SLURM

Task LSF SLURM
Submit a script bsub < job.sh sbatch job.sh
Interactive session bsub -Is bash srun --pty bash
Request memory -M 16000 -R "rusage[mem=16000]" --mem=16G
Request cores -n 4 --cpus-per-task=4
Name and logs -J name -o out.%J -e err.%J --job-name=name -o out.%j -e err.%j
Array job -J "chr[1-22]", index in $LSB_JOBINDEX --array=1-22, index in $SLURM_ARRAY_TASK_ID
List my jobs bjobs squeue -u $USER
Job details bjobs -l <id> scontrol show job <id>
Cancel bkill <id> scancel <id>
Queues bqueues sinfo
Finished-job history bhist -l <id> sacct -j <id>

Details in Chapter 7.

A.8 Code comment tags

A small convention that keeps analysis scripts searchable:

# TODO:  work still to do
# FIXME: known to be wrong; fix before using results
# NOTE:  why something is done this way
# XXX:   warning; read before changing

grep -rn "FIXME" scripts/ before every release of results.