Skip to content

HLA genotyping

Hannes Pétur Eggertsson edited this page Mar 30, 2022 · 2 revisions

This page describes genotype HLA alleles using graphtyper. The data required is downloaded from the latest release which describes the variation in the HLA alleles. Only GRCh38 is supported.

## Get the HLA data directory
wget https://github.com/DecodeGenetics/graphtyper/releases/download/v2.7.4/HLA_data.tar.gz

## Extract the HLA data into a directory called "data"
mkdir -p data
tar -xzf HLA_data.tar.gz -C data 

## Set paths
GRAPHTYPER=/path/to/graphtyper
GENOME=/path/to/genome.fa
BAMLIST=/path/to/list/of/bams.txt
THREADS=<number of threads>

## Run HLA typing
while read chr begin end gene; do
  echo "${GRAPHTYPER} genotype_hla ${GENOME} data/${gene}.vcf.gz --region=${chr}:${begin}-${end} --sams=${BAMLIST} --verbose --threads=${THREADS}"
done < data/regions.tsv | bash

Instead of piping into bash, which will genotype serially, you can run the commands in parallel, ie. in GNU parallel or slurm.