Skip to content
R package -- HLA Genotype Imputation with Attribute Bagging (development, unstable version)
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
R fix #7 (new 'mono.rm' in hlaAttrBagging()) Apr 11, 2019
inst fix #7 (new 'mono.rm' in hlaAttrBagging()) Apr 11, 2019
tests update version Apr 2, 2019
vignettes update citation Aug 6, 2018
.gitattributes R+AppVeyor Feb 26, 2015
.travis.yml update .travis.yml May 2, 2018
NAMESPACE new function hlaDistance() May 3, 2018
NEWS update version Apr 2, 2019
appveyor.yml update appveyor.yml Apr 11, 2019

HLA Genotype Imputation with Attribute Bagging

Kernel Version: v1.4

GPLv3 GNU General Public License, GPLv3

Availability Years-in-BioC Build Status Build status


HIBAG is a state of the art software package for imputing HLA types using SNP data, and it relies on a training set of HLA and SNP genotypes. HIBAG can be used by researchers with published parameter estimates instead of requiring access to large training sample datasets. It combines the concepts of attribute bagging, an ensemble classifier method, with haplotype inference for SNPs and HLA types. Attribute bagging is a technique which improves the accuracy and stability of classifier ensembles using bootstrap aggregating and random variable selection.

Bioconductor Package

Release Version: 1.16.0

Changes in Bioconductor Version (since v1.14.0):

  • Kernel Version: v1.4
  • modify the kernel to support the GPU extension
  • develop a complementary R package (HIBAG.gpu) for GPU computing
  • The kernel v1.4 outputs exactly the same parameter estimates as v1.3, and the model training with v1.4 is 1.2 times faster than v1.3.

Changes in Bioconductor Version (since v1.3.0):

  • Kernel Version: v1.3
  • optimize the calculation of hamming distance using SSE2 and hardware POPCNT instructions if available
  • hardware POPCNT: 2.4x speedup for large-scale data, compared to the implementation in v1.2.4
  • SSE2 popcount implementation without hardware POPCNT: 1.5x speedup for large-scale data, compared to the implementation in v1.2.4

Package Author & Maintainer

Dr. Xiuwen Zheng (

Pre-fit Model Download

Platform-specific models:



Zheng, X. et al. HIBAG-HLA genotype imputation with attribute bagging. Pharmacogenomics Journal 14, 192-200 (2014).

Zheng, X. (2018) Imputation-Based HLA Typing with SNPs in GWAS Studies. In: Boegel S. (eds) HLA Typing. Methods in Molecular Biology, Vol 1802. Humana Press, New York, NY.


  • Bioconductor repository:
  • Development version from Github:

The install_github() approach requires that you build from source, i.e. make and compilers must be installed on your system -- see the R FAQ for your operating system; you may also need to install dependencies manually.

wget --no-check-certificate -O HIBAG_latest.tar.gz
## or ##
curl -L -o HIBAG_latest.tar.gz

## Install ##
R CMD INSTALL HIBAG_latest.tar.gz


CPU with Intel Intrinsics

  • Install the package from the source code with the support of hardware POPCNT (requiring SSE4.2): You have to customize the package compilation, see: CRAN: Customizing-package-compilation

Change ~/.R/Makevars to, if your machine supports SSE4.2 or higher, assuming GNU Compilers (gcc/g++) or Clang compiler (clang++) are installed:

## for C code
CFLAGS=-g -O3 -march=native -mtune=native
## for C++ code
CXXFLAGS=-g -O3 -march=native -mtune=native

Or force to create hardware POPCNT code:

## for C code
CFLAGS=-g -O3 -mpopcnt -msse4.2
## for C++ code
CXXFLAGS=-g -O3 -mpopcnt -msse4.2

If the package compilation succeeds with hardware POPCNT instructions, you should see a welcome message after loading the package:

HIBAG (HLA Genotype Imputation with Attribute Bagging)
Kernel Version: v1.4
Supported by Streaming SIMD Extensions (SSE2 + POPCNT)

GPU with OpenCL


Please use hlaAttrBagging_gpu() and hlaPredict_gpu() for model training and prediction.

Speedup ratios for training HIBAG models:

CPU (1 core) CPU (1 core, POPCNT) 1x NVIDIA Tesla K80 1x NVIDIA Tesla M60 1x NVIDIA GTX 1080Ti 1x NVIDIA Tesla P100 1x NVIDIA Tesla V100
1 1.63 x 46.5 x 57.5 x 93.7 x 209.1 x 246.3 x

using HIBAG v1.14.0 and HIBAG.gpu v0.9.1

CPU (1 core), the default installation from Bioconductor supporting SIMD SSE2 instructions, using Intel(R) Xeon(R) CPU E5-2630L @2.40GHz

CPU (1 core, POPCNT), optimization with Intel/AMD POPCNT instruction, using Intel(R) Xeon(R) CPU E5-2630L @2.40GHz

The benchmark was made possible, in part, through HPC time donated by Microway, Inc. We gratefully acknowledge Microway for providing access to their GPU-accelerated compute cluster (


You can’t perform that action at this time.