DNAnexus Documentation
APIDownloadsIndex of dx CommandsLegal
  • Overview
  • Getting Started
    • DNAnexus Essentials
    • Key Concepts
      • Projects
      • Organizations
      • Apps and Workflows
    • User Interface Quickstart
    • Command Line Quickstart
    • Developer Quickstart
    • Developer Tutorials
      • Bash
        • Bash Helpers
        • Distributed by Chr (sh)
        • Distributed by Region (sh)
        • SAMtools count
        • TensorBoard Example Web App
        • Git Dependency
        • Mkfifo and dx cat
        • Parallel by Region (sh)
        • Parallel xargs by Chr
        • Precompiled Binary
        • R Shiny Example Web App
      • Python
        • Dash Example Web App
        • Distributed by Region (py)
        • Parallel by Chr (py)
        • Parallel by Region (py)
        • Pysam
      • Web App(let) Tutorials
        • Dash Example Web App
        • TensorBoard Example Web App
      • Concurrent Computing Tutorials
        • Distributed
          • Distributed by Region (sh)
          • Distributed by Chr (sh)
          • Distributed by Region (py)
        • Parallel
          • Parallel by Chr (py)
          • Parallel by Region (py)
          • Parallel by Region (sh)
          • Parallel xargs by Chr
  • User
    • Login and Logout
    • Projects
      • Project Navigation
      • Path Resolution
    • Running Apps and Workflows
      • Running Apps and Applets
      • Running Workflows
      • Running Nextflow Pipelines
      • Running Batch Jobs
      • Monitoring Executions
      • Job Notifications
      • Job Lifecycle
      • Executions and Time Limits
      • Executions and Cost and Spending Limits
      • Smart Reuse (Job Reuse)
      • Apps and Workflows Glossary
      • Tools List
    • Cohort Browser
      • Chart Types
        • Row Chart
        • Histogram
        • Box Plot
        • List View
        • Grouped Box Plot
        • Stacked Row Chart
        • Scatter Plot
        • Kaplan-Meier Survival Curve
      • Locus Details Page
    • Using DXJupyterLab
      • DXJupyterLab Quickstart
      • Running DXJupyterLab
        • FreeSurfer in DXJupyterLab
      • Spark Cluster-Enabled DXJupyterLab
        • Exploring and Querying Datasets
      • Stata in DXJupyterLab
      • Running Older Versions of DXJupyterLab
      • DXJupyterLab Reference
    • Using Spark
      • Apollo Apps
      • Connect to Thrift
      • Example Applications
        • CSV Loader
        • SQL Runner
        • VCF Loader
      • VCF Preprocessing
    • Environment Variables
    • Objects
      • Describing Data Objects
      • Searching Data Objects
      • Visualizing Data
      • Filtering Objects and Jobs
      • Archiving Files
      • Relational Database Clusters
      • Symlinks
      • Uploading and Downloading Files
        • Small File Sets
          • dx upload
          • dx download
        • Batch
          • Upload Agent
          • Download Agent
    • Platform IDs
    • Organization Member Guide
    • Index of dx commands
  • Developer
    • Developing Portable Pipelines
      • dxCompiler
    • Cloud Workstation
    • Apps
      • Introduction to Building Apps
      • App Build Process
      • Advanced Applet Tutorial
      • Bash Apps
      • Python Apps
      • Spark Apps
        • Table Exporter
        • DX Spark Submit Utility
      • HTTPS Apps
        • Isolated Browsing for HTTPS Apps
      • Transitioning from Applets to Apps
      • Third Party and Community Apps
        • Community App Guidelines
        • Third Party App Style Guide
        • Third Party App Publishing Checklist
      • App Metadata
      • App Permissions
      • App Execution Environment
        • Connecting to Jobs
      • Dependency Management
        • Asset Build Process
        • Docker Images
        • Python package installation in Ubuntu 24.04 AEE
      • Job Identity Tokens for Access to Clouds and Third-Party Services
      • Enabling Web Application Users to Log In with DNAnexus Credentials
      • Types of Errors
    • Workflows
      • Importing Workflows
      • Introduction to Building Workflows
      • Building and Running Workflows
      • Workflow Build Process
      • Versioning and Publishing Global Workflows
      • Workflow Metadata
    • Ingesting Data
      • Molecular Expression Assay Loader
        • Common Errors
        • Example Usage
        • Example Input
      • Data Model Loader
        • Data Ingestion Key Steps
        • Ingestion Data Types
        • Data Files Used by the Data Model Loader
        • Troubleshooting
      • Dataset Extender
        • Using Dataset Extender
    • Dataset Management
      • Rebase Cohorts and Dashboards
      • Assay Dataset Merger
      • Clinical Dataset Merger
    • Apollo Datasets
      • Dataset Versions
      • Cohorts
    • Creating Custom Viewers
    • Client Libraries
      • Support for Python 3
    • Walkthroughs
      • Creating a Mixed Phenotypic Assay Dataset
      • Guide for Ingesting a Simple Four Table Dataset
    • DNAnexus API
      • Entity IDs
      • Protocols
      • Authentication
      • Regions
      • Nonces
      • Users
      • Organizations
      • OIDC Clients
      • Data Containers
        • Folders and Deletion
        • Cloning
        • Project API Methods
        • Project Permissions and Sharing
      • Data Object Lifecycle
        • Types
        • Object Details
        • Visibility
      • Data Object Metadata
        • Name
        • Properties
        • Tags
      • Data Object Classes
        • Records
        • Files
        • Databases
        • Drives
        • DBClusters
      • Running Analyses
        • I/O and Run Specifications
        • Instance Types
        • Job Input and Output
        • Applets and Entry Points
        • Apps
        • Workflows and Analyses
        • Global Workflows
        • Containers for Execution
      • Search
      • System Methods
      • Directory of API Methods
      • DNAnexus Service Limits
  • Administrator
    • Billing
    • Org Management
    • Single Sign-On
    • Audit Trail
    • Integrating with External Services
    • Portal Setup
    • GxP
      • Controlled Tool Access (allowed executables)
  • Science Corner
    • Scientific Guides
      • Somatic Small Variant and CNV Discovery Workflow Walkthrough
      • SAIGE GWAS Walkthrough
      • LocusZoom DNAnexus App
      • Human Reference Genomes
    • Using Hail to Analyze Genomic Data
    • Open-Source Tools by DNAnexus Scientists
    • Using IGV Locally with DNAnexus
  • Downloads
  • FAQs
    • EOL Documentation
      • Python 3 Support and Python 2 End of Life (EOL)
    • Automating Analysis Workflow
    • Backups of Customer Data
    • Developing Apps and Applets
    • Importing Data
    • Platform Uptime
    • Legal and Compliance
    • Sharing and Collaboration
    • Product Version Numbering
  • Release Notes
  • Technical Support
  • Legal
