Software report · preprint, not peer reviewedOpen access
hla-wgs: HLA typing from whole-genome sequencing that states how many fields of each allele are certain
Affiliations and notes
- 1 PJ Labs, Austria
- Correspondence: info@pjlabs.dev
- Lead contact: Peter Jungwirth, MSc
Article information
- Publication history
- Published 19 November 2026; Updated 3 December 2026
- Peer review
- not peer reviewed
- Version
- 1.3.0
- Licence
- MIT
Highlights
- One program without external tools at run time: own aligner, FASTQ, BAM or CRAM in, 18 genes including DRA, E, F, G, H, K and V out
- Every allele comes with the number of fields that the reads support and with the sites that contradict the database name
- 2,937 of 2,941 held-out alleles correct at two fields (T1K 2,921); DRB3/4/5 copy number correct in 551 of 552 cases (T1K 348)
- Comparison with T1K, OptiType, HISAT-genotype and Kourami on 20 unseen HPRC samples: 254 of 258 four-field statements reported as certain identical to the assembled allele (98.4 %, 95 % interval 96.1 to 99.4 %); median 5.7 s per sample against 21 to 490 s for the other programs
- 17.0 % of gene copies in 80 assembled genomes are new alleles, which no four-field name can describe
- 98.9 % of four-field statements exact in development (1,787 of 1,806), 99.0 % in 59 HGSVC3 genomes (1,339 of 1,353)
- 9,051 of 9,090 alleles agree at two fields with laboratory typing of 967 1000 Genomes samples
- PacBio HiFi reads: 1,434 of 1,519 assembled allele sequences reproduced base for base
- New in 1.3.0: every call carries its measured error rate; expression markers of HLA-C and HLA-DPB1 (0 wrong of 482 genotypes), HLA-KIR receptor-ligand pairs with kir-wgs and the HLA-B leader residue −21, checked against the assemblies; faster FASTQ input
In brief hla-wgs types 18 HLA genes from short-read whole-genome sequencing and states for every allele how many fields the reads support and where they contradict the database name. It is a research tool and does not replace an accredited HLA laboratory.
Summary
HLA alleles are named with up to four fields, and typing programs for whole-genome sequencing usually print all four. Whether the fourth field is right is rarely known, because laboratory typing ends at two fields and because many individuals carry alleles that are absent from the IPD-IMGT/HLA database [1] at full gene length. hla-wgs is a single Rust program, with its own read aligner, that types 18 HLA genes from short-read WGS and reports for every allele the best database name, the number of fields that the reads support and the positions at which the reads differ from that name. A second mode reads PacBio HiFi reads and assembles each allele. On 184 held-out 1000 Genomes samples [2] with assembly-based truth [3] it made 4 two-field errors where T1K [4] made 20, and called the copy number of DRB3, DRB4 and DRB5 correctly in 551 of 552 cases (T1K 348). Of the alleles it reported as certain at four fields, 1,787 of 1,806 were identical to the assembled sequence in 80 development genomes and 1,339 of 1,353 in 59 further genomes (HGSVC3) [5]. Against laboratory typing of 967 1000 Genomes samples [6] it agreed with 9,051 of 9,090 alleles at two fields (T1K on a subset: 764 of 776 against 774 of 776 for hla-wgs).
Graphical abstract
Keywords
- HLA typing
- whole-genome sequencing
- MHC
- IPD-IMGT/HLA
- new alleles
- four-field resolution
- DRB3/DRB4/DRB5 copy number
- HPRC
- HGSVC
- PacBio HiFi
- Rust
Introduction
The HLA genes in the major histocompatibility complex on chromosome 6 are highly polymorphic [1]. Their alleles determine transplant compatibility, are associated with autoimmune and infectious diseases and predict severe drug hypersensitivity. Alleles are named with up to four colon-separated fields: the first two describe the protein, the third synonymous changes in the coding sequence and the fourth changes in introns and untranslated regions [7]. The IPD-IMGT/HLA database collects the known alleles [1].
Whole-genome sequencing (WGS) covers the full length of every HLA gene, and several programs derive HLA types from short reads, among them OptiType [8], HLA-HD [9], xHLA [10], Kourami [11], HLA*LA [12] and T1K [4]. They are evaluated at two fields against laboratory typing, because that is the resolution of the available reference data [13] [6]. Their output nevertheless often carries three or four fields, and a user cannot tell whether the further fields are supported by the data, are the first of several equally good database entries, or describe the nearest known allele of a sequence that is not in the database.
Haplotype-resolved assemblies of the Human Pangenome Reference Consortium (HPRC) [3] and of the Human Genome Structural Variation Consortium (HGSVC) [5] now provide the complete sequence of both copies of each HLA gene for samples that also have 30x short-read WGS from the 1000 Genomes Project [2]. With them, four-field calls can be checked against the complete sequence of both gene copies, and it can be counted how often an individual carries an allele that the database does not contain; two-field laboratory typing shows neither. hla-wgs was written with that reference in mind. Its aim is a correct type and, per allele, an explicit statement of how far the name can be trusted.
Results
Design
hla-wgs is one Rust program without run-time dependencies (Figure 1). It reads paired FASTQ files or a coordinate-sorted BAM or CRAM file on GRCh38 or GRCh37; from alignments it takes the MHC region, the ALT and HLA contigs and the unmapped reads. It types HLA-A, -B, -C, -DRB1, -DRB3, -DRB4, -DRB5, -DQA1, -DQB1, -DPA1, -DPB1, -DRA, -E, -F, -G and the pseudogenes HLA-H, -K and -V. For DRB3, DRB4, DRB5, H and K, which are absent from many haplotypes, it estimates the copy number. All alignment is done by the program's own aligner (minimizer anchors, chaining and an affine-gap dynamic programme with left-aligned gaps); it replaced the minimap2 library [14] used up to version 1.0 (the comparison of both on the development samples is in docs/aligner.md).
For each allele the output gives the best database allele, a safe call cut to the number of fields that the reads support (resolution, 1 to 4), the lead over the best competing pair at fields two, three and four, and a list of new sites: positions at which the reads consistently differ from the called allele, or stretches that no read covers. If the called allele together with its new sites equals another database allele, the call is renamed to that allele. The output is two tables, JSON, a list of new sites and a result page for reading and printing.
Two-field accuracy and copy number on held-out samples
Development followed a frozen-version protocol: each version was fixed before the next batch of samples was downloaded, and 184 1000 Genomes samples with HPRC release 2 assemblies were evaluated in four such rounds. T1K 1.0.10 [4] was run on the same reads with the same IPD-IMGT/HLA release. For the eight classical genes with two copies, hla-wgs called 2,937 of 2,941 alleles correctly at two fields (99.9 %) and T1K 2,921 (99.3 %). The copy number of DRB3, DRB4 and DRB5 (0, 1 or 2) was correct in 551 of 552 cases for hla-wgs and in 348 for T1K (Figure 2).
These rounds were run with the prototype of the algorithm. The current program was compared once more on 30 samples of round 4 (those used in validation/results/short_read_2026_11) with the same reads, for the eight classical genes at two fields. These 30 samples were not used to design any rule of 1.3.0. Of the gene copies whose assembled allele is unambiguous at two fields, hla-wgs released 476 of 476 as certain and right and 0 as certain and wrong; it withheld the rest. T1K 1.0.10, which always gives an answer, was right for 473 of 476 and wrong for 3, and SpecHLA 1.0.12 [15] right for 451 of 476 and wrong for 25.
Comparison with four further programs
The first 20 of the same 30 samples were typed on one computer by hla-wgs (commit dc3acb4), T1K [4], OptiType [8], HISAT-genotype [16] and Kourami [11], with the same reads and the same truth for every program (Table 1, Figure 3). Each program was scored on the main result that its documentation names (Methods). A four-field name counts as right only if the assembled haplotype is identical to that database allele, as elsewhere in this report. Of the four-field calls that hla-wgs reported as certain, 254 of 258 were right, 98.4 % (95 % CI 96.1 to 99.4 %); the wrong ones named the nearest allele of a haplotype that differs from it at one to four positions. hla-wgs reported 80.6 % of all gene copies as certain at four fields. Its best candidate, which it does not claim, was right at four fields for 275 of 314 (87.6 %). HISAT-genotype was the only other program to print four fields, and these were right for 112 of 179 (62.6 %). At three fields and for G groups hla-wgs and T1K differed by at most one wrong call. In median wall time hla-wgs was 4 times faster than OptiType, 5 times faster than Kourami, 18 times faster than T1K and 87 times faster than HISAT-genotype (6 samples on the internal disk).
| Program | Two fields | Three fields | Four fields | G group | Wall time | Peak memory |
|---|---|---|---|---|---|---|
| hla-wgs, certain calls | 320 / 320 | 315 / 316 | 254 / 258 | 316 / 317 | 5.7 s | 2.0 GB |
| hla-wgs, best candidate | 320 / 320 | 317 / 318 | 275 / 314 | 318 / 319 | same run | |
| T1K 1.0.10 | 319 / 320 | 316 / 317 | n/a | 319 / 319 | 103.6 s | 4.0 GB |
| OptiType 1.5.0 (A, B, C) | 117 / 120 | n/a | n/a | 53 / 53 | 21.4 s | 0.9 GB |
| HISAT-genotype 1.3.3 | 312 / 320 | 282 / 286 | 112 / 179 | 306 / 313 | 489.9 s | 6.9 GB |
| Kourami 0.9.6 | 221 / 240 | 205 / 233 | n/a | 237 / 238 | 26.8 s | 5.0 GB |
Scored counts the copies whose truth is defined at that level and that the program called at that level. Four fields: right only if the haplotype is identical to the named allele. Certain calls: only the fields that hla-wgs reports as certain. OptiType types class I only; Kourami reports G groups, its fields are read from the group names. n/a: not reported by the program. Times: median over samples 15 to 20, measured on the internal disk with 8 threads; samples 1 to 14 were read from an external disk and are given in the result folder.
Many individuals carry alleles that are not in the database
For 80 HPRC samples the sequence of every HLA gene was cut from both assembled haplotypes and compared with all database alleles of that gene at full genomic length. Of 2,489 gene copies, 2,067 were identical to a database allele and 422 (17.0 %) were not. New alleles were frequent in DRB1 (100 of 158), in DRB3 and DRB4 and in the pseudogenes K and V, and rare in HLA-A and HLA-C (5 and 3 of 160). 196 of them differ from the nearest database allele at a single position, 92 at ten or more. For all of these a four-field name is necessarily wrong.
Four-field statements
On the 80 development samples hla-wgs agreed with the assembly at two fields for 2,486 and at three fields for 2,482 of 2,489 haplotypes. Of the 2,067 known alleles, 2,043 were called exactly at four fields (98.8 %). The program reported 1,806 alleles as certain at four fields; 1,787 of them were identical to the assembled sequence (98.9 %, 95 % CI 98.4 to 99.3 %; Table 2). Of the new-site positions it reported, 1,618 of 1,701 were confirmed by the assembly.
HLA-E is capped at three fields, because its fourth-field differences lie in repeats of the untranslated regions. For DRB3 and DRB4 four-field statements are rare: the new-allele examination finds unsupported positions or uncovered stretches in most cases. The copy numbers of DRB3, DRB4, DRB5, H and K agreed with the assemblies in all 80 samples.
| Gene | Haplotypes | Two fields | Three fields | Known alleles exact | New alleles | Certain at four fields | of these exact |
|---|---|---|---|---|---|---|---|
| HLA-A | 160 | 160 / 160 | 160 / 160 | 155 / 155 | 5 | 146 | 146 |
| HLA-B | 160 | 160 / 160 | 159 / 160 | 138 / 140 | 20 | 142 | 137 |
| HLA-C | 160 | 160 / 160 | 160 / 160 | 157 / 157 | 3 | 150 | 150 |
| HLA-DRB1 | 158 | 158 / 158 | 157 / 158 | 56 / 58 | 100 | 20 | 16 |
| HLA-DRB3 | 80 | 80 / 80 | 79 / 80 | 39 / 41 | 39 | 0 | 0 |
| HLA-DRB4 | 37 | 36 / 37 | 37 / 37 | 19 / 23 | 14 | 0 | 0 |
| HLA-DRB5 | 18 | 18 / 18 | 18 / 18 | 9 / 9 | 9 | 6 | 6 |
| HLA-DQA1 | 160 | 160 / 160 | 160 / 160 | 128 / 138 | 22 | 99 | 98 |
| HLA-DQB1 | 160 | 159 / 160 | 159 / 160 | 154 / 155 | 5 | 146 | 145 |
| HLA-DPA1 | 160 | 160 / 160 | 160 / 160 | 146 / 147 | 13 | 134 | 134 |
| HLA-DPB1 | 160 | 159 / 160 | 159 / 160 | 139 / 139 | 21 | 140 | 137 |
| HLA-DRA | 158 | 158 / 158 | 156 / 158 | 144 / 144 | 14 | 136 | 135 |
| HLA-E | 158 | 158 / 158 | 158 / 158 | 154 / 154 | 4 | 147 | 147 |
| HLA-F | 160 | 160 / 160 | 160 / 160 | 152 / 154 | 6 | 151 | 149 |
| HLA-G | 160 | 160 / 160 | 160 / 160 | 155 / 155 | 5 | 144 | 144 |
| HLA-H | 140 | 140 / 140 | 140 / 140 | 133 / 133 | 7 | 119 | 119 |
| HLA-K | 140 | 140 / 140 | 140 / 140 | 66 / 66 | 74 | 27 | 27 |
| HLA-V | 160 | 160 / 160 | 160 / 160 | 99 / 99 | 61 | 99 | 97 |
| All genes | 2,489 | 2,486 / 2,489 | 2,482 / 2,489 | 2,043 / 2,067 | 422 | 1,806 | 1,787 |
Two and three fields: the call shares these fields with a nearest database allele of its haplotype. Known alleles exact: haplotypes identical to a database allele that were called with all four fields right. Certain at four fields: reported as certain at four fields.
Fifty-nine HGSVC genomes
The 59 HGSVC samples [5] with 1000 Genomes short reads that are not among the HPRC samples were typed with the current program and compared with their own assemblies, built in the same way. They were unseen until version 1.2.0; since then they have been used to find errors (the repeat rule of 1.3.0 was designed on them and on the development samples), so they are no longer a test of unseen data. hla-wgs agreed at two fields for 1,833 and at three fields for 1,830 of 1,833 haplotypes. It reported 1,353 alleles as certain at four fields; 1,339 were exact (99.0 %, 95 % CI 98.3 to 99.4 %). Reported new-site positions were confirmed for 885 of 973.
How far each call can be trusted
A lead decides whether a field is released; it does not say how often a released field is wrong. For the 169 genomes with assembly truth (80 HPRC, 59 HGSVC3, 30 held-out HPRC) every released call was compared with the allele of its haplotype. Pooled over genes, released calls were wrong in 1 of 4,980 cases at two fields, 9 of 4,719 at three and 40 of 3,841 at four fields (1.04 %, 95 % interval 0.77 to 1.41 %, Wilson interval [17]). Per gene the four-field rate ranged from 0 of 317 for HLA-A to 8 of 53 (at most 27.05 %) for DRB1. For 52 of 52 gene and field rows, the rate on the held-out genomes was not above the upper end of the interval measured on the development genomes alone. Above a lead of about 10 the four-field error no longer fell with a larger lead: the remaining errors are systematic (repeat lengths, phase at the 3′ end) and are not removed by more reads. hla-wgs therefore reports with every call the measured rate of its gene at the released number of fields.
Expression markers and receptor ligands
Some consequences of an HLA type depend on positions outside the exons that laboratory typing reads. hla-wgs reports three variants that change how much HLA-C or HLA-DP a cell makes: rs9277534 in the 3′UTR of DPB1 (G high, A low expression [18]), the insertion or deletion rs67384697 in the 3′UTR of HLA-C (the deletion disrupts the binding site of miR-148a/b and goes with higher expression [19]) and rs2395471 in the HLA-C promoter (A binds Oct1 more strongly and goes with higher expression [20]). The first two are read from the genomic sequence of the called allele, the third, which IPD-IMGT/HLA sequences do not reach, from a table of two-field alleles built from the assembled haplotypes. In the 338 haplotypes, the state given for the true allele matched the assembly in 338 of 338 haplotypes for rs9277534 and 326 of 326 for rs67384697; with each genome left out of the table in turn, rs2395471 was predicted for 324 of 338 haplotypes, 0 wrong. From the calls of hla-wgs, 482 genotypes of both copies were given and 0 were wrong (upper 95 % bound 0.8 %); 25 were not given because an allele has no sequence at the site. The allele groups that the original papers name for each state agreed in 1,210 of 1,212 database alleles. The deletion at rs67384697 was found in 116 of 338 (34.3 %) haplotypes, whereas the short-read callsets of gnomAD and of the 1000 Genomes 30x data list it at well below 1 %; its local sequence differs between allele lineages. rs9264942, 35 kb upstream of HLA-C and often used as an expression marker, is not determined by the allele (132 of 338 haplotypes, 3 wrong) and is not reported.
For HLA-A, -B and -C the program gives the KIR ligand group (C1, C2, Bw4 with I or T at residue 80, Bw6) and for HLA-B the leader residue −21, which decides whether the HLA-B leader peptide is presented by HLA-E [21]. Read from the coding sequence, the ligand groups agreed with the protein translation of IPD-IMGT/HLA in 21,805 of 21,818 alleles and the leader residue in 7,983 of 7,986 HLA-B alleles (the others are alleles of questionable expression) and the Bw4/Bw6 group with the serological antigen in 5,736 of 5,745 alleles; the rest carry the other motif at residues 77 to 83, which decides KIR3DL1 binding [22]. −21M was the majority in 10 groups (B*07, 08, 14, 38, 39, 42, 48, 67, 73, 81), as described by Horowitz et al. A separate command, hla-wgs kir-ligands, joins the result with that of kir-wgs for the same genome and lists KIR2DL1, 2DS1, 2DL2, 2DL3, 3DL1, 3DL2 and 2DS2 with their ligands as given by Pende et al. [23] [24]; KIR3DS1, KIR2DL4 and KIR2DS4 are left out, because the genome does not decide their ligand or it could not be checked. For 165 genomes with assemblies of both regions, the statement whether each inhibitory KIR meets a strong ligand agreed with the assemblies in 816 of 824 cases, 5 were left open and 3 were wrong, all from a KIR gene that kir-wgs missed. The HLA-B −21 genotype agreed in 164 of 165 genomes; 1 was left open and none was wrong.
Laboratory typing of 1,101 samples
All 1000 Genomes samples with laboratory types of HLA-A, -B, -C, -DRB1 and -DQB1 [13] [6] were typed from their 30x CRAM files (two samples have an empty index and were left out). Because the weak frequency prior of the program is counted from the same laboratory data, the samples were split in two halves and each half was typed with the prior of the other. Against the 2018 typing (967 samples) [6] hla-wgs agreed with 9,051 of 9,090 alleles at two fields (99.6 %, 95 % CI 99.4 to 99.7 %). T1K was run on 83 of these samples, where hla-wgs agreed with 774 of 776 and T1K with 764 of 776 alleles. Against the older 2014 typing (all 1,101 samples, with more ambiguous entries) [13] the agreement was 10,754 of 10,985.
Each of the 39 differences to the 2018 typing was examined. In 23 the two alleles are identical in the exons that the laboratory typed (exons 2 and 3 of class I, exon 2 of class II), so the laboratory could not tell them apart; one is an old name that IPD-IMGT/HLA no longer contains, and two come from a parse error in the laboratory file. 13 are real differences in the typed exons. In the Genome in a Bottle trios [25] (HG002 to HG004 at 60x, HG005 to HG007 at 100x) the child's alleles were consistent with Mendelian inheritance at two and three fields in every gene present (17 of 17 and 16 of 16).
Lower sequencing depth
Leads shrink with the number of reads. When the 80 development samples were thinned to 15x and 10x, the calls themselves stayed almost unchanged, but many correct calls stopped at fewer certain fields than they deserved. Fields two and three are therefore certain from a lead of 4; a four-field statement still needs a lead of 6 at fields two and three and of 4 at field four. Table 3 shows the effect. The number of certain but wrong statements stayed the same except for one three-field call at 10x.
| Depth | Lead 6: two fields | Lead 6: three fields | Lead 4: two fields | Lead 4: three fields |
|---|---|---|---|---|
| 30x | 2,344 / 2,350 | 2,251 / 2,268 | 2,353 / 2,359 | 2,262 / 2,279 |
| 15x | 2,255 / 2,259 | 2,138 / 2,154 | 2,306 / 2,310 | 2,206 / 2,222 |
| 10x | 1,917 / 1,921 | 1,724 / 1,738 | 2,218 / 2,222 | 2,073 / 2,088 |
Long reads
In its long-read mode hla-wgs takes PacBio HiFi reads of the MHC region, groups them by haplotype, builds a consensus per group by plurality vote, and names the nearest database allele by its exons first. For the 26 samples among the 80 with HPRC HiFi alignments, 1,434 of 1,519 consensus sequences of all genes it found were identical to an assembled haplotype over their whole length, and 1,524 assembled gene copies were reproduced exactly. Of the calls it reported as exact database alleles, 607 of 609 were in the truth set; of the calls with differences, the nearest allele was right at two fields in 129 of 131. Most of the remaining differences are one to three bases in long single-base runs and short repeats.
Run time
On four cores and the extracted reads of a 30x genome (MHC region, ALT and HLA contigs, unmapped reads), hla-wgs needed 17 s wall time and 59 s CPU time per sample, T1K 194 s and 613 s (median of 8 samples, same machine, run one after the other). These times come from a different setup than the medians of Table 1 (4 cores in the cloud against 8 threads on an Apple M5). Building the reference from the database release takes about four minutes and the repeat mask about one minute, once.
Discussion
Three results stand out. First, on the same held-out reads hla-wgs released fewer wrong two-field calls than T1K and SpecHLA, at the price of withholding a small share, and its copy-number model for the DRB paralogues almost never misjudged whether DRB3, DRB4 or DRB5 is present (prototype rounds). Second, a substantial share of gene copies carry alleles outside the database. For these, a four-field name is necessarily wrong, however accurate the typer. In the 80 development genomes the share of such gene copies was 28 of 480 (5.8 %) for HLA-A, -B and -C, 161 of 798 (20.2 %) for DRB1, DQA1, DQB1, DPA1 and DPB1, 62 of 135 (45.9 %) for DRB3, DRB4 and DRB5, 29 of 636 (4.6 %) for DRA, E, F and G and 142 of 440 (32.3 %) for the pseudogenes H, K and V; part of these differences may be errors of the assemblies. A program that always prints four fields gives a wrong fourth field for all of them without saying which. Third, the certainty statements held on the HGSVC genomes, which were not used to develop the version they were first measured with, and the laboratory comparison on 1,101 samples left 13 real disagreements in the typed exons.
hla-wgs separates the name from its certainty. The price is that it declines to state four fields for many alleles that are in the database and could have been named. In return, a four-field statement that is made was correct in 98.9 % of cases in development and 99.0 % on the HGSVC genomes. For applications that rely on the non-coding sequence, the list of new sites is more informative than a name.
The remaining errors have identifiable causes. Homopolymer and repeat lengths are at the limit of short-read accuracy and are the main source of four-field errors. Variants at the far 3′ end of a gene cannot be assigned to a haplotype when no heterozygous position lies within reach of a read pair; the program marks such sites as belonging to either allele where it recognises the situation. With HiFi reads, the same repeats limit the agreement with the assemblies, which were built from the same reads.
Limitations of the study
- Short-read WGS (2x100 to 2x150 bp) validated at 10x to 100x, and PacBio HiFi reads of the MHC region. Exome, amplicon, RNA and other long-read data are not supported.
- Assembly-based truth is itself not error-free, and its definition favours shorter database entries when two alleles are equally near. HiFi agreement shows that the program reads the data like the assembler, which used the same reads.
- The four held-out rounds against T1K were run with the prototype of the algorithm; the comparison with the current program covers the 30 samples of round 4 and eight genes. T1K and SpecHLA were run with the settings their authors give for whole-genome data (Methods) and may perform better with other parameters. T1K also types KIR genes and RNA-seq data, which hla-wgs does not.
- The comparison with five programs covers 20 samples and eight genes on one computer. HISAT-genotype, Kourami and OptiType use older database releases than hla-wgs and T1K, which affects their three- and four-field names more than their two-field calls. HLA*LA (about 40 GB of memory) and xHLA (amd64 container only) were not run.
- The frequency prior is counted from the laboratory typing of the 1000 Genomes samples, to which the HPRC and HGSVC samples belong. On the 59 HGSVC samples, typing without it (HLA_NOFREQ=1) gave 1,731 right and 2 wrong two-field calls against 1,738 right and 2 wrong with it, and a prior counted without these samples gave identical calls.
- Laboratory typing covers five genes at two fields. For DRA, E, F, G, H, K and V the only reference is the assemblies.
- The laboratory comparison, the lower-depth study, the long-read results and the run times were computed with version 1.2.0. On the assembly sets the changes of 1.3.0 only added fields for carriers of alleles that the database error had shadowed and withheld a few four-field calls at unspanned repeats; no wrong call was added. These sections were therefore not repeated.
- Expression markers and receptor ligands are checked against assemblies and the cited papers, not against measured expression or binding. Which of Bw4-80I and Bw4-80T binds KIR3DL1 more strongly is not ranked.
- The repeat mask assumes GRCh38. The program has not been validated for clinical use.
Resource availability
Lead contact
Requests for further information and resources should be directed to the lead contact, Peter Jungwirth (info@pjlabs.dev).
Materials availability
This study did not generate new reagents or materials.
Data and code availability
Source code, the validation program and all result tables are available under the MIT licence at github.com/pjlabsdev/hla-wgs, release v1.3.0 (github.com/pjlabsdev/hla-wgs/releases/tag/v1.3.0; newest release: github.com/pjlabsdev/hla-wgs/releases/latest). Archived on Zenodo, all versions: doi:10.5281/zenodo.24367469.
The reference is built locally from the IPD-IMGT/HLA release [1]; the database is distributed by its owners under CC BY-ND and no database sequences are distributed with hla-wgs.
Acknowledgments
This work used the IPD-IMGT/HLA database, assemblies of the Human Pangenome Reference Consortium and of the Human Genome Structural Variation Consortium, sequencing data of the 1000 Genomes Project (New York Genome Center) and of the Genome in a Bottle Consortium, and the published HLA typing of 1000 Genomes samples.
Declaration of interests
The author declares no competing interests.
Methods
Key resources table
| Resource | Version | Source |
|---|---|---|
| Deposited data | ||
| IPD-IMGT/HLA | 3.66 | ebi.ac.uk/ipd/imgt/hla |
| 1000 Genomes, high-coverage genomes | NYGC 30x | internationalgenome.org |
| HPRC assemblies | Release 2 | humanpangenome.org |
| HGSVC assemblies | HGSVC3 | hgsvc.org |
| Genome in a Bottle | HG002 to HG007 | nist.gov/programs-projects/genome-bottle |
| Software and algorithms | ||
| hla-wgs | 1.3.0 | github.com/pjlabsdev/hla-wgs |
| T1K | 1.0.10 | github.com/mourisl/T1K |
| SpecHLA | 1.0.12 | github.com/deepomicslab/SpecHLA |
| OptiType | 1.5.0 | github.com/FRED-2/OptiType |
| HISAT-genotype | 1.3.3 | github.com/DaehwanKimLab/hisat-genotype |
| Kourami | 0.9.6 | github.com/Kingsford-Group/kourami |
Data and study participant details
No new human samples were collected and no patient data were used. Public data: 1000 Genomes high-coverage genomes [2] with published laboratory HLA typing [13] [6], HPRC release 2 [3] and HGSVC3 [5] assemblies, HPRC PacBio HiFi alignments and the Genome in a Bottle trios [25].
Method details
Reference
hla-wgs build-db reads the IPD-IMGT/HLA hla.dat file (release 3.66 in this report) and writes the allele sequences with exon coordinates and a panel of representative full-length allele sequences. Alleles without a full genomic sequence are extended with the sequence of their nearest full-length relative. hla-wgs build-mask counts 21-mers of the panel in the genome outside the MHC and masks panel stretches that occur there three times or more.
Typing
Reads are mapped to the panel with the program's own aligner; a pair counts for a gene only if both mates align or the partner can be rescued next to it, and reads anchored only in masked sequence are dropped. Per gene, alleles are scored by a k-mer likelihood, and an expectation-maximisation step selects candidates. All reads of the gene are aligned to all candidates, and pairs of candidates are compared on the resulting edit-distance matrix; a refinement step re-examines the exons, for DRB1 with the reads that the panel gave to DRB3, DRB4 and DRB5. A weak prior from two-field allele frequencies of the 1000 Genomes laboratory typing separates otherwise equal candidates of five genes. DRB1, DRB3, DRB4 and DRB5 are modelled jointly by depth relative to the single-copy genes.
Certainty
For fields two, three and four the lead is the log-likelihood difference to the best pair that differs at that field. Fields two and three are certain from a lead of 4. A four-field statement needs a lead of 6 at fields two and three and of 4 at field four (1 when the fourth field is 01, the first-described allele of its group). The reads are then realigned to the two called alleles. A position becomes a new site when enough reads (five, four or three by median depth) and a clear majority of the reads of that allele carry the same difference. A stretch of 30 bp or more without any read is reported as blind when such stretches sum to 300 bp or more. A new site in an exon reduces the resolution to the field that it changes.
Long reads
HiFi reads of each gene are clustered into haplotype groups, extended, polished by plurality vote over the reads that span each position, and named by the nearest database allele, comparing exons first. Groups that name the same allele are polished jointly unless the joint sequence gains more than two unsure positions.
Comparison tools
T1K 1.0.10 [4] was run on the extracted reads as run-t1k -1 R1.fq.gz -2 R2.fq.gz --preset hla-wgs -f hlaidx_dna_seq.fa -t 4, with the index built by its t1k-build.pl from IPD-IMGT/HLA release 3.66 (validation/hprc/run_t1k.sh). SpecHLA 1.0.12 [15] read the same samples from a BAM of the MHC region and the unmapped reads with its ExtractHLAread.sh -r hg38 and was run as SpecHLA.sh -j 4 with its bundled IPD-IMGT/HLA 3.38 database. Gene names of both were converted to the hla-wgs notation; a gene reported once counts as homozygous. All three were evaluated by the same eval23. For the comparison with five programs on 20 samples (validation/results/tool_comparison_2026_12), every program read the same paired FASTQ extract of each sample on one computer (Apple M5, 16 GB) with 8 threads, in an order rotated per sample with 300 s between programs, and was timed with /usr/bin/time -l; Kourami read its own realignment of the reads, whose time is included. The scored result was fixed before scoring: for T1K the first listed allele, for HISAT-genotype the first two alleles of its EM ranking, for OptiType its two alleles per gene and for Kourami its two G groups. HISAT-genotype 1.3.3 used its database 3.26, Kourami 0.9.6 its panel 3.24 and OptiType 1.5.0 its bundled reference. Installation, deviations and the raw output of every program are in the result folder.
Quick start
# build once (IPD-IMGT/HLA hla.dat and a GRCh38 FASTA)
git clone https://github.com/pjlabsdev/hla-wgs && cd hla-wgs
cargo build --release
hla-wgs build-db hla.dat data/freq_1000g_2field.json hladb
hla-wgs build-mask hladb GRCh38.fa
# type a sample (BAM or CRAM, or paired FASTQ)
hla-wgs hladb sample.bam out/sample 4
hla-wgs hladb sample.cram out/sample 4 GRCh38.fa
hla-wgs hladb sample_R1.fq.gz sample_R2.fq.gz out/sample 4
# PacBio HiFi reads
hla-wgs long hladb sample.hifi.bam out/sample 4Truth and evaluation
Assemblies of HPRC release 2 and HGSVC3 were downloaded, contigs with HLA sequence extracted, and each gene located by alignment of the database alleles. The truth for a haplotype is the nearest database allele at full genomic length together with the list of differences. Reads were taken from the 1000 Genomes 30x CRAM files. A four-field call counts as exact only if the assembled sequence is identical to the called allele. All evaluation is done by hla-wgs-validate, part of the repository; every number in the report is computed by it from the files under validation/results, and the report itself is produced by hla-wgs-validate paper.
Supplemental information
References
- Barker DJ, Maccari G, Georgiou X, et al. The IPD-IMGT/HLA Database. Nucleic Acids Res. 2023;51(D1):D1053-D1060.
- Byrska-Bishop M, Evani US, Zhao X, et al. High-coverage whole-genome sequencing of the expanded 1000 Genomes Project cohort including 602 trios. Cell. 2022;185(18):3426-3440.
- Liao WW, Asri M, Ebler J, et al. A draft human pangenome reference. Nature. 2023;617:312-324.
- Song L, Bai G, Liu XS, Li B, Li H. Efficient and accurate KIR and HLA genotyping with massively parallel sequencing data. Genome Res. 2023;33(6):923-931.
- Logsdon GA, Ebert P, Audano PA, et al. Complex genetic variation in nearly complete human genomes. Nature. 2025;644:430-441.
- 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.
- Marsh SGE, Albert ED, Bodmer WF, et al. Nomenclature for factors of the HLA system, 2010. Tissue Antigens. 2010;75(4):291-455.
- Szolek A, Schubert B, Mohr C, Sturm M, Feldhahn M, Kohlbacher O. OptiType: precision HLA typing from next-generation sequencing data. Bioinformatics. 2014;30(23):3310-3316.
- Kawaguchi S, Higasa K, Shimizu M, Yamada R, Matsuda F. HLA-HD: an accurate HLA typing algorithm for next-generation sequencing data. Hum Mutat. 2017;38(7):788-797.
- Xie C, Yeo ZX, Wong M, et al. Fast and accurate HLA typing from short-read next-generation sequence data with xHLA. Proc Natl Acad Sci USA. 2017;114(30):8059-8064.
- Lee H, Kingsford C. Kourami: graph-guided assembly for novel human leukocyte antigen allele discovery. Genome Biol. 2018;19:16.
- Dilthey AT, Mentzer AJ, Carapito R, et al. HLA*LA: HLA typing from linearly projected graph alignments. Bioinformatics. 2019;35(21):4394-4396.
- Gourraud PA, Khankhanian P, Cereb N, et al. HLA diversity in the 1000 Genomes dataset. PLoS One. 2014;9(7):e97282.
- Li H. Minimap2: pairwise alignment for nucleotide sequences. Bioinformatics. 2018;34(18):3094-3100.
- Wang S, Wang M, Chen L, Li G, Zeng Y, Wang S, et al. SpecHLA enables full-resolution HLA typing from sequencing data. Cell Rep Methods. 2023;3(9):100589.
- Kim D, Paggi JM, Park C, et al. Graph-based genome alignment and genotyping with HISAT2 and HISAT-genotype. Nat Biotechnol. 2019;37:907-915.
- Wilson EB. Probable inference, the law of succession, and statistical inference. J Am Stat Assoc. 1927;22(158):209-212.
- Petersdorf EW, Malkki M, O'hUigin C, et al. High HLA-DP expression and graft-versus-host disease. N Engl J Med. 2015;373(7):599-609.
- Kulkarni S, Savan R, Qi Y, et al. Differential microRNA regulation of HLA-C expression and its association with HIV control. Nature. 2011;472(7344):495-498.
- Vince N, Li H, Ramsuran V, et al. HLA-C level is regulated by a polymorphic Oct1 binding site in the HLA-C promoter region. Am J Hum Genet. 2016;99(6):1353-1358.
- Horowitz A, Djaoud Z, Nemat-Gorgani N, et al. Class I HLA haplotypes form two schools that educate NK cells in different ways. Sci Immunol. 2016;1(3):eaag1672.
- Gumperz JE, Barber LD, Valiante NM, et al. Conserved and variable residues within the Bw4 motif of HLA-B make separable contributions to recognition by the NKB1 killer cell-inhibitory receptor. J Immunol. 1997;158(11):5237-5241.
- Pende D, Falco M, Vitale M, et al. Killer Ig-like receptors (KIRs): their role in NK cell modulation and developments leading to their clinical exploitation. Front Immunol. 2019;10:1179.
- Parham P. MHC class I molecules and KIRs in human history, health and survival. Nat Rev Immunol. 2005;5(3):201-214.
- Zook JM, Catoe D, McDaniel J, et al. Extensive sequencing of seven human genomes to characterize benchmark reference materials. Sci Data. 2016;3:160025.