Pangenome (HPRC) part 1: the graph's alleles and the haplotypes that have them
The tutorials target the JBrowse v5 beta, and the v4.3.0 release
on the download page 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.20. Desktop beta builds for Linux and
macOS are on the releases page;
the Windows build waits on code signing.
The Human Pangenome Reference Consortium's release 2 builds 464 human haplotypes into a pangenome graph; the phased VCF used here lists 462 of them. Where the haplotypes differ, the graph forms a bubble, and each route through a bubble is an allele. HPRC writes each haplotype's route through every bubble as a phased VCF, so a record lists which haplotypes have which allele. We open the graph and the VCF from the HPRC page on genomes.jbrowse.org as tracks of a linear view of GRCh38, at the complement genes C4 and beside HLA-DRB5 in MHC class II. We:
- launch tracks from the HPRC page, and open a whole chromosome as a graph track with one node per bubble
- open C4 as a force-directed graph track and name its backbone, bubbles and alleles
- open the assembly an allele beside HLA-DRB5 came from with Open in
- load the phased VCF as a variant track with one row per haplotype, and cluster the rows
- load HPRC's multiple alignment as a MAF track at C4
The graph view is a beta plugin, and the HPRC page launches it on the JBrowse 5 development build until JBrowse 5 ships. We welcome your feedback.
The graph and the page also leave real variation out, at some of the best-known loci in the genome. Read what they do not show before trusting an empty or simple picture.
Prerequisites
- the GraphGenomeView plugin. In your own JBrowse, install it from the plugin store; every launch from the HPRC page already loads it
- for the alignment on your own data: taffy
The data
Nothing to download: the HPRC page's launches read the files of HPRC release 2, and our tabix index of its graph, by URL. Hosting your own graph builds the same files for a graph of your own.
The files
| What it is | File |
|---|---|
The structural-variant graph (sv.gfa) the index files are cut from | hprc-v2.1-mc-grch38.sv.gfa.gz |
| The phased VCF, one record per allele, 462 haplotypes | hprc-v2.1-mc-grch38.pgbi.vcf.gz |
| The multiple alignment of every haplotype against GRCh38 | hprc-v2.1-mc-grch38.full.maf.gz |
Launching tracks from the HPRC page
Open the HPRC page, which opens
on its first example. Click another Examples entry, or type a gene symbol or
a region such as chr6:32,510,001-32,600,000 into the Gene or region box
and press Show. The page draws a map of the window: GRCh38's genes, then one
row per structural form the haplotypes fall into, commonest first, each with its
share of the haplotypes aligned there.
Open in JBrowse opens the window in a JBrowse tab. Clicking a row draws that form's largest change as a graph under the map, cut from the graph's haplotype walks, and the button then opens that form's haplotype as a lane. More about this window unfolds a table of each change with its carriers, and every launch:
- Graph: the region drawn as a graph, with the structural variants each haplotype has under it
- Variants: the structural variants each haplotype has, over the genes
- Haplotypes: a lane for each structural form, commonest first, and more lanes for the forms more haplotypes carry
- BandageJS: the same haplotypes' walks in BandageJS
A window up to 150 kb wide adds two rows under the genes in every launch: the
known alleles in it, and the
GWAS Catalog's hits. A window over 150 kb offers
the graph alone. The page keeps the window in its address, so a link such as
?region=chr6:32,510,001-32,600,000
opens the same map.
A known allele: CFHR3–CFHR1
Some windows hold an allele with a published story. Click the CFH / CFHR example. Above the map, the page names the CFHR3–CFHR1 deletion, says what it does, counts its carriers in the panel and cites Hughes et al. 2006, who tied it to a lower risk of age-related macular degeneration. The map calls the change by the same name.
Press Open in JBrowse. Under the genes:
- Known alleles spans the deletion and names it
- GWAS Catalog (NHGRI-EBI) marks the trait associations in the window. Click a hit for its trait, paper and p-value; the two advanced age-related macular degeneration hits sit one on either side of the deletion
- the matrix under the graph marks the deletion in each carrier's row
Overview of chr1 with one node per variant region
Open
chr1 on the HPRC page
and press Open in JBrowse. Zoomed out past the graph adapter's coarse
level, JBrowse draws one node per bubble, so the whole chromosome fits. A curve
of segments per bubble (how many pieces of sequence each bubble holds) shows how
much the haplotypes disagree at each locus.
Hosting your own graph builds this
overview and writes the coarse slot.
The C4 locus as a graph
Click the HLA / MHC example on the HPRC page, then Open in JBrowse. The Graph launch opens genes, the GWAS Catalog's hits, the graph in the force-directed layout, and under it a matrix of the structural variants each haplotype has, one row per haplotype. Then:
- Hide the GWAS Catalog and the variant matrix in the track selector, leaving the genes over the graph.
- Type
C4Ain the location box, pick the chr6 hit, and zoom out twice to take in C4B.
The graph has four kinds of object:
- the backbone is GRCh38's path, colored red to magenta by reference position
- a bubble is a place where haplotypes disagree
- an allele is a haplotype's sequence in place of the reference, drawn in charcoal because the reference path does not visit it
- an edge that skips sequence is a deletion, drawn as a dashed arc
Opening the haplotype the HLA-DRB5 allele came from
Type chr6:32,500,000-32,560,000, a window in MHC class II, a cluster of
immune-system HLA genes. Beside HLA-DRB5, a charcoal node is an allele much
shorter than the backbone stretch it hangs across. Left-click it. Its details
give contributingHaplotype, NA20809#2: the graph's SN tag records which
assembly minigraph first took the allele from.
Open in appears when the session has an assembly named or aliased
sample#haplotype, the graph's name for it. The launch's config declares every
release 2 haplotype that way. To declare one, load its contig sizes (or FASTA)
under a display name, with the graph's name as an alias:
Goes in the assemblies array of config.json. See Assemblies.
{
"name": "NA20809.2",
"aliases": ["NA20809#2"],
"uri": "https://jbrowse.org/pangenome/hprc-grch38/NA20809.2.chrom.sizes"
}jbrowse add-assembly https://jbrowse.org/pangenome/hprc-grch38/NA20809.2.chrom.sizes \
--name NA20809.2 \
--alias "NA20809#2"Right-click the allele and take Open in NA20809.2. A second linear view opens below the first, on that haplotype's chromosome 6, framed on the allele with its CAT (Comparative Annotation Toolkit) gene annotation, which part 2 describes. Zoom out a few steps.
The haplotype's CAT annotation has HLA-DRB9 and HLA-DRB6 either side of the allele and no HLA-DRB5, the gene it hangs across on hg38.
Listing every haplotype with the HLA-DRB5 allele
The graph names one source assembly per allele. HPRC's phased VCF lists every haplotype's allele at every bubble: a record is one allele written against GRCh38, and each sample's genotype holds a 1 for each of its haplotypes with that allele. We'll add it to the graph launch's session:
Goes in the tracks array of config.json. See Tracks.
{
"type": "VariantTrack",
"trackId": "hprc2_pgbi_grch38",
"name": "HPRC release 2 phased VCF, one record per allele (462 haplotypes)",
"assemblyNames": ["hg38"],
"adapter": {
"type": "VcfTabixAdapter",
"uri": "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.pgbi.vcf.gz",
"fetchSizeLimit": 20000000
},
"displays": [
{
"type": "LinearVariantDisplay",
"rows": "haplotype",
"filter": ["jexl:alleleLength(feature)>=50"]
}
]
}jbrowse add-track-json '{
"type": "VariantTrack",
"trackId": "hprc2_pgbi_grch38",
"name": "HPRC release 2 phased VCF, one record per allele (462 haplotypes)",
"assemblyNames": ["hg38"],
"adapter": {
"type": "VcfTabixAdapter",
"uri": "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.pgbi.vcf.gz",
"fetchSizeLimit": 20000000
},
"displays": [
{
"type": "LinearVariantDisplay",
"rows": "haplotype",
"filter": ["jexl:alleleLength(feature)>=50"]
}
]
}'In JBrowse Desktop, or in any running JBrowse Web session, open a view on this track’s assembly, then File → Open track..., choose Add track from pasted JSON, and paste:
{
"type": "VariantTrack",
"trackId": "hprc2_pgbi_grch38",
"name": "HPRC release 2 phased VCF, one record per allele (462 haplotypes)",
"assemblyNames": ["hg38"],
"adapter": {
"type": "VcfTabixAdapter",
"uri": "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.pgbi.vcf.gz",
"fetchSizeLimit": 20000000
},
"displays": [
{
"type": "LinearVariantDisplay",
"rows": "haplotype",
"filter": ["jexl:alleleLength(feature)>=50"]
}
]
}Open this track in JBrowse Web ↗
Needs JBrowse Desktop 5.0 or newer. If nothing opens, copy the link and paste it into Desktop's Open JBrowse Web link..., on the start screen or under File → Session.
https://jbrowse.org/code/jb2/main/?config=https%3A%2F%2Fjbrowse.org%2Fucsc%2Fhg38%2Fconfig.json&session=spec-%7B%22sessionTracks%22%3A%5B%7B%22type%22%3A%22VariantTrack%22%2C%22trackId%22%3A%22hprc2_pgbi_grch38%22%2C%22name%22%3A%22HPRC+release+2+phased+VCF%2C+one+record+per+allele+%28462+haplotypes%29%22%2C%22assemblyNames%22%3A%5B%22hg38%22%5D%2C%22adapter%22%3A%7B%22type%22%3A%22VcfTabixAdapter%22%2C%22uri%22%3A%22https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fhuman-pangenomics%2Fpangenomes%2Ffreeze%2Frelease2%2Fminigraph-cactus%2Fv2.1%2Fhprc-v2.1-mc-grch38%2Fhprc-v2.1-mc-grch38.pgbi.vcf.gz%22%2C%22fetchSizeLimit%22%3A20000000%7D%2C%22displays%22%3A%5B%7B%22type%22%3A%22LinearVariantDisplay%22%2C%22rows%22%3A%22haplotype%22%2C%22filter%22%3A%5B%22jexl%3AalleleLength%28feature%29%3E%3D50%22%5D%7D%5D%7D%5D%2C%22views%22%3A%5B%7B%22type%22%3A%22LinearGenomeView%22%2C%22assembly%22%3A%22hg38%22%2C%22loc%22%3A%22chr6%3A32%2C500%2C000-32%2C560%2C000%22%2C%22tracks%22%3A%5B%22hprc2_pgbi_grch38%22%5D%7D%5D%7D&sessionName=JBrowse+docs%3A+HPRC+release+2+phased+VCF%2C+one+record+per+allele+%28462+haplotypes%29rows: "haplotype"draws one row per haplotype, named<sample> HP1,<sample> HP2.filterdrops records, andalleleLength(feature)>=50keeps alleles of 50 bp and up, the size of the bubbles minigraph draws.alleleLengthis the length of the record's longest allele, so it counts an insertion's inserted bases.fetchSizeLimitraises the download cap past its default. The VCF spells out each inserted allele, which puts the MHC class II window over the default.- Filter by → Edit filters... in the track menu shows the filter and changes it.
- Advanced → Edit plot... in the track menu shows
rowsandfilteras text and applies edits live.
Take Clustering → Cluster rows by genotype... in the track menu and press Run clustering. The rows reorder so haplotypes with the same alleles sit together, with a dendrogram beside them.
Right-click the charcoal allele beside HLA-DRB5 in the force-directed graph and take Highlight in hg38: a band marks the span of GRCh38 it replaces, which covers most of HLA-DRB5.
The VCF holds the HLA-DRB5 allele as several records, one for each of its sequences, which differ by a base or two. The blue block under the band is the haplotypes with any of the four, plus a smaller block with an 86 kb deletion that removes the whole stretch.
Reading C4's alleles as aligned bases
HPRC also publishes its alignment as hprc-v2.1-mc-grch38.full.maf.gz, a
multiple alignment with one row of bases per haplotype. A .tai index beside
the large file makes a locus one ranged read:
Goes in the tracks array of config.json. See Tracks.
{
"type": "MafTrack",
"trackId": "hprc_v2_1_mc_grch38",
"name": "HPRC release 2 pangenome alignment (464 haplotypes)",
"assemblyNames": ["hg38"],
"adapter": {
"type": "BgzipMafAdapter",
"uri": "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.full.maf.gz"
}
}jbrowse add-track-json '{
"type": "MafTrack",
"trackId": "hprc_v2_1_mc_grch38",
"name": "HPRC release 2 pangenome alignment (464 haplotypes)",
"assemblyNames": ["hg38"],
"adapter": {
"type": "BgzipMafAdapter",
"uri": "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.full.maf.gz"
}
}'In JBrowse Desktop, or in any running JBrowse Web session, open a view on this track’s assembly, then File → Open track..., choose Add track from pasted JSON, and paste:
{
"type": "MafTrack",
"trackId": "hprc_v2_1_mc_grch38",
"name": "HPRC release 2 pangenome alignment (464 haplotypes)",
"assemblyNames": ["hg38"],
"adapter": {
"type": "BgzipMafAdapter",
"uri": "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.full.maf.gz"
}
}Open this track in JBrowse Web ↗
Needs JBrowse Desktop 5.0 or newer. If nothing opens, copy the link and paste it into Desktop's Open JBrowse Web link..., on the start screen or under File → Session.
https://jbrowse.org/code/jb2/main/?config=https%3A%2F%2Fjbrowse.org%2Fucsc%2Fhg38%2Fconfig.json&session=spec-%7B%22sessionTracks%22%3A%5B%7B%22type%22%3A%22MafTrack%22%2C%22trackId%22%3A%22hprc_v2_1_mc_grch38%22%2C%22name%22%3A%22HPRC+release+2+pangenome+alignment+%28464+haplotypes%29%22%2C%22assemblyNames%22%3A%5B%22hg38%22%5D%2C%22adapter%22%3A%7B%22type%22%3A%22BgzipMafAdapter%22%2C%22uri%22%3A%22https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fhuman-pangenomics%2Fpangenomes%2Ffreeze%2Frelease2%2Fminigraph-cactus%2Fv2.1%2Fhprc-v2.1-mc-grch38%2Fhprc-v2.1-mc-grch38.full.maf.gz%22%7D%7D%5D%2C%22views%22%3A%5B%7B%22type%22%3A%22LinearGenomeView%22%2C%22assembly%22%3A%22hg38%22%2C%22loc%22%3A%22chr6%3A31%2C980%2C000-32%2C050%2C000%22%2C%22tracks%22%3A%5B%22hprc_v2_1_mc_grch38%22%5D%7D%5D%7D&sessionName=JBrowse+docs%3A+HPRC+release+2+pangenome+alignment+%28464+haplotypes%29The uri shorthand resolves the sibling .tai. For a MAF of your own, taffy
writes the index beside it:
# writes alignment.maf.gz.tai, which the adapter finds by its name
taffy index -i alignment.maf.gzGo back to the C4 window, chr6:31,980,000-32,050,000, with the genes, the VCF
and this alignment over the graph track. A white stretch in an alignment row is
sequence that haplotype lacks. Then:
- Clustering → Cluster rows by genotype... on the VCF orders its rows.
- Clustering → Cluster rows by identity... on the alignment clusters over the window in view, because HPRC's file ships no guide tree.
- Reset row order restores the order in the file.
The VCF's widest blue block is one record, a deletion of a whole C4-CYP21-TNX module, which is the dashed arc in the C4 graph. Every alignment row in the white block has that deletion in the VCF. The narrower blocks are haplotypes that lack the 6.4 kb HERV-K (endogenous retrovirus) in a C4 gene's intron, which GRCh38 carries: the difference between a long and a short C4.
What the graph and the page do not show
The HPRC page's examples are loci where at least one launch draws something readable. At a locus of your own, a picture that looks simple or empty can mislead in these cases:
- Near-identical duplications draw as a single thread. The graph puts the copies of SMN1 / SMN2, SRGAP2 and the 8p23.1 beta-defensin cluster on one path, so those examples offer no Graph launch. A gene-level graph shows copy number there.
- The graph does not align every haplotype everywhere. A haplotype the graph does not align across a window gets no lane, and the page counts them. At FLNA / EMD those are the haplotypes without an X chromosome; elsewhere the sequence exists in the assembly and the graph leaves it out.
- The VCF has no record for the largest events. HPRC drops the biggest sites from the VCF and keeps the smaller sites nested inside them, so the Variants launch cannot show the UGT2B17 deletion. The page's map reads each haplotype's forms from the graph itself, so it draws the deletion and names it.
- The antibody loci hold the cell lines' deletions. Many HPRC assemblies come from lymphoblastoid cell lines, B cells whose V(D)J recombination deletes hundreds of kb of IGH, IGK and IGL (Rodriguez et al. 2021, IGLoo for IGH). In the walk file the lanes read, many haplotypes jump over chunks of IGH and IGK, fewer over IGL, and none over the T-cell receptor loci TRA and TRB. Check a deletion there against the donor's germline data before reporting it.
- A typed locus is checked for structure only. The page reads the window you type, and where the haplotypes share one structure it says so, as do the Graph and Variants launches. A window can still land where the graph merges duplicated copies into one thread or the VCF has no record, and the page offers the launch anyway.
- No single launch shows the whole locus. The graph shows which sequence exists, the VCF which haplotypes have it, and the lanes how a few haplotypes are arranged.
Reproduce it end to end
Hosting your own graph builds the
index files and the bubbles track in one command that runs on any rGFA. Run on
hprc-v2.1-mc-grch38.sv.gfa.gz, it writes the files we host, and
README.txt beside them records
their provenance. For a graph of your own, minigraph can list each assembly's
route through every bubble; see
Which haplotypes pass through each segment.
See also
- Tutorial: Pangenome (HPRC) part 2: haplotypes against each other
- Tutorial: Pangenome (HPRC) part 3: repeat lengths across haplotypes
- Tutorial: Pangenome (hosting your own graph)
- Tutorial: Pangenome (mouse)
- Tutorial: Pangenome (cattle)
- User guide: Graph genome view
- User guide: Variant sample rows
- User guide: MAF track
- BandageJS
External links
- Li H.
The rGFA format and
gfatools, which define the
SN/SO/SRtags this page opens the graph by, and whosebubblesubcommand calls the bubbles it reads. - taffy, which writes the
.taiindex that makes the alignment addressable by locus. - ggbandage, which draws the C4 graph from the same hosted files as ggplot2 layers in R.
- ggtubemap, which draws HLA-A's haplotypes as a tube map in ggplot2.
Citations
- HPRC release 2, the release this
page opens: the Minigraph-Cactus graph, the multiple alignment and the VCFs
vg deconstructwrites from the graph.
Feedback on this tutorial is welcome: contact us.