# Pangenome (HPRC) part 2: haplotypes against each other

:::caution JBrowse v5 beta

The tutorials target the JBrowse v5 beta, and the v4.3.0 release
on the [download page](https://jbrowse.org/jb2/download/) lacks some of what they show. To install the
beta of JBrowse Web, run `npm install -g @jbrowse/cli@next`, then
`jbrowse create jbrowse2 --branch v5.0.0-beta.21`. Desktop beta builds for Linux and
macOS are on the [releases page](https://github.com/GMOD/jbrowse-components/releases);
the Windows build waits on code signing.

:::

We draw human haplotypes from the Human Pangenome Reference Consortium's release
2 side by side, one lane per haplotype drawn in that haplotype's assembly
coordinates, and use the pangenome graph to show where neighbouring lanes match.
We look at three loci: CFH, where some haplotypes lack two genes; GSTT1, a gene
GRCh38's chromosome lacks; and FLNA / EMD, two genes some haplotypes have in the
opposite order. We:

- at CFH and GSTT1, open the lanes from the HPRC page's **Haplotypes** launch,
  which stacks them by structure
- at FLNA / EMD, add the graph's bubbles track and filter it to inversions
- read each lane's genes from the annotation of that haplotype's assembly
- at IGL, choose lanes by name from the **Lanes** menu
- configure the haplotype lanes track for a graph of your own

:::caution Experimental

The graph view is a beta plugin, and the
[HPRC page](https://genomes.jbrowse.org/pangenomes/) launches it on the JBrowse
5 development build until JBrowse 5 ships. We welcome your [feedback](https://jbrowse.org/jb2/contact).

A lane shows only what the graph aligned, and some haplotypes get no lane at
all. Read [what the lanes leave out](#limits) before reading an absent or empty
lane as a deletion.

:::

## Prerequisites

- the GraphGenomeView plugin, for the `GraphTrack` below. In your own JBrowse,
  [install it from the plugin store](https://jbrowse.org/jb2/docs/user_guides/plugin_store); the HPRC
  page's launches and the hosted config already load it

## The data

You don't need these files to follow the page: the HPRC launches read the hosted
tabix indexes, built from these files of
[HPRC release 2](https://doi.org/10.64898/2026.07.21.739710).
[Reproduce it end to end](#reproduce-it-end-to-end) names the build, and
[Configuring the haplotype lanes track](#configuring-the-haplotype-lanes-track)
has the config to adapt for your own graph.

| What it is                                            | File                                                                                                                                                                                |
| ----------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| The release's minigraph-cactus graph as a GFA         | [hprc-v2.1-mc-grch38.gfa.gz](https://s3-us-west-2.amazonaws.com/human-pangenomics/pangenomes/freeze/release2/minigraph-cactus/v2.1/hprc-v2.1-mc-grch38/hprc-v2.1-mc-grch38.gfa.gz)  |
| The assemblies                                        | [assemblies_release2_v1.0.index.csv](https://raw.githubusercontent.com/human-pangenomics/hprc_intermediate_assembly/main/data_tables/assemblies_release2_v1.0.index.csv)            |
| The CAT gene annotation index, one GFF3 per haplotype | [cat_genes_hprc_r2_v1.3.index.csv](https://raw.githubusercontent.com/human-pangenomics/hprc_intermediate_assembly/main/data_tables/annotation/cat/cat_genes_hprc_r2_v1.3.index.csv) |

<details>
<summary>Read by URL (no download needed)</summary>

| What it is                                                                                              | File                                                    |
| ------------------------------------------------------------------------------------------------------- | ------------------------------------------------------- |
| Our indexed files of the graph's haplotype walks and bubbles, with the exact build recorded beside them | [README.txt](https://jbrowse.org/demos/hprc/README.txt) |

</details>

## CFH: haplotypes missing two genes

Open the [HPRC page](https://genomes.jbrowse.org/pangenomes/hprc) and click the
**CFH / CFHR** example, the complement factor H gene cluster. Under **More about
this window**, click **Haplotypes**, which opens the lanes under the NCBI RefSeq
genes (hg38), **Known alleles** and **GWAS Catalog (NHGRI-EBI)** tracks:

- **Each structural form gets lanes**, more for a commoner form, and each lane's
  header counts the haplotypes that share its form.
- **A lane missing _CFHR3_ and _CFHR1_** (Hughes et al. 2006) has a gap across
  both, under the **Known alleles** row naming the deletion.

<Figure caption="The CFH cluster from the Haplotypes launch. The lanes missing CFHR3 and CFHR1 have a gap across both." src="/img/pangenome/hprc_cfhr_lanes.png" />

## GSTT1: a gene GRCh38's chromosome lacks

GRCh38's chromosome 22 has the common _GSTT1_ deletion, so the gene sits on an
alternate contig and no chr22 track draws it. Click the **GSTT1** example on the
HPRC page, then **Haplotypes** under **More about this window**:

- **The lanes stack by structure**, each beside the one whose deletions and
  insertions against GRCh38 are most alike, so the lanes of one form sit
  together.
- **The band between two lanes** connects the two haplotypes at the nodes both
  walks share, and widens where the lower lane has sequence the upper lacks.

<Figure caption="GSTT1 from the Haplotypes launch, its lanes stacked by structure." src="/img/multiway_synteny/hprc_gstt1_lanes.png" />

## FLNA / EMD: two genes in the opposite order {#inversions}

_FLNA_ and _EMD_ sit between two inverted repeats on Xq28, and the block between
them is inverted on many X chromosomes (Small et al. 1997). Click the **FLNA /
EMD** example on the HPRC page, then **Haplotypes** under **More about this
window**. Then:

- **The band between two lanes** crosses itself, in blue, where the lower lane
  runs the block in the other direction, and an inverted lane's header names the
  inversion.
- **HPRC release 2 bubbles** in the track selector adds the graph's bubbles.
  `gfatools bubble` flags one as `inversion` when its paths disagree about
  orientation.
- **Filter by → Edit filters...** on that track keeps the flagged ones with this
  filter:

  ```jexl
  jexl:feature.inversion
  ```

<Figure caption="FLNA / EMD from the Haplotypes launch, with the bubbles track filtered to inversions. The band crosses in blue where the inverted lanes meet the lanes in GRCh38's orientation." src="/img/pangenome/hprc_inversion.png" />

## Where each haplotype's genes come from {#haplotype-genes}

JBrowse draws each lane, and each bar under **Walk rows**, with the genes
annotated on that haplotype's assembly, at that assembly's coordinates. It does
not lift GRCh38's genes across the graph.

- **The source:** HPRC annotated each release 2 assembly but HG002's with CAT
  (the Comparative Annotation Toolkit), which projects GENCODE's GRCh38 genes
  onto it, in the [CAT index](#the-data) above. HG002's two haplotypes are the
  [Q100 assembly](https://github.com/marbl/HG002) hg002v1.1, whose project
  annotated it with RefSeq's genes through JHU's Liftoff; we keep each gene's
  MANE Select transcript there, so a few symbols and isoforms differ from the
  CAT lanes. Liftoff leaves out the functional V, D and J segments of the
  antibody and T-cell receptor loci, so HG002's lanes there show only their
  pseudogene segments.
- **What we host:** one gene model per named gene for each haplotype, as
  `https://jbrowse.org/pangenome/hprc-grch38/genes/<sample>.<haplotype>.genes.bed.gz`,
  chosen by these rules:
  - Each model is the gene's Ensembl canonical transcript as CAT projected it,
    else its longest coding transcript.
  - A gene with no symbol is dropped, and so is one spanning over 5 Mb.
  - Where CAT projected two paralogs onto one locus, such as _GSTM1_ onto
    _GSTM2_, we keep the gene whose GRCh38 span the haplotype's walk crosses
    there.
  - CAT misses genes that only GRCh38's alternate contigs hold. We splice
    GENCODE's models of _GSTT1_, _LILRA3_, _HLA-DRB3_, _HLA-DRB4_ and _HLA-DRB5_
    onto each haplotype's assembly instead, where its walk crosses them.
  - [README.txt](https://jbrowse.org/pangenome/hprc-grch38/genes/README.txt)
    beside the files gives every rule and what CAT still misses.
- **Where a lane's genes come from:** each haplotype is an assembly, such as
  `HG00097.1` aliased `HG00097#1`, holding one track, **CAT genes (HG00097
  haplotype 1, HPRC release 2)**, or for HG002 **RefSeq genes via JHU Liftoff
  v0.6**. JBrowse draws that track in the haplotype's lane, and for each of the
  first 40 walk-row bars reads it over the bar's span on the haplotype's contig
  and boxes each gene where it falls along the bar.
- **Reading them:**
  - A gene missing from a lane is missing from that haplotype's annotation,
    through a deletion, a copy CAT did not project, or a gene the rules above
    dropped.
  - CAT names each copy of a duplicated gene after the GRCh38 copy it projected,
    so a haplotype with extra _AMY1_ copies shows _AMY1C_ several times. The
    number of _AMY1_ boxes gives the copy number, unless CAT missed a copy.

## Limits of the lanes {#limits}

The lanes are easy to misread in several cases:

- **A haplotype the graph does not align has no lane.** Picked by hand under
  **Lanes → Choose lanes...**, it gets an empty row at the foot headed "no
  alignment in this window".
- **A stretch the haplotype skips across the window is a row with no ribbons.**
  A haplotype with no step on the reference across the whole window shows as a
  row at the foot of the lanes, headed with the stretch's length, such as "no
  step on the reference across 150 kb". The row comes from the walk file's
  departure record for where the walk leaves the reference and rejoins it, which
  the file keeps over the whole stretch between, so every window inside the
  stretch reads it. Walk rows, which
  [part 3](https://jbrowse.org/jb2/docs/tutorials/pangenome_hprc_repeats#amylase) opens, draw the same
  haplotype as a row with no step on the reference. At IGH, IGK and IGL such a
  row is often the cell line's deletion, as
  [part 1's limits](https://jbrowse.org/jb2/docs/tutorials/pangenome_hprc#limits) explain.
- **A lane can stop partway**, at the end of the graph's alignment of that
  haplotype; its sequence can run on past it.
- **One lane covers many haplotypes.** The page groups haplotypes into
  structural forms by their structural variants of 50 bp or more, so two
  haplotypes in one form can still differ in everything smaller.
- **Near-identical gene copies share one path**, so where the graph merges the
  copies, as at SMN1 / SMN2, a lane cannot show how many copies a haplotype has.

**Lanes → Choose lanes...** picks lanes by name, for a haplotype the launch did
not place in a lane. At IGL, from any **Haplotypes** launch, type
`chr22:22,800,001-22,850,000` and choose `HG00099.1`, `HG002.1`, `HG00097.1`,
`HG002.2` and `HG01074.1`, which puts two such rows at the foot.

<Figure caption="IGL in five lanes. HG002 haplotype 2 and HG01074 haplotype 1 have no step on the reference across the window, so their rows at the foot draw no ribbons and are headed with the length of the stretch. HG002 haplotype 1's lane spans the window but shows only MIR650 and IGLV3-7, since its Liftoff annotation leaves out functional V segments." src="/img/pangenome/hprc_igl_deletion_lanes.png" />

Session spec, on config <https://jbrowse.org/pangenome/hprc-grch38/config.json>:

```json
{
  "views": [
    {
      "type": "LinearGenomeView",
      "assembly": "hg38",
      "loc": "chr22:22800001-22850000",
      "tracks": [
        {
          "trackId": "hg38_ncbiRefSeq_ucsc",
          "geneGlyphMode": "representative",
          "displayMode": "compact",
          "height": 60
        },
        {
          "trackId": "hprc_v2_1_walk_lanes",
          "type": "MultiWaySyntenyDisplay",
          "rows": {
            "sort": [
              "HG00099#1",
              "HG002#1",
              "HG00097#1",
              "HG002#2",
              "HG01074#1"
            ],
            "kept": [
              "HG00099#1",
              "HG002#1",
              "HG00097#1",
              "HG002#2",
              "HG01074#1"
            ]
          },
          "height": 306
        }
      ]
    }
  ]
}
```

## Configuring the haplotype lanes track

One track draws the lanes, reading each haplotype's walk from indexed files we
built from the release's graph. The HPRC page's **Haplotypes** launch adds it,
and the config below is the one to adapt for your own graph:

- **A lane** is one haplotype's walk, which lists in order the nodes that
  haplotype passes through.
- **`assemblyNames`** starts with the anchor, the assembly the walk file's
  reference is loaded as. A haplotype needs no entry: JBrowse draws its lane on
  the assembly whose `sample#haplotype` alias matches it (`HG00097.1` is aliased
  `HG00097#1`), which
  [one assembly entry](https://jbrowse.org/jb2/docs/tutorials/pangenome_hprc#opening-the-haplotype-an-allele-came-from)
  declares, and draws a lane for a haplotype with no assembly too.
- **`assemblyNameToPanSN`** names the walk of an assembly with no such alias,
  here GRCh38's.
- The walk files for a graph of your own come from
  [Hosting your own graph](https://jbrowse.org/jb2/docs/tutorials/pangenome_prepare_graph#haplotype-walks-tabix).

```json
{
  "type": "GraphTrack",
  "trackId": "hprc_v2_1_walk_lanes",
  "name": "HPRC v2.1 haplotypes vs GRCh38, read from the walk files",
  "assemblyNames": ["hg38", "HG00097.1", "HG00099.1"],
  "adapter": {
    "type": "WalkTabixSyntenyAdapter",
    "walksUri": "https://jbrowse.org/demos/hprc/hprc-v2.1-mc-grch38.GRCh38",
    "assemblyNames": ["hg38"],
    "assemblyNameToPanSN": { "hg38": "GRCh38#0" }
  },
  "displays": [
    { "type": "MultiWaySyntenyDisplay", "height": 600 },
    { "type": "LinearGraphDisplay" }
  ]
}
```

CLI:

```bash
jbrowse add-track-json '{
  "type": "GraphTrack",
  "trackId": "hprc_v2_1_walk_lanes",
  "name": "HPRC v2.1 haplotypes vs GRCh38, read from the walk files",
  "assemblyNames": ["hg38", "HG00097.1", "HG00099.1"],
  "adapter": {
    "type": "WalkTabixSyntenyAdapter",
    "walksUri": "https://jbrowse.org/demos/hprc/hprc-v2.1-mc-grch38.GRCh38",
    "assemblyNames": ["hg38"],
    "assemblyNameToPanSN": { "hg38": "GRCh38#0" }
  },
  "displays": [
    { "type": "MultiWaySyntenyDisplay", "height": 600 },
    { "type": "LinearGraphDisplay" }
  ]
}'
```

## Reproduce it end to end

[Indexing haplotype walks](https://jbrowse.org/jb2/docs/tutorials/pangenome_prepare_graph#haplotype-walks-tabix)
builds the walk files the lanes read, with one command on the release's GFA, and
[README.txt](https://jbrowse.org/demos/hprc/README.txt) beside the hosted files
records their provenance. The same page converts the walks to PAF for a
whole-genome synteny view.

## See also

- **Tutorial:** [](https://jbrowse.org/jb2/docs/tutorials/pangenome_hprc)
- **Tutorial:** [Pangenome (HPRC) part 3: repeat lengths across haplotypes](https://jbrowse.org/jb2/docs/tutorials/pangenome_hprc_repeats)
- **Tutorial:** [Pangenome (hosting your own graph)](https://jbrowse.org/jb2/docs/tutorials/pangenome_prepare_graph)
- **Tutorial:** [Comparing one genome's two haplotypes (T2T-HG002)](https://jbrowse.org/jb2/docs/tutorials/hg002_haplotypes)
- **Tutorial:** [Synteny visualization (all-vs-all minimap2)](https://jbrowse.org/jb2/docs/tutorials/allvsall_synteny)
- **Config guide:** [Grouping and lane order](https://jbrowse.org/jb2/docs/config_guides/grouping_and_ordering)
- [BandageJS](https://jbrowse.org/demos/bandagejs/)

## External links

- Li H. [gfatools](https://github.com/lh3/gfatools), whose `bubble` subcommand
  flags the inversion.
- [gfa-to-tabix](https://github.com/GMOD/gfa-to-tabix/blob/main/docs/walks-format.md),
  which files each haplotype's walk under the reference so a window is one range
  request.
- [ggbandage](https://github.com/GMOD/ggbandage), which draws
  [RHD and CYP2D6 deletions](https://github.com/GMOD/ggbandage/blob/main/docs/gallery.md#rhd-and-cyp2d6-gene-deletions-as-arches)
  as arches over GRCh38 in ggplot2.
- [ggtubemap](https://github.com/GMOD/ggtubemap), which draws haplotypes against
  each other as a tube map in ggplot2,
  [colored by phase](https://github.com/GMOD/ggtubemap#colour-by-anything).

## Citations

- [HPRC release 2](https://doi.org/10.64898/2026.07.21.739710), the release
  whose graph, assemblies and CAT annotations this page reads.
- Hughes et al. (2006).
  [A common CFH haplotype, with deletion of CFHR1 and CFHR3, is associated with lower risk of age-related macular degeneration](https://doi.org/10.1038/ng1890)
- Small et al. (1997).
  [Emerin deletion reveals a common X-chromosome inversion mediated by inverted repeats](https://doi.org/10.1038/ng0597-96)

