SAIGE GWAS Walkthrough

SAIGE is a Scalable and Accurate Implementation of Generalized mixed model (Chen, H. et al. 2016) implemented as an R package. It accounts for sample relatedness, provides accurate P-values even when case-control ratios are highly unbalanced, and can be used for genetic association tests in large cohorts with more than 400,000 individuals. SAIGE performs single-variant association tests for binary and quantitative traits.

For example, in UK Biobank (UKB) data there are related individuals and many phenotypes with unbalanced case/control ratios, such as rare diseases diagnoses. SAIGE has been used on imbalanced case/control ratios as large as 1:1138 with 358 cases and 407,399 controls. Ref

SAIGE authors provide a tutorial on Running SAIGE and SAIGE-GENE for how to use the software.

This document showcases how to run a SAIGE GWAS analysis on the DNAnexus Platform using UKB data, with the following steps:

  1. Merge the assay genotypes across all autosomes together into PLINK format.

  2. Use the output of the previous step to run saige_gwas_svat application to generate the variance ratio and model files. saige_gwas_svat application fits the null logistic or linear mixed model to construct the Genetic Relatedness Matrix (GRM).

  3. Perform single-variant association tests (SVAT) using the saige_gwas_svat application.

  4. Optionally concatenate the results from multiple saige_gwas_svat analysis together.

