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 extremely 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 at

In this document, we’ll walk you through the following steps of running SAIGE GWAS analysis on DNAnexus platform using UKB data:

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

  2. Use the output of the previous step to run saige_gwas_grm application to generate the variance ratio and model files. saige_gwas_grm 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.

Step 1: merge the assay genotypes across all autosomes into PLINK format

We will use the swiss-army-knife (SAK) application ( on the DNAnexus platform or on the UKB platform) 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 SAK interface will prompt for inputs. On the “Analysis Inputs” tab, provide the required input files by selecting the files for chromosomes 1-22 with 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

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: We used a mem2_ssd2_v2_x8 instance for our analysis in this example. Depending on the size of the input files, you can select an appropriate (enough storage and memory) instance for running SAK. Visit Instance-Types documentation page to get information about instances.

Step 2: generate GRM model and variance ratio files

We will use the output of Step 1 to run saige_gwas_grm application to generate the variance ratio and model files. 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.

Let's run saige_gwas_grm app on the merged PLINK ( .bim, .bed, .fam) fileset to obtain 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.

Upon selecting SAIGE GWAS SVAT app for analysis, the GUI will prompt you to add input files and configuration parameters. Slide the “Enable Batch” toggle to “On” at the top right corner. Switch the input type to batch mode by clicking the “List” icon to the right of the Genotype BGEN file and Genotype BGEN Index file inputs that we want to be processed in parallel batches.

When you click on “Configure Batch” for these inputs, you’ll be taken to the configuration page. Here you can “Add Files to Batch”, then drag and drop them to the right or use the Patterns feature to auto detect file combinations that form each batch.

Complete the required inputs section and press “Start Analysis”.

You can also launch batch executions from the CLI using instructions at

Step 3 alternative: perform single variant association tests on UKB GATK whole genome pVCFs

UKB’s whole genome variant data is stored in 60,000 pVCF files. As an example, we will perform single variant association tests on chromosome 22 using CLI.

We will first merge chromosomes 22 pVCF files into a single file as follows:

for i in $(dx find data --name 'ukb23196_c22_*_v1.vcf.gz' --path / --brief); do
file="$file -iin=$i";
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

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

Next, we’ll invoke 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 \

Step 4: optionally concatenate the results from multiple saige_gwas_svat analysis together

If needed, we can use SAK 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 (for example “saige_step2_ukb_imp_chr*_v3.txt”), use the following code in SAK’s “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;