This repository provides a streamlined pipeline for performing Local Ancestry Inference (LAI) using gnomAD samples. Due to the large scale of gnomAD, we implemented this pipeline using the Hail Batch Python module which is still in beta testing and exclusive to the Broad however the tools used within the pipeline are all publicly available.
The pipeline leverages Eagle for phasing, RFMix v2 for ancestry painting, Tractor for extracting ancestry-specific allele frequencies, and generate_output_vcf.py for generating a joint VCF with ancestry-specific allele count (AC), allele number (AN), and allele frequency (AF) annotations. Below, we outline the steps to run this pipeline on your dataset using Hail/Python scripts.
To run the LAI pipeline, set up your environment and install the required dependencies. Follow the step-by-step instructions below.
This pipeline processes genomic data by:
- Phasing haplotypes using Eagle
- Inferring local ancestry using RFMix v2
- Extracting ancestry-specific allele frequencies from phased and painted data using Tractor
- Generating a joint VCF with ancestry-specific calls using generate_output_vcf.py
git clone https://github.com/broadinstitute/gnomad_local_ancestry.gitThe pipeline requires Python 3, Hail, and several additional tools. Install the necessary dependencies using:
pip install hail
pip install numpy pandasMake sure you have Eagle and RFMix v2 installed. You can find installation instructions and a toy dataset in the Tractor Tutorial.
To phase your genotype data using Eagle, run:
eagle --vcf input_data.vcf.gz --out phased_data.vcf.gzRefer to the Tractor wiki for a detailed guide on phasing.
After phasing, run RFMix v2 to infer local ancestry:
rfmix \
-f phased_data.vcf.gz \
-r reference_panel.vcf.gz \
-m samplemap.txt \
-g geneticmap.txt \
-o painted_lai \
--chromosome=22See the Tractor wiki for additional instructions on reference panels and sample maps.
Once local ancestry inference is complete, extract ancestry-specific allele frequencies using Tractor:
python3 extract_tracts.py \
--vcf phased_data.vcf.gz \
--msp painted_lai.msp.tsv \
--num-ancs 2The generate_lai_vcf function calls generate_output_vcf.py, a standalone Python/Hail script. This script outputs an annotated VCF containing ancestry-specific allele frequency data:
python3 generate_output_vcf.py \
--msp-file painted_lai.msp.tsv \
--tractor-output tractor_output_path \
--output-path output_lai \
--is-zipped \
--mt-path-for-adj pipeline_input.mt \
--add-gnomad-afFor detailed explanations of phasing, local ancestry painting, and extracting tracts, refer to:
For our Hail Batch Python pipeline, refer to:
If you use this pipeline in your research, please cite:
Please direct questions to pragati.kore@bcm.edu or mwilson@broadinstitute.org.