The Swiss Army Knife application (https://platform.dnanexus.com/app/swiss-army-knife on the DNAnexus Platform or https://ukbiobank.dnanexus.com/app/swiss-army-knife on the UKB platform) can be used to concatenate the autosomal assayed genotypes together and generate a single set of PLINK binary files that will be used as input to the saige_gwas_grm app.

The Swiss Army Knife interface will prompt for inputs. On the "Analysis Inputs" tab, provide the required input files by selecting the files for chromosomes 1-22 with the assayed genotypes.

Next, in the "Command line" input, paste the following code which uses PLINK to merge files together (--merge-list option is documented at cog-genomics.org)

ls *.bed | sed -e 's/.bed//g'> files_to_merge.txt;
plink --merge-list files_to_merge.txt --make-bed --out ukb_cal_chr1_22_v2_merged;
rm files_to_merge.txt;

This code will create a list of input files to be merged, merge the listed files using PLINK into a (.bim, .bed, .fam) set of files, and return the set of merged (.bim, .bed, .fam) files as output.

Note: A mem2_ssd2_v2_x8 instance was used for analysis in this example. Depending on the size of the input files, select an appropriate (enough storage and memory) instance for running Swiss Army Knife. For details, see Instance Types.

Step 2: Generate GRM Model and Variance Ratio Files

Next the output of Step 1 will be used to run saige_gwas_grm application to generate the variance ratio and model files. The saige_gwas_grm application takes the following inputs:

  • Genotype file set in PLINK binary format (.bim, .bed, .fam). These PLINK binary files should contain variants merged across all autosomes that will be used to generate the genetic relatedness matrix model and variance ratio files.

  • Phenotype file is a space or tab-delimited file with a header, containing a column for IDs of samples as they appear in the genotype data, a column for the phenotype and optional columns for non-genetic covariates, such as gender and age. The phenotype file should only have samples that are present in both the GRM and SVAT stages.

IID
pheno_binary
pheno_quant
sex
age
cov1
cov2
cov3

1000025

0

13.99

1

55

98.41

19.39

69.65

1000038

0

9.41

1

56

97.91

19.52

70.72

1000056

0

12.11

1

48

97.20

21.32

70.14

1000108

0

4.12

0

45

98.71

18.14

70.22

1000130

0

3.21

1

50

99.48

19.66

71.00

1000226

0

12.09

0

52

98.38

19.76

70.24

1000275

0

3.71

0

46

101.92

20.18

69.99

1000280

0

11.94

0

62

94.01

19.44

69.37

1000343

0

3.91

0

59

98.09

19.80

69.93

1000377

0

9.25

1

45

98.79

21.43

70.30

1000437

0

9.51

1

56

98.85

19.67

70.45

Then run saige_gwas_grm app on the merged PLINK ( .bim, .bed, .fam) fileset to get the model and the variance ratio files to be used as inputs for the saige_gwas_svat app.

Select the files for required inputs and set the configuration parameters for the run including covariates and phenotype information as well as advanced options to define thresholds for variants to be included.

The GRM app will produce a model .rda file, variance ratio file and the association result file for the subset of randomly selected markers. Use the default mem3_ssd1_v2_x32 instance type pre-selected in the app. The model .rda file and Variance ratio file will be used as inputs for saige_gwas_svat app to perform single variant association tests.

Step 3: Perform Single Variant Association Tests on UKB Imputed Data

The saige_gwas_svat app computes single variant association tests for a chunk of genomic data. UKB imputed data is chunked by chromosome, so we'll launch saige_gwas_svat app in batch mode to compute single variant association tests on each chromosome in parallel.

On selecting the SAIGE GWAS SVAT app for analysis, the GUI will prompt the user to add input files and configuration parameters. Select the Batch Run option for the Genotype BGEN Index file inputs, which will be processed in parallel batches.

Configure the files you wish to batch run, complete the required inputs section and press "Start Analysis".

Batch executions can also be launched from the CLI, see Running Batch Jobs.

Step 3 Alternative: Perform Single Variant Association Tests on UKB GATK Whole Genome pVCFs

The UK Biobank's whole genome variant data is stored in 60,000 pVCF files. This example will show how to perform single variant association tests on chromosome 22 using CLI.

First merge chromosomes 22 pVCF files into a single file as follows:

file=""

# Build input arguments for all matching VCF files
for i in $(dx find data \
  --name 'ukb23196_c22_*_v1.vcf.gz' \
  --path / \
  --brief); do
  file="$file -iin=$i"
done

# Construct and run the dx command
echo dx run swiss-army-knife \
  $file \
  --instance-type=mem3_ssd3_x24 \
  -icmd='"bcftools concat -Oz \
    \$(ls -1 ukb23196_c22*vcf.gz | sort -V) \
    > chr22_files.vcf.gz; \
    tabix -p vcf chr22_files.vcf.gz"' \
  --folder chr22/ \
  -y \
  --brief \
  --name "concat_chr22_all_files" \
| sh

Larger chromosomes may need to be merged into multiple merged files that can be passed to parallel saige_gwas_svat runs for faster processing and smaller memory footprint.

Next, run the saige_gwas_svat app. To find out what inputs are required for saige_gwas_svat app, use

dx run app-saige_gwas_svat --help

Run saige_gwas_svat app using the model and variance ratio files from Step 2 and the merged chromosome 22 and the corresponding tbi index file from the code block above:

dx run saige_gwas_svat  -ivcf_field=GT \
  -imodel_rda=file-xxxx-from-step-2 \
  -ivariance_ratio_txt=file-yyyy-from-step-2 \
  -igenotypes_vcf=file-wwww-from-the-code-block-above \
  -igenotypes_vcf_tbi=file-zzzz-from-the-code-block-above

Step 4: Optionally Concatenate the Results From Multiple saige_gwas_svat Analysis Together

If needed, Swiss Army Knife can be used to concatenate the results of multiple saige_gwas_svat runs. As input, include all association result files. Assuming association result files have a common naming pattern such as saige_step2_ukb_imp_chr*_v3.txt, use the following code in the Swiss Army Knife "command line" input field to concatenate the association result files together:

head -1 saige_step2_ukb_imp_chr22_v3.txt > saige_step2_ukb_imp_all_chr.txt;
tail -n +2 -q saige_step2_ukb_imp_chr*_v3.txt >> saige_step2_ukb_imp_all_chr.txt;
gzip saige_step2_ukb_imp_all_chr.txt;

Learn More

SAIGE documentation

Last updated

Was this helpful?