NullHap – a versatile application to estimate haplotype frequencies from unphased genotypes in the presence of null alleles

Background Laboratory techniques used to determine haplotypes are often too expensive for large-scale studies and lack of phase information is commonly overcome using likelihood-based calculations. Whereas a number of programs are available for that purpose, none of them can handle loci with both multiple and null alleles. Results Here we present a description of a modified Expectation – Maximization algorithm as well as its implementation (NullHap) which allow to effectively overcome these limitations. As an example of application we used Nullhap to reanalyze published data on distribution of KIR genotypes in Polish psoriasis patients and controls showing that the KIR2DS4/1D locus may be a marker of KIR2DS1 haplotypes with different effects on disease susceptibility. Conclusion The developed application can estimate haplotype frequencies for every type of polymorphism and can effectively be used in genetic research as illustrated by a novel finding regarding the genetic susceptibility to psoriasis.


Background
Laboratory techniques used to determine haplotypes [1] are often too expensive for large-scale studies. The lack of phase information provided by the popular typing methods could be overcome using likelihood-based calculations [2], which estimate haplotype frequencies in a population, and reconstruct the haplotype pair in each individual. This approach is more cost-effective and powerful than linkage analysis [3], and gives more information than single marker-based methods [4].
Haplotype estimation procedures typically use maximum likelihood approach. The most popular algorithm implemented for example in Arlequin [5] is The Expectation -Maximization algorithm (EM) [6] but other methods were also proposed: Bayesian method using a pseudo-Gibbs sampler [7], partition-ligation [8], Monte Carlo [9] and Hidden Markov Model [10].
A frequent shortage of available software packages [5,7] is the lack of possibility to analyze loci where null variants occur with an appreciable frequency. In a diploid organism, a null allele is a variant which is not detected in genotyping, because of a deletion of an entire locus or because of a mutation interfering with analysis. This makes it impossible to distinguish between some heterozygous and homozygous genotypes [11]. For example, if there is only one alternative allele A 1 besides the null allele A 0 , then there are three possible haplotype pairs: A 1 / A 1 , A 1 /A 0 and A 0 /A 0 , but only two kinds of experimental observations: A 0 and A 1 . An example of a genetic system, which is at present intensely studied [11] and which contains null alleles, is the locus encoding killer immunoglobulin-like receptors (KIR) of natural killer (NK) cells.
To our knowledge, the only available computer program designed to handle null alleles is Haplo-IHP [12], which, however, has a shortcoming of being applicable only to biallelic loci. The purpose of our work was to design a versatile application for estimation of haplotypes from unphased population data useful for multiallelic polymorphism with and/or without null alleles.

Implementation
The null variants decrease the number of different genotypes G which can be observed, equation (1), when the k polymorphic loci are analyzed and each locus has l i different variants (optionally including a null variant) for i-th locus, δ i = 1 if i-th locus has null allele, otherwise δ i = 0.
The number of haplotypes is .
The average number of haplotype resolutions which give genotype j (when phase information is lost) grows exponentially with the number of observed loci, thus full space search algorithm cannot be used to find the best haplotype frequencies. The equation (2) provides the number of haplotype resolutions r j which give genotype j, where s j is the number of observed heterozygous and t j is the number of observed (not null) alleles for loci with null allele(s).

Maximum likelihood approach to estimate haplotypes
In the maximum likelihood approach haplotype frequencies h i are estimated to maximize the probability of the given sample of genotyping data. The sample of genotyping data from n individuals is simplified to a vector S = (n 1 , n 2 ,..., n G ), where G is the number of different genotyping data (with a lack of phase information, equation (1)), and n j is the number of individuals having j-th genotype, .
The conditional probability of sample S, given each genotype probability g i , and assuming unrelatedness of individuals in the sample is provided in equation (3), where α does not depend on g j .
The frequency of genotype g j is the sum of frequencies of respective haplotype pairs z mn , and with Hardy-Weinberg equilibrium (HWE) assumption, it is calculated from haplotype frequencies as shown in equation (4), where z mn is the frequency of haplotype pair m and n, r j is the number of haplotype pairs for the j-th genotype (equation 2), and h m , h n are the frequencies of haplotypes m and n respectively.
The estimation of haplotype frequencies to maximize the probability of the observed sample can be described as optimization, the equation (5) summarizes the considered approach.

Extended EM algorithm
The EM alternates between performing an expectation step E (t) , which computes an expectation value of unknown parameters, here the frequencies of haplotype pairs, and a maximization step M (t) , which computes the value of parameters by maximizing the probability of observed data. The parameters found on the M (t) step are then used to begin another E (t+1) step, and the process is repeated until the parameters are changed.
The description of algorithm details for the observed genotype data of k linked loci, l i variants for i-th locus, and the sample S = (n 1 , n 2 ,..., n G ) is given below.