Powered by GitBook

Copyright 2025 DNAnexus

On this page
  • Step 1: Merge the Assay Genotypes Across All Autosomes Into PLINK Format
  • Step 2: Generate GRM Model and Variance Ratio Files
  • Step 3: Perform Single Variant Association Tests on UKB Imputed Data
  • Step 3 Alternative: Perform Single Variant Association Tests on UKB GATK Whole Genome pVCFs
  • Step 4: Optionally Concatenate the Results From Multiple saige_gwas_svat Analysis Together
  • Learn More

Was this helpful?

Export as PDF
  1. Science Corner
  2. Scientific Guides

SAIGE GWAS Walkthrough

Last updated 1 year ago

Was this helpful?

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. []

SAIGE authors provide a tutorial at 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_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

The Swiss Army Knife (SAK) application ( on the DNAnexus platform or 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.

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: 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 documentation page to get information about instances.

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. 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.

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.

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

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

Learn More

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

Batch executions can also be launched from the CLI using instructions at .

Ref
https://github.com/weizhouUMICH/SAIGE/wiki/Genetic-association-tests-using-SAIGE#running-saige-and-saige-gene
https://platform.dnanexus.com/app/swiss-army-knife
https://ukbiobank.dnanexus.com/app/swiss-army-knife
https://www.cog-genomics.org/plink/1.9/data#merge_list
Instance-Types
Batch Run
https://documentation.dnanexus.com/user/running-apps-and-workflows/running-batch-jobs
SAIGE documentation