Comment on page
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]
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_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.
The Swiss Army Knife (SAK) 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 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 the assayed genotypes.
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;
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 SAK. Visit Instance-Types documentation page to get information about instances.
Next the output of Step 1 will be used 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.
Then 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.
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 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”.
UKB’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:
for i in $(dx find data --name 'ukb23196_c22_*_v1.vcf.gz' --path / --brief); do
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, 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 \
If needed, SAK 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 (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;