Skip to main content
NIHPA Author Manuscripts logoLink to NIHPA Author Manuscripts
. Author manuscript; available in PMC: 2026 May 16.
Published in final edited form as: IEEE Int Conf Comput Adv Bio Med Sci. 2025 Nov 1;15599:130–143. doi: 10.1007/978-3-032-02489-3_10

Haplotype-based Parallel PBWT for Biobank Scale Data

Kecong Tang 1, Ahsan Sanaullah 1, Degui Zhi 2, Shaojie Zhang 1
PMCID: PMC13178698  NIHMSID: NIHMS2167341  PMID: 42147361

Abstract

Durbin’s positional Burrows-Wheeler transform (PBWT) enables algorithms with the optimal time complexity of O(MN) for reporting all vs all haplotype matches in a population panel with M haplotypes and N variant sites. However, even this efficiency may still be too slow when the number of haplotypes reaches millions. To further reduce the run time, in this paper, a parallel version of the PBWT algorithms is introduced for all versus all haplotype matching, which is called HP-PBWT (haplotype-based parallel PBWT). HP-PBWT parallelly executes the PBWT by splitting a haplotype panel into blocks of haplotypes. HP-PBWT algorithms achieve parallelization for PBWT construction, reporting all versus all L-long matches, and reporting all versus all set-maximal matches while maintaining memory efficiency. HP-PBWT has an OMT+TN time complexity in PBWT construction, and OMT+T+c*N time complexity for reporting all versus all L-long matches and reporting all versus all set-maximal matches, where T is the number of threads and c* is the maximum number of matches (of length L or maximum divergence value for L-long matches and set-maximal matches respectively) per haplotype per site. HP-PBWT achieves 4-fold speed-up in UK Biobank genotyping array data with 30 threads in the IO-included benchmarks. When applying HP-PBWT to a dataset of 8 million randomized haplotypes (random binary strings of equal length) in the IO-excluded benchmarks, it can achieve a 22-fold speed-up with 60 cores on the Amazon EC2 server. With further hardware optimization, HP-PBWT is expected to handle billions of haplotypes efficiently.

Keywords: PBWT, Parallel Computing, Haplotype Matching

1. Introduction

The positional Burrows–Wheeler transform (PBWT) [6] is an efficient data structure for finding haplotype matches and data compression. The construction of the PBWT can be done in linear time with respect to the number of haplotypes times the number of sites. The original PBWT paper also introduced efficient algorithms for reporting all versus all haplotype matches in a genetic panel. These algorithms have been widely applied in Identity-By-Descent (IBD) segment detection [8, 11, 20], genotype imputation [5, 13], and haplotype phasing [4, 9]. However, once the haplotype dimension of biobank panels exceeds many millions, even the PBWT may not be fast enough to satisfy the need of speed. The rapidly growing total number of genotyped individuals could reach billions in the future. This means an efficient parallel version of PBWT suitable for processing large-scale data input is in high demand.

Wertenbroek et al. [19] presented a parallelized PBWT by dividing the panel into sub-panels with ranges of sites, then applied a merging algorithm to generate the final output. Their algorithm has an OMNT+TMlogM time complexity, where M is the number of haplotypes, N is the number of sites, and T is the number of threads. However, their algorithm needs to load the whole haplotype panel into memory or read the haplotype panel multiple times to perform the dividing and merging steps. Therefore, this approach is best applicable to panels with sequencing data of a relatively small sample size [1, 18].

On the other hand, the haplotype dimension of the panel is the more promising dimension to parallelize. Currently, genotyping array density datasets with millions of haplotypes [10, 16, 17] are widely used in both research and commercial applications. When compared to sequencing datasets, genotyping array density datasets have sparser sites, while typically having many more haplotypes, sometimes millions. Moreover, in the not-too-distant future, the number of genotyped samples could reach billions. Durbin’s algorithms, even though enjoying a linear complexity to the number of haplotypes, need parallelization to scale up further.