Initiation
The EM algorithm could be trapped into a local maximum, therefore multiple random starts are employed (any number determined by the user) in order to help the algorithm reach the global maximum. If n > 1 starting points are specified, for i-th point, the program calculates the mean error between the first and i-th estimate, and if this exceeds a predefined value (default = 0.05) a message is displayed about possible multiple local maxima. Since this feature increases computational time, it is optional.
If no random starts are used, the initial haplotype pair frequencies are set as described in equation (6) (the E 0 step). For each haplotype resolution, the initial frequency depends only on the number of haplotype pairs for the given genotype. A similar initiation is described in [6].

Maximization step
In this step, the typical EM algorithm was adopted, the only modification consisting of the fact that the genotype frequency calculation was performed as a sum of corresponding haplotype pair frequencies, equation (4), taking into account that the heterozygotes with null allele are genotyped identically as homozygotes without null allele.
Next, the haplotype pair frequencies are corrected, to maximize the probability of a given sample. Details are given in equation (7), where is the input haplotype pair frequency, is the calculated genotype frequency (inclusive of appropriate heterozygous genotypes with null variants), is the output haplotype pair frequency, corrected to maximize the observed sample, n j is the number of observed genotypes g j in sample and n is the number individuals in the sample.

Expectation step
Haplotype frequencies h m s are calculated from the given haplotype pair frequencies z mn s, as a half of the sum of frequencies of all pairs of haplotypes in which given haplotype occurs. The next expected haplotype pair frequencies are calculated using haplotype frequencies as described in equation (8).

Stop conditions
The algorithm stops, when the stability of estimations between the following steps is obtained, i.e. the absolute difference between the calculated frequencies is less then ε (equation 9). The default threshold value for epsilon is 10 -5 , and can be changed by a program option.
The final step is calculation of the haplotype frequencies (another E step), and of the conditional probability of the haplotype pair, given genotype estimation (equation 10).

Results and Discussion
The described algorithm was implemented using C++ and the Boost libraries [13] and called NullHap. The main advantage of our application is the ability to handle problems, when one or more multiallelic loci containing null variant occur.
NullHap was tested on simulated and real data sets and its performance was compared with those of previously described programs: Arlequin [5], PHASE [7] and Haplo-IHP [12].

Test on generated data sets
Firstly, the simulated data sets were obtained as the most probable samples generated for polymorphisms with varying locus characteristics, and accuracy of estimated frequencies for different computer programs was analyzed. An example of assumed and estimated frequencies used in one such simulation is shown in Table 1. In Table 2, results of six simulations are summarized by giving a mean absolute percentage error, calculated as shown in equation (11), where x is the assumed frequency, and x* is the calculated one.
Since it may not be known beforehand, whether a locus has a null allele, we also checked performance of NullHap which was run assuming the presence of a null allele in each locus. Such an approach allows to screen the likelihood of the presence of a null allele in a given locus by evaluating the frequencies of haplotypes containing this allele. An appreciable frequency of any such haplotype in the output indicates the need to include a null allele in this particular locus. Otherwise, the conclusion is, that given locus most likely does not contain a null variant. Alternatively, genotypes of each locus could be analyzed for deviation from HWE by any of the available programs.
where the gives the genotype (6)  Table 2 are illustrated in Figure 1. As can be seen, with a sample size of 200 individuals, an error of approximately 2% can be expected in haplotype frequency estimation, whereas a lower sample size may lead to substantially higher errors.
Thirdly, tests of the effect of different levels of HWE violation on the accuracy of the algorithm were performed. The degree of HWE violation was modeled by increasing values of inbreeding coefficient f as defined by Weir [14,15], equation (12).
As can be seen from Figure 2, there was a linear correlation of inbreeding coefficient f with the accuracy of estimation of haplotype frequencies.
Finally, to evaluate the effect of haplotype frequency on the error of the estimation, 10 samples of 1000 individuals were generated from a population in HWE, for a simple two loci polymorphism: A with variants A 0 , A 1 , A 2 and B with variants B 0 , B 1 . The frequencies of haplotypes A 0 B 1 ,  (11)) are shown in Figure 3. As can be seen, the lowest error occured with haplotype frequency close to 0.5.

Performance tests
We also performed analysis of computational time in different scenarios. Results presented for appropriate applications are shown in Table 3. All computations were achieved on Celeron M 1.  The assumed and estimated haplotype frequencies for a polymorphism with 3 loci: A(multiallelic with null variant), B(multiallelic), C(biallelic with null variant). Because the number of haplotypes grows exponentially with the number of considered loci, there is a practical restriction to approximately 50,000 haplotypes, e.g. 15 biallelic loci. We noted with moderate number of loci the restriction is due to computational time, whereas for the very large number of loci (e.g. 100 loci) the memory becomes a limiting factor.

Tests on real data sets
To perform a test on real data, we first used HLA-DRB1 and HLA-DQB1 allele distributions among 99 Poles as supplied by [5]. Both loci are multiallelic (36 and 14 variants, respectively) without null variants. The difference between estimated frequencies among programs Arlequin, PHASE and NullHap (i.e. programs handling such loci) was less than 2%.
To test the application in the presence of biallelic loci with null variants, the KIR genotypes for 200 Irish subjects [12] were analyzed with NullHap and Haplo-IHP (the only available program suitable for such loci). The difference of estimated frequencies between programs was about 3%.

Reanalysis of published data indicates that the KIR2DS4/ 1D locus may be a marker of KIR2DS1 haplotypes with different effects on psoriasis susceptibility
In order to apply NullHap to real data from an association study we reanalyzed the results of Luszczek et al. on distribution of KIR genotypes in Polish psoriasis patients and controls [16]. In the original report these authors described an association between KIR2DS1 and psoriasis, which was also observed in two subsequent studies from Japan and the US [17,18], but not in a study a of Chinese population [19]. Further analysis of genotype data of Luszczek et al. [16] indicated a role for KIR gene variants other than KIR2DS1 in conferring susceptibility to psoriasis, suggesting, that distinct KIR haplotypes could be responsible for observed associations [20].
The distributions of KIR haplotypes among patients and controls obtained with NullHap are given in Table 4. Because the structure of the KIR region is very complex, it is not fully known which genes are truly allelic, i.e. occupy precisely the same chromosomal locus. At first, in our analysis, the K2DL2/KIR2DL3, KIRDS4/KIR1D, and KIR2DS3/KIR2DS5 genes were treated as alleles. Since in the case of KIR2DS3 and KIR2DS5 this may be controversial due to some haplotypes which harbor both genes in cis [21], we also repeated the analysis after exclusion of these variants. In all loci a null allele was allowed [21].
As can be seen from Table 4, two haplotypes (#1, #2) were strongly overrepresented among the patients. The fact that these haplotypes encoded KIR2DS1 is consistent with the association between this gene and psoriasis [16][17][18] whereas the lower OR associated with haplotype #2 vs. #1 (27 vs. 52.5) supports the protective effect of KIR2DS3 suggested previously [20]. In contrast to haplotypes #1 and #2 other haplotypes encoding KIR2DS1 (#4, #6) were Effect of sample size on accuracy of estimation Figure 1 Effect of sample size on accuracy of estimation. Effect of sample size on accuracy of estimation of haplotype frequencies. Ten samples of 25, 50, 100, 200, 500, 1000 individuals were generated from population in HWE. The error in function of sample size is shown. The haplotype distribution is given in example 5 (red) and example 6 (blue) in Table 2, respectively.
Effect of HWE violation on accuracy of estimation  Table 2 (example 5 -red line, example 6 -blue line).
not overrepresented among the patients. Both haplotypes encoded KIR2DS5 which could be interpreted as the postulated protective effect of this variant [20]. However, whereas the presence of KIR2DS5 or KIR2D3 offers one explanation of the heterogeneity of the effects of KIR2DS1 haplotypes, the inspection of Table 4 shows that the riskconferring and neutral KIR2DS1 haplotypes are also distinguished by the KIR2DS4/1D locus, which is a novel observation. As can be seen, the haplotypes #1, #2 share the 1D variant, whereas the haplotypes #4, #6 both have the KIR2DS4 null allele. These effects of KIR2DS4/1D locus were also apparent in analysis performed after the exclusion of KIR2DS3 and KIR2DS5 genes (haplotypes #8 and #9 vs. haplotypes #12 and #17, Table 4).
The fact that KIR2DS4/1D and KIR2DS1 loci are physically adjacent [21] suggests that the strong predictive effect of their haplotypic combinations may be caused by linkage disequilibrium with an unknown variant in the region, which is primarily associated with psoriasis. The indirect association is particularly plausible for KIR2DS4/1D because KIR 1D and KIRDS4 null (which mark KIR2DS1 haplotypes with distinct effects on disease susceptibility) are both non functional and thus should be equivalent physiologically [21]. In case of the KIR2DS1 it would be tempting to speculate that the susceptibility conferring effect is limited to a rare allele (absent in controls) being in strong linkage disequilibrium with 1D. Interestingly, such a theory could explain a lack of association between KIRDS1 and psoriasis recently reported in a Chinese population [19].

Conclusion
The developed application can effectively estimate haplotype frequencies with a performance that is similar or better than those of other available computer programs. It should be emphasized, that the main advantage of the created application is the ability to estimate haplotypes for every type of polymorphism, in particular polymorphisms with multiallelic loci with null variants.
The presented application is under development, and some improvements are planned, such as an additional step removing unimportant haplotypes or the partitionligation algorithm [8] to speed-up computations for a large number of loci. Other planned improvements are a Effect of haplotype frequency on the error of the estimation Figure 3 Effect of haplotype frequency on the error of the estimation. Effect of haplotype frequency on the error of the estimation. Ten samples of 1000 individuals were generated for population in HWE, for a 2 locus polymorphism: A with variants A 0 , A 1 , A 2 and B with variants B 0 , B 1 . The graph shows the error of haplotype frequency estimation in function of assumed frequency of this haplotype. graphical user interface as well as an import/export module for popular data formats. The new versions will be available at project homepage.  The distribution of KIR haplotypes among psoriasis patients and controls obtained with NullHap based on genotypes reported by Luszczek et al. [16]. Only haplotypes with frequency > 5% in either group are shown. Odds ratio (OR) calculated according to Haldane [22], P value calculated by Fisher exact test. NS -not significant.