CookHLA is an accurate and efficient HLA imputation method.
Human leukocyte antigen (HLA)
genes in the major histocompatibility complex (MHC) region influence many immune-related disease phenotypes. Discovering which HLA alleles or amino acids drive phenotypes often requires fine-mapping analysis in tens of thousands of samples, of which HLA typing can be prohibitively costly. Fortunately, the recent development of imputation methods enabled the prediction of HLA alleles using intergenic SNP data, allowing many studies to fine-map HLA for immune phenotypes. Nonetheless, existing imputation methods still have limitations in accuracy.
CookHLA substantially improved imputation accuracy over previous methods, including the predecessor SNP2HLA by implementing several changes. First, to increase accuracy and efficiency, we employed the recently released hidden Markov model (Beagle v4 and v5). Second, to further improve accuracy, we developed a procedure that can account for local variability in the exons of HLA genes. Highly polymorphic exons (exon 2/3/4 in Class I and 2/3 in Class II) are critical regions whose sequences can determine most of the 4-digit alleles. In our method, we repeat imputation by putting the marker set locally in each of the highly polymorphic exons, and use consensus posterior probabilities from the repeated analyses for final predictions(Figure B). Third, to increase accuracy even further, we adaptively learn the genetic map of MHC from the data. This map information allows us to account for the data-specific LD structure within MHC, which improves the imputation accuracy compared to the use of publicly available genetic maps(Figure C).
Prepare Linux or OS X(Mac) operating system. CookHLA currently doesn't support Windows.
CookHLA was tested in the following operating systems. Linux : Ubuntu 19.04(Disco Dingo), Ubuntu 18.04.3 LTS(Bionic Beaver), CentOS_7, Linux Mint 19.2 Cinnamon(Tina). / OS X : Catalina, Mojave
In case of using Catalina OS X, Using default shell as 'Bash($)' not 'Zsh(%)' is recommended. To change the default shell to Bash, Please refer this blog(https://www.howtogeek.com/444596/how-to-change-the-default-shell-to-bash-in-macos-catalina/).
Then, download this project in a directory of your system. Assuming that 'git' command is already installed,
$ git clone https://github.com/WansonChoi/CookHLA.git
$ cd CookHLA
Next, external software must be prepared in 'dependency/' folder. Users have to download the following themselves because of the copyright issue.
Then, change the file mode of PLINK and mach1.
$ chmod +x dependency/plink dependency/mach1
(Heads-up) After downloading Beagle4('beagle.27Jan18.7e1.jar') and Beagle5('beagle.18May20.d20.jar') in the 'dependency/' folder, don't forget to rename them as 'beagle4.jar' and 'beagle5.jar'.
The following requirements must be installed in your system.
There are two ways to install these required software packages.
First, you can manually install missing packages yourself.
Second, if Python 'Anaconda(https://www.anaconda.com/)' is installed in your system, you can create an Anaconda virtual environment, which will automatically install the required packages. Specifically, you can create a new virtual environment for CookHLA with the provided YML file.
There are two YML files ('CookHLA_LINUX.yml' and 'CookHLA_OSX.yml'). Choose an appropriate one depending on your operating system.
$ conda env create -f CookHLA_[YOUR_OS].yml
The above command will generate a new Python virtual environment named 'CookHLA', which will contain required Python packages, R and R libraries, independent from your original Python system. For more detailed explanation about Anaconda's Python virtual environment managing, please check (https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html#create-env-file-manually).
If the new virtual environment has been successfully created, then activate it.
$ conda activate CookHLA
CookHLA can be run in this virtual environment.
Type 'conda deactivate' on your command line if you want to go back to your original Python system setting. (https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environ ments.html#deactivating-an-environment)
(Tip) Type 'conda env remove -n CookHLA' in your command line if you want to remove this newly created virtual environment for CookHLA forever. (https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html#removing-an-environment)
Target Genotype file
CookHLA takes unphased SNP file as input. The input file must be in PLINK binary file format (PREFIX.bed, PREFIX.bim, PREFIX.fam). You only need to specify the PREFIX in the input argument (without file extensions).
CookHLA uses only SNPs in chr6:29-34Mb. Thus, you can portably prepare only those SNPs in that region as input file.
CookHLA generates and uses a new copy of the input target data where markers are subsetted to those of the reference panel based on the base position information. Also, Since most SNP2HLA-formatted reference panels are distributed in hg18, the Human Genome version of the copied target data will be lifted-down to hg18 automatically if its version is not hg18.
As of version 1.0.1 (2022.06.), CookHLA removes ambiguous SNPs (i.e. {A, T} or {G, C}) by default in the input subsetted above. Previously, CookHLA tried to save the ambiguous SNPs by default based on the allele frequency information between target and reference panel. Now, If a user wants to save the ambiguous SNPs, add '--save-Ambiguous-SNP' flag.
Reference panel
CookHLA requires a phased reference panel. CookHLA uses the same reference panel format as SNP2HLA. For many existing SNP2HLA-formatted panels for various populations, see section (6) below.
Or, if you want to build a reference panel yourself, you can use the MakeReference software that comes with SNP2HLA. The official webpage of SNP2HLA is "http://software.broadinstitute.org/mpg/snp2hla/" and the manual of MakeReference can be found at "http://software.broadinstitute.org/mpg/snp2hla/makereference_manual.html".
Since most SNP2HLA-formatted reference panels are distributed in hg18, the human genome version of a reference panel will be assuemed to be hg18.
Adaptive Genetic Map
To increase accuracy, CookHLA adaptively learns genetic map from data. To generate an Adaptive genetic map, you have to use 'MakeGeneticMap' module in the CookHLA project folder.
$ python -m MakeGeneticMap \
-i example/1958BC.hg19 \
-hg 19 \
-ref 1000G_REF/1000G_REF.EUR.chr6.hg18.29mb-34mb.inT1DGC \
-o MyAGM/1958BC+1000G_REF.EUR
This will generate (1) '*.aver.erate' and (2) '*.mach_step.avg.clpsB' files, which can be passed into '-ae' and '-gm' arguments of CookHLA respectively.
Once generated, you can reuse the generated AGM restricted to the imputation of the target and reference panel that were used to generate the AGM.
The 'MakeGeneticMap' module requires at least 100 samples from the target and reference panel for each(total 200 samples). If the target data has less than 100 samples, then 200 samples from the reference panel will be used alternatively. If both the target and reference panel have less than 100 samples, then the module will fail.
Usage example:
$ python CookHLA.py \
-i example/1958BC.hg19 \
-hg 19 \
-o MyHLAImputation/1958BC+HM_CEU_REF \
-ref example/HM_CEU_REF \
-gm example/AGM.1958BC+HM_CEU_REF.mach_step.avg.clpsB \
-ae example/AGM.1958BC+HM_CEU_REF.aver.erate \
-mem 2g \
# -mp 2 # The number of available cores for Multiprocessing.
# -bgl4 # If you want to use Beagle4 instead of Beagle5.
If you skip both '-gm' and '-ae' arguments, the above 'MakeGeneticMap' module will be implemented automatically prior to the imputation to generate a new AGM.
In the output, '*.alleles' file contains the imputed HLA types of the target genotype. '*.hped' file is a PLINK PED-like format of HLA allele information. Each column in the '*.alleles' file represents
The last confidence score is defined as the posterior probability of the allele for a homozygous call and the sum of the posterior probabilities of the two alleles for a heterozygous call. (Please refer to the "Call rate and accuracy" section in p6 of the CookHLA paper.)
Unlike SNP2HLA, CookHLA does not directly give binary markers of the amino acid residues at every position. However, you can simply feed hped file to HATK(https://github.com/WansonChoi/HATK) and generate the binary markers of amino acids. HATK also provides simple association test and visualization procedure.
Citation: Choi W, Luo Y, Raychaudhuri S, Han B. HATK: HLA Analysis Toolkit [published online ahead of print, 2020 Jul 31]. Bioinformatics. 2020;btaa684. doi:10.1093/bioinformatics/btaa684
Below are publicly available SNP2HLA-formatted reference panels, which can be used for CookHLA.
T1DGC panel (European, N=5,225) – available for research purposes upon request
HAN Chinese panel (East Asian, N=10,689)
Pan-Asian panel (East and South Asian, N=530)
Korean panel (East Asian, N=413)
1000 Genomes data : see below.
Here we provide the 1000 Genomes data reference panels of five super populations: AFR, AMR, EAS, EUR, and SAS (https://www.internationalgenome.org/category/population/).
To make these panels, we obtained both the SNP and HLA data from 1000 Genomes website. The website denotes that the HLA was inferred from the NGS data using PolyPheMe software, as described in (Citation: Abi-Rached L, Gouret P, Yeh JH, et al. Immune diversity sheds light on missing variation in worldwide genetic diversity panels. PLoS One. 2018;13(10):e0206512. Published 2018 Oct 26. doi:10.1371/journal.pone.0206512). We then built SNP2HLA-formatted panels. We restricted the SNPs to Immunochip SNPs to reduce computational burden of HLA imputation. These panels are in '1000G_REF/' folder.
S. Cook, W. Choi, H. Lim, Y. Luo, K. Kim, X. Jia, S. Raychaudhuri and B. Han, CookHLA: Accurate Imputation of Human Leukocyte Antigens. (https://www.nature.com/articles/s41467-021-21541-5)
The CookHLA Software is freely available for non-commercial academic research use. For other usage, one must contact Buhm Han (BH) at buhm.han@snu.ac.kr (patent pending). WE (Seungho Cook, Wanson Choi, Hyunjoon Lim and BH) MAKE NO REPRESENTATIONS OR WARRANTIES WHATSOEVER, EITHER EXPRESS OR IMPLIED, WITH RESPECT TO THE CODE PROVIDED HERE UNDER. IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE WITH RESPECT TO CODE ARE EXPRESSLY DISCLAIMED. THE CODE IS FURNISHED "AS IS" AND "WITH ALL FAULTS" AND DOWNLOADING OR USING THE CODE IS UNDERTAKEN AT YOUR OWN RISK. TO THE FULLEST EXTENT ALLOWED BY APPLICABLE LAW, IN NO EVENT SHALL WE BE LIABLE, WHETHER IN CONTRACT, TORT, WARRANTY, OR UNDER ANY STATUTE OR ON ANY OTHER BASIS FOR SPECIAL, INCIDENTAL, INDIRECT, PUNITIVE, MULTIPLE OR CONSEQUENTIAL DAMAGES SUSTAINED BY YOU OR ANY OTHER PERSON OR ENTITY ON ACCOUNT OF USE OR POSSESSION OF THE CODE, WHETHER OR NOT FORESEEABLE AND WHETHER OR NOT WE HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES, INCLUDING WITHOUT LIMITATION DAMAGES ARISING FROM OR RELATED TO LOSS OF USE, LOSS OF DATA, DOWNTIME, OR FOR LOSS OF REVENUE, PROFITS, GOODWILL, BUSINESS OR OTHER FINANCIAL LOSS.