In this paper, a haplotype-based parallel PBWT, HP-PBWT, is proposed, which is suitable for processing billions of haplotypes. The HP-PBWT is designed to break dependencies in the prefix array computation and divergence array computation in Durbin’s original PBWT. Furthermore, two additional efficient algorithms are designed to report all versus all L-long matches and all versus all set-maximal matches using the parallelized PBWT. HP-PBWT is memory efficient, it maintains the efficient sweeping behavior in Durbin’s original PBWT and only needs an O(M) memory space. HP-PBWT has OMT+TN run time for constructing the PBWT, and OMT+T+c*N run time for reporting all versus all L-long matches and reporting all versus all set-maximal matches, where T is the number of threads, and c* is the maximum number of matches per haplotype per site and in practice c*≪M.

2. Background

The description in this work follows Durbin’s original work [6]. The initial input of Durbin’s PBWT is X, an M by N two dimensional binary array, which has M binary strings, xi, that each represents a haplotype, and each haplotype has N sites. The fundamental outputs are a prefix array Pk and a divergence array Dk during the sorting process for each site 0≤k<N.

The prefix array Pk stores haplotype IDs according to the colexicographic order of the haplotype prefixes of length k+1.Pk stores a permutation of [0,M-1] such that revxPk[i][0,k] is lexicographically smaller than revxPk[i+1][0,k] for all i, where rev(a) is the reverse of a string a. The term Yk in Durbin’s PBWT refers to a permutation of all sites in X at k-th location Xk, which is sorted based on the haplotype IDs in Pk-1 such that Yk[i]=XkPk-1[i]=xPk-1[i][k].

The divergence array Dk indicates the length of the match at k between two adjacent haplotypes in the sorted order of Pk. Therefore, if Pk[a]=i,Pk[a-1]=i′, and Dk[i]=j, then, xi[k-j+1,k]=xi′[k-j+1,k] and xi[k-j]≠xi′[k-j]. Note that the definition of the divergence array here is slightly different from Durbin’s original definition. Durbin defined the divergence value as storing the starting position of the match and the values were permuted by the prefix array sorting.

A match between sequences xa and xb on [i,j] is locally maximal if xa[i,j]=xb[i,j] and it can’t be extended in either direction. I.E. if xa[i-1]≠xb[i-1], and xa[j+1]≠xb[j+1]. Given a length cut-off L, haplotypes xa and xb have an L-long match on [i,j], if [i,j] is a locally maximal match and j-i+1≥L. Durbin’s Algorithm 3 outputs all L-long matches between all pairs of haplotypes. In this paper, this is referred to as outputting all versus all L-long matches.

A set-maximal match is defined on a haplotype xa and a set of haplotypes, X. If xa has a set-maximal match to xb within X on [i,j], then there is no larger match that contains it. I.E. ∀xc∈X,xa[i-1,j]≠xc[i-1,j] and xa[i,j+1]≠xc[i,j+1]. Durbin’s Algorithm 4 outputs the set-maximal matches between xd and X∖xd for all xd∈X. In this paper, this is referred to as outputting all versus all set-maximal matches.

3. Methods

The focus of this work is to reduce the time complexity of the M dimension, the N dimension remains the same. First, a parallel prefix sum algorithm is used to compute prefix array in parallel. Second, Dk is computed by dividing Yk into T partition blocks with T threads independently in parallel. Third, an efficient fine-grained parallel algorithm is designed to report all versus all L-long matches. At the end of this section, all versus all set-maximal matches are also reported in parallel with a similar algorithm. These algorithms have OMT+T span per site for the PBWT construction and OMT+T+c* span per site for reporting all versus all L-long matches and reporting all versus all set-maximal matches, where T is the number of threads, and c* is the maximum number of matches per haplotype per site and in practice c*≪M.

3.1. Parallel Prefix Array Computation

Durbin’s Algorithm 1 computes Pk from Pk-1 and Yk, by placing i∈Pk-1 into a “zero” container if Yk[i]=0 or a “one” container if Yk[i]=1 sequentially. Then, Pk is constructed by concatenating the “zero” and “one” containers. Since the process is done sequentially, this dependency has to be removed in order to execute in parallel.

The Pk construction of Durbin’s PBWT Algorithm 1 is converted into a prefix sum problem. The first step is to run prefix sum on Yk to create a PSAk such that PSAk[i]=∑j=0iYk[j]. An important property of the PSAk is, the PSAk indicates the starting location of “1”s in Pk. The PSAk[M-1] is the number of “1”s in Yk, and the offset OS=M-PSAk[M-1] is the number of “0”s in Yk. The prefix array is defined as Pk=PZk+POk, where PZk is the “zero” container and POk is the “one” container. The PZk holds all haplotype indices i such that Yk[i]=0 by the order in Pk-1. Similarly, the POk holds the haplotype indices i such that Yk[i]=1. A mapping example is introduced from Pk-1 to Pk according to PSAk in Figure 1. The POk part of Pk can be populated by PkOS+PSAk[i]-1=Pk-1[i]. Since PSAk only increases by one when Yk[i]=1, the value at PSAk[i] for haplotype Pk-1[i] is the exact one-based index of Pk-1[i] in POk. The PZK is the first part of Pk, the new location of a haplotype Pk[i] is the old index i minus the number “1”s appeared before Yk[i] which is PSAk[i]. Then PZk part of the Pk can be computed by Pki-PSAk[i]=Pk-1[i]. There is no dependency after creating the PSAk, so Pk can be populated in parallel.

Fig. 1.

Fig. 1.

Computation of new prefix array Pk from old prefix array Pk-1 in parallel with the help of prefix sum array PSAk. The offset is calculated by OS=M-PSAk[M-1] which is the number of zeros in Yk.

Therefore, the computation of the PBWT prefix array has been converted to a prefix sum problem. The prefix sums of Yk are computed in parallel. First, the input is divided into T partition blocks. Then, local prefix sums within the partition blocks are calculated using one thread per partition block in parallel. Now each partition block b has its locally correct prefix sum values. To acquire the final globally correct prefix sum values, each value in partition block b has to be added a proper offset, which is the last prefix sum value of partition block b-1. These offsets need to be computed and added from each partition block sequentially. At the end, the corresponding offset is added to each partition block in parallel. The offset calculation is the only communication stage, and it has an O(T) time complexity. This version has O(M+T) work and OMT+T span per site. If T is large, then the parallel prefix sum in Section II.E of [2] (referred to as the halving merge algorithm) can be used to reduced the O(T) term to O(logT) for a total work of O(M) and span of OMT+logT per site. After computing PSAk, the haplotype IDs are mapped to the correct final prefix array location. Each haplotype takes O(1) time to map and all M haplotypes are processed in parallel. Therefore the parallelized prefix array computation algorithm as described has O(M) work and OMT+T span (OMT+logT span per site if the algorithm of [2] is used), where T is the number of threads, and T also equals to the number of partition blocks. The OMT+T span parallel prefix sum algorithm is used in this work.

3.2. Parallel Divergence Array Computation

In Durbin’s algorithm, Dk is computed by sweeping through Pk-1 keeping track of the minimum matching lengths of haplotypes that have “0” and “1” in Yk (p and q respectively in Durbin’s Algorithm 2) through M haplotypes during the process of creating Pk. The algorithm checks if a haplotype still matches to its previous upper neighbor haplotype in Pk-1 at Yk site.

On the contrary, once a site is divided into partition blocks, and each block is assigned with one thread, to calculate all the divergence values within a single partition block, the passing-down values (p and q in Durbin’s Algorithm 2) should not be acquired from the thread that assigned to the previous partition block. Otherwise, the whole process becomes sequential. Now the challenge becomes how to acquire the correct passing-down divergence values for each partition block in parallel.

Two necessary initial divergence values are calculated for each partition block by searching the previous partition block(s). To further explain, the two divergence values are: the divergence value of the first haplotype in the partition block that has “0” value in the Yk, and the first haplotype in the partition block that has “1” value in the Yk. Call the n-th partition block i∈M(n-1)T,MnT, then, all the divergence values of the n-th partition block are DkPk[i]. These two divergence values can be computed by checking some upper b-th partition block(s) that b<n. The first divergence value is DkPk[j] such that j=Minj∈M(n-1)T,MnT and Yk[j]=0. The second divergence value is DkPk[j] such that j=Minj∈M(n-1)T,MnT and Yk[j]=1. For any of the two divergence values, DkPk[j] that Yk[j]=v and v=0 or 1,DkPk[j] is computed by: first, find the index si that Yk[si]=v,si<j, and ∀i∈(si,j) and Yk[si]≠v; then, DkPk[j]=MinDkPk[i] that i∈(si,j]. For each partition block, the parallel algorithm searches the two divergence values in the previous partition block(s). After computing these two divergence values, it can simply loop through the partition block with Durbin’s Algorithm 2 to compute the rest of the divergence values within this partition block in a single thread. The searching step is called upper search. This upper search may cross multiple partition blocks, and it does have a worst case O(M) time complexity, but this is unlikely to happen since the selected markers in the biobank data panels usually do not have nearly singleton minor allele frequency. Optimizations are applied to prevent the long upper search from happening. The first optimization is verifying if the haplotype j is the first “1” in Yk, by checking if PSAkPk[j]=1, if so, this divergence value is set to 0, and the upper search isn’t conducted.

Upper search examples are shown in Figure 2 which compute the two passing-down divergence values for Dkh9 in partition block 2 and Dkh12 in partition block 3. Computing Dkh9 is simply Dkh9=Dk-1h9+1, since the match between haplotype h9 and h8 continues. Haplotype h12 will be sorted after haplotype h1, so Dkh12 is minimum divergence value (Dkh3) between h12 and h2. It has to reach partition block 1 to find the first upper haplotype h1 that has the same value “1” to haplotype h12 at k-th site.

Fig. 2.

Fig. 2.

Cross block upper search during divergence value computation. Dkh9 (in A) needs a short upper search, and Dkh12 (in B) needs a long upper search that cross block. Additional optimization (in C) by skipping block(s) is designed for the long upper search.

An additional optimization is applied for the situation that there is small amount of “1” in Yk, so the upper search for the haplotype with “1” may end up O(M). Demonstrated in Figure 2(C), assuming there could be many partition blocks that full of “0”s between h12 and h1. For each partition block Bi=[s,e] with an individual thread Ti, the first step is to identify whether this partition block has “1” or not. Here, a zero-block is defined as if PSAk[s-1]=PSAk[e-1], that is to say there are no “1”s in this partition block. If the partition block Bi has “1”, the thread Ti will skip all the zero-block(s) above it and find the nearest upper partition block Bj=s′,e′ that has “1” by checking the upper partition blocks according to the PSAk. Then thread Ti runs from e′ to s′ to find the first p that Yk[p]=1, and compute the minimum divergence value minD0=Dk-1Pk[h] that ∀h∈p,e′. In the meantime, the minimum divergence values for each the skipped zero-blocks are still needed. The minimum divergence values for the zero-blocks are computed by the thread assigned to each partition block once a partition block is identified as zero-block. Ti waits to collect these minimum divergence values for the skipped zero-blocks if they are not yet calculated. Since it is unlikely that a site has a large run of “1”s in practice, in the implementation of HP-PBWT, this optimization is only applied on the “0”s.

The divergence value computation in HP-PBWT has O(M+Tr) work and OMT+r span per site, where r is the cost of the upper search and T is the number of threads. r is reduced to OMT+T work if the same optimization was applied for both “0”s and “1”s (note T≪M). Then the final work and span of divergence value computation is O(M+T) and OMT+T per site respectively.

3.3. Parallel Reporting of All versus All L-long matches

Given a set of Pk,Dk, and Yk+1, Durbin’s Algorithm 3 outputs all matches with length ≥L that end at k-th site. The algorithm has two basic steps. Step 1, acquire a precise matching block range [s,e] that ∀i∈[s,e]DkPk[s]≥L,DkPk[e]≥L,DkPk[s-1]<L, and DkPk[e+1]<L. That is to say all pairs of prefixes of haplotypes within the block have longest common suffixes of length at least length L. Step 2, output a match between every pair of haplotypes with differing values in Yk+1 within [s,e].

In parallel execution, the simplified parallel algorithm reports matches for each haplotype in an individual thread. For each haplotype Pk[h], it loops through the haplotypes Pk[i]∈(h,M) until DkPk[i]<L, in the meantime it outputs matches if Yk+1Pk[h]≠Yk+1Pk[i]. Figure 3 provides an example of thread i reports L-long matches for haplotype h4 independently. In detail, this algorithm does have OM22 work, since there may be OM2 matches at a site. If c* is used to represent the maximum number of haplotypes that match with haplotype i length L or more ending at the current site for all i, HP-PBWT has OMT+T+c* span per site for reporting all versus all L-long matches, where T is the number of threads (note that in practice c*≪M).

Fig. 3.

Fig. 3.

Reporting all versus all L-long matches where L=3 and sorted at k site in parallel. Thread i reports matches for haplotype h4, it loops to haplotype h6 since Dkh6<L, meanwhile it compares the values of h7,h1,h2 and h3 in Yk+1 to h4, then reports the match between h4 and h7, the match between h4 and h1, and the match between h4 and h3.

3.4. Parallel Reporting All versus All set-maximal matches

A set-maximal match is a collection of the longest matches ending at k site to a single haplotype. [s,e] is a range in Pk that contains all the longest matches with haplotype i ending at k. If a match in [s,e] can be extended further, then there are no set-maximal matches ending at k for haplotype i. For a haplotype Pk[i], the set-maximal matches at site k are reported by: First, compute DMax=MaxDkPk[i],DkPk[i+1], find range [s,e] such that ∀j∈[s,e],DkPk[j]=DMax,j≠i,DkPk[s]<DMax and DkPk[e+1]<DMax; Second, check if any j∈[s,e],Yk+1Pk[j]=Yk+1Pk[i], if so, haplotype Pk[i] does not have set-maximal matches at site k location, and stop; Third, if it passes the second step, output a set maximal match between haplotypes Pk[i] and Pk[j] for all j∈[s,e] with a match length of DMax.

The scan up and scan down to find range [s,e] are light tasks since the scan up only has to reach the location j′ that DkPkj′≠DMax, similarly for the scan down. At this point, it is not necessary to apply complicated parallel implementation to report all versus all set-maximal matches. Instead, the parallelization is simply done by paralleling the outer loop that loops through all the haplotypes. The total work to find all the ranges [s,e] is O(c), where c is the sum of the number of haplotypes that match to haplotype i with length equal to the maximum match of any haplotype and i for all i ending at the current site. So, the total work among all M haplotypes is O(M+c), and the span is OMT+T+c* per site, where c* is the maximum number of haplotypes that match to haplotype i with length equal to the maximum match of any haplotype and i for all i ending at the current site. In practice, c*≪M.

4. Results

HP-PBWT was implemented in C# and its source code and software package are available at https://github.com/ucfcbb/HP-PBWT. To benchmark the performance of HP-PBWT, the following tests were carried out. The first test was done to ensure correctness. Then, reporting all versus all L-long matches was benchmarked using HP-PBWT, Wertenbroek et al.’s parallel PBWT, and a corrected version of Durbin’s PBWT. Finally, an IO-excluded benchmark was performed for both HP-PBWT and sequential PBWT by reporting all versus all L-long matches to evaluate the scalability of the HP-PBWT-based algorithms.

4.1. Benchmark Design

Two sets of experiments were designed: IO-included and IO-excluded. The IO-included experiments test real-world scenarios with hard drive input and output. VCF files were used as input for the IO-included experiments. To further evaluate the scalability of HP-PBWT, IO-excluded benchmark of HP-PBWT was implemented and an IO-excluded sequential PBWT was implemented as well. The idea of the IO-excluded benchmark was to remove the IO influence. This is similar to the run times presented by Wertenbroek et al. in the main paper. The IO-excluded benchmark is performed by randomly generating IO-excluded panels and then running the report all versus all L-long match algorithm without outputting matches to the hard drive. Dependencies were added to HP-PBWT to make sure computations were not optimized out by the compiler.

Three measurements were used to evaluate HP-PBWT: run time, speed-up, and parallel efficiency. The run time of IO-included experiments included time for both reading the input and outputting matches. For the IO-excluded experiments, the run time was measured after generating the whole panel X in memory and without outputting matches. The speed-up was calculated by the sequential run time divided by the parallel run time. The parallel efficiency was calculated by speed-up divided by the number of cores.

The IO-included tests used chromosome 20 of the 1000 Genomes Project [1], and chromosome 20 of the UK Biobank [17]. To further test the scalability of these tools, randomly generated VCF files were also used with a fixed dimension of N=1000 sites and M haplotypes that M=1000×2i where i∈[0,15]. The reason that 1000 × 215 was used as the largest input was because both Durbin’s and Wertenbroek et al.’s parallel PBWT use the same VCF handling library (HTSlib [3]) that can not read datasets with M≥1000×216. Thus, the largest input of these experiments was M=1000×215. The length cut-offs were 2000 sites for the 1000 Genomes Project chromosome 20 (the same as in Wertenbroek et al.’s benchmark), 1600 sites for the UK Biobank chromosome 20, and 30 sites for the randomly generated files.

The IO-excluded HP-PBWT was benchmarked against the IO-excluded sequential PBWT with M=1000×2i haplotypes for i∈[0,31] and a fixed dimension of N=100 sites. Since the M dimension was to reach 2 billion, only 100 sites were generated for the sake of memory capacity. The length cut-off was L=50. To create stable run times all the IO-included tests were executed 10 times. For the IO-excluded tests, each experiment were executed 10 times for i∈[0,9], 4 times for i∈[10,17], and 2 times for i∈[18,31].

The IO-included tests were executed on local servers with IntelR XeonR CPU E5-2683 v4. The IO-excluded tests were executed in Windows Server 2022 on the Amazon EC2 servers which were powered by 3.6 GHz 3rd generation AMD EPYC 7R13 processors. To eliminate the interference of different programming languages and operating systems, the IO-excluded sequential PBWT was also programmed in C#. For HP-PBWT 10, 20, 30, 40, 50, and 60 cores were used in both IO-included and IO-excluded tests, meanwhile a 12-core setting was also used in the IO-included tests. All Wertenbroek et al.’s parallel PBWT’s tests in this paper use 12 threads.

4.2. IO-Included Benchmarks

The run times in Table 1 show Wertenbroek et al.’s parallel PBWT’s best run time (from 12 threads) did not have any speed-up comparing to Durbin’s version on either chromosome 20 of UK Biobank genotyping array data or chromosome 20 of 1000 Genomes Project sequencing data. With the same 12-thread setting, HP-PBWT had 2-fold speed-up on chromosome 20 of UK Biobank genotyping array data. Meanwhile HP-PBWT’s best run time had about 4-fold speed-up on chromosome 20 of UK Biobank genotyping array data type with 30 threads. HP-PBWT did not have any speed-up in 1000 Genomes Project sequencing data, since the M dimension of 1000 Genomes Project is too small, it only has 5008 haplotypes, and the parallelization of HP-PBWT is not designed for this type of inputs. The speed-ups show that HP-PBWT can improve the run time of PBWT in large population biobank genotyping array data. Meanwhile, further improvements are needed for HP-PBWT to deal with sequencing data with less amount of haplotypes.

Table 1.

IO-included run time (in seconds) for real datasets. “1KG” stands for 1000 Genomes Project, “UKB” refers to UK Biobank.

PBWT version 1KG Chr.20 UKB Chr.20
Durbin’s 236 409
Wertenbroek et al.’s T=12 320 652
HP-PBWT T=10 433 227
HP-PBWT T=12 404 199
HP-PBWT T=20 389 130
HP-PBWT T=30 448 104
HP-PBWT T=40 766 133
HP-PBWT T=50 874 131
HP-PBWT T=60 989 139

To test HP-PBWT’s performance on large amount of population, randomly generated VCF files were used, since there was not any real dataset with the number of samples is greater than 1 million available to the authors. Figure 4(A) shows the run times of all tools increased when the input size M increased. The speed-up in Figure 4(B) shows the Wertenbroek et al.’s parallel PBWT’s best speed-up was about 1.6-fold, HP-PBWT had a 3-fold speed-up with 12 threads and a 7.2-fold speed-up with 60 threads on the largest input comparing to the corrected Durbin’s PBWT. It shows that HP-PBWT started to gain speed-up to the corrected Durbin’s PBWT at the input of M=64k, meanwhile Wertenbroek et al.’s parallel PBWT started to gain speed-up at M=4m with 1.04-fold speed-up and reached its best 1.6-fold speed-up at M=32m.

Fig. 4.

Fig. 4.

IO-included run time (A) and speed-up (B) based on the random dataset across different versions of PBWT.

4.3. IO-Excluded Benchmarks

Since Durbin’s PBWT does not have an IO-excluded benchmark mode and Wertenbroek et al.’s benchmark mode only reads and converts hard drive files into memory. Heavy modifications should not be applied to these versions to fit the benchmark purposes. Thus, in the IO-excluded benchmarks, the IO-excluded HP-PBWT was only benchmarked with the IO-excluded sequential PBWT.

The run time in Figure 5(A) and the speed-ups in Figure 5(B) show that HP-PBWT had better performance when the size of the input increased. The best performance of HP-PBWT against the sequential PBWT was 22.2-fold at M=8,192,000 with 60 threads. The benchmarks also showed the maximum number of threads (60) setting used in these experiments did not have the best run time all the time. For the largest 2 billion data input, the sequential PBWT took 5.9 hours and HP-PBWT with 50 threads execution had the shortest run time, 0.4 hours, a 13.3-fold speed-up. This benchmark was performed on the Amazon EC2 servers. The speed-up shown in Figure 5(B) and parallel efficiency shown in Figure 6 started to fall once M increased beyond 8 million. There are a couple of potential impact factors. First, the estimated OMT+T+c* time complexity per site for reporting all versus all L-long matches is mainly dominated by the number of haplotypes M, but once M increases to a certain level c*, the maximum number of matches per haplotype also becomes larger. On the other hand, this also reflects the parallel computational theory [7], that the more threads that are being used, the more idle worker time there is. The run time increased accordingly with the number of matches, once M reached some millions, the run time increased significantly. Second, CPU temperature also has a major impact on run time. That is why nowadays CPU and GPU cooling methods are being researched and developed constantly [12, 14, 15].

Fig. 5.

Fig. 5.

IO-excluded run time (A) and speed-up (B) based on the random dataset between HP-PBWT and re-implemented IO-excluded sequential PBWT.

Fig. 6.

Fig. 6.

Parallel efficiency from IO-excluded tests. The parallel efficiency is calculated by speed-up divided by the number of threads.

5. Discussion

In this paper, new algorithms were designed to break the dependencies that prevent Durbin’s PBWT from being executed in parallel on the haplotype dimension M. HP-PBWT algorithms enable parallel PBWT on the panel construction of prefix arrays, divergence arrays, reporting all versus all L-long matches, and reporting all versus all set-maximal matches. HP-PBWT is both memory and IO efficient. HP-PBWT can be applied to any PBWT-based applications to leverage much larger genetic panels up to billions of haplotypes efficiently.

Currently, HP-PBWT works well on biobank scale genotyping array data, but does not have speed-up on sequencing data with small amount of population. It is likely due to the partition mechanisms in prefix array and divergence array computations that they might have too much overhead. New algorithms and optimizations can be researched for the sequencing datasets. Another possible way to speed up the whole process is to apply both haplotype-based parallel PBWT and site-based parallel PBWT algorithms simultaneously.

Acknowledgments

This work was supported by the National Institutes of Health under award numbers R01HG010086 and R01AG081398. This research has been conducted using the UK Biobank Resource under application number 24247.

References

  • 1.1000 Genomes Project Consortium, et al. : A global reference for human genetic variation. Nature 526(7571), 68 (2015) [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 2.Blelloch GE: Scans as primitive parallel operations. IEEE Transactions on Computers 38(11), 1526–1538 (1989) [Google Scholar]
  • 3.Bonfield JK, Marshall J, Danecek P, Li H, Ohan V, Whitwham A, Keane T, Davies RM: HTSlib: C library for reading/writing high-throughput sequencing data. GigaScience 10(2), giab007 (2021) [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 4.Browning BL, Tian X, Zhou Y, Browning SR: Fast two-stage phasing of large-scale sequence data. The American Journal of Human Genetics 108(10), 1880–1890 (2021) [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 5.Browning BL, Zhou Y, Browning SR: A One-Penny Imputed Genome from Next-Generation Reference Panels. The American Journal of Human Genetics 103(3), 338–348 (2018) [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 6.Durbin R: Efficient haplotype matching and storage using the positional Burrows–Wheeler transform (PBWT). Bioinformatics 30(9), 1266–1272 (2014) [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 7.Eager DL, Zahorjan J, Lazowska ED: Speedup versus efficiency in parallel systems. IEEE Transactions on Computers 38(3), 408–423 (1989) [Google Scholar]
  • 8.Freyman WA, McManus KF, Shringarpure SS, Jewett EM, Bryc K, 23, Team, M.R., Auton A: Fast and Robust Identity-by-Descent Inference with the Templated Positional Burrows–Wheeler Transform. Molecular Biology and Evolution 38(5), 2131–2151 (2021) [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 9.Hofmeister RJ, Ribeiro DM, Rubinacci S, Delaneau O: Accurate rare variant phasing of whole-genome and whole-exome sequencing data in the UK Biobank. Nature Genetics 55(7), 1243–1249 (2023) [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 10.Mathieson I, Scally A: What is ancestry? PLoS Genetics 16(3), e1008624 (2020) [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 11.Naseri A, Liu X, Tang K, Zhang S, Zhi D: RaPID: ultra-fast, powerful, and accurate detection of segments identical by descent (IBD) in biobank-scale cohorts. Genome Biology 20(1), 1–15 (2019) [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 12.Ramakrishnan B, Alissa H, Manousakis I, Lankston R, Bianchini R, Kim W, Baca R, Misra PA, Goiri I, Jalili M, et al. : CPU Overclocking: A Performance Assessment of Air, Cold Plates, and Two-Phase Immersion Cooling. IEEE Transactions on Components, Packaging and Manufacturing Technology 11(10), 1703–1715 (2021) [Google Scholar]
  • 13.Rubinacci S, Delaneau O, Marchini J: Genotype imputation using the Positional Burrows Wheeler Transform. PLoS Genetics 16(11), e1009049 (2020) [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 14.Shahi P, Mathew A, Saini S, Bansode P, Kasukurthy R, Agonafer D, et al. : Assessment of Reliability Enhancement in High-Power CPUs and GPUs Using Dynamic Direct-to-Chip Liquid Cooling. Journal of Enhanced Heat Transfer 29(8) (2022) [Google Scholar]
  • 15.Siricharoenpanich A, Wiriyasart S, Naphon P: Study on the thermal dissipation performance of GPU cooling system with nanofluid as coolant. Case Studies in Thermal Engineering 25, 100904 (2021) [Google Scholar]
  • 16.Stoeklé HC, Mamzer-Bruneel MF, Vogt G, Hervé C: 23andMe: a new two-sided data-banking market model. BMC Medical Ethics 17, 1–11 (2016) [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 17.Sudlow C, Gallacher J, Allen N, Beral V, Burton P, Danesh J, Downey P, Elliott P, Green J, Landray M, et al. : UK Biobank: An Open Access Resource for Identifying the Causes of a Wide Range of Complex Diseases of Middle and Old Age. PLoS Medicine 12(3), e1001779 (2015) [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 18.Taliun D, Harris DN, Kessler MD, Carlson J, Szpiech ZA, Torres R, Taliun SAG, Corvelo A, Gogarten SM, Kang HM, et al. : Sequencing of 53,831 diverse genomes from the NHLBI TOPMed Program. Nature 590(7845), 290–299 (2021) [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 19.Wertenbroek R, Xenarios I, Thoma Y, Delaneau O: Exploiting parallelization in positional Burrows-Wheeler transform (PBWT) algorithms for efficient haplotype matching and compression. Bioinformatics Advances 3(1), vbad021 (2023) [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 20.Zhou Y, Browning SR, Browning BL: A Fast and Simple Method for Detecting Identity-by-Descent Segments in Large-Scale Data. The American Journal of Human Genetics 106(4), 426–437 (2020) [DOI] [PMC free article] [PubMed] [Google Scholar]

RESOURCES