Pangenome (HPRC) part 5, repeat lengths across haplotypes
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.8. Desktop beta builds are coming soon.
A tandem repeat can be many times longer in one person than in the reference, and the long alleles are the ones association studies care about. An intron of ABCA7 holds a variable number tandem repeat whose expansions were tied to Alzheimer's disease risk (De Roeck et al. 2018). Genotyping it from reads needs reads that span the whole allele, which gets harder the longer the allele is. We draw the repeat once per haplotype from the Human Pangenome Reference Consortium's release 2 graph, where each haplotype is an assembled sequence, set the TRGT genotypes PacBio called from HiFi reads of the same samples on the same bars, and look at the samples where the two disagree. Part 3 set up the graph track this page cuts from.
The graph view is a beta plugin, and walk rows is its newest layout. We welcome your feedback.
Prerequisites
- part 3, for the
hprc_v2_1_gbz_lanestrack - the GraphGenomeView plugin
Where the data comes from
HPRC release 2 and PacBio's TRGT genotypes of 100 of its samples (Dolzhenko et al. 2024):
- the release 2.1 gbz-base database, read by range request: 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.gbz.db
- TRGT's genotypes over the Genome in a Bottle repeat catalogue, a TRGTdb: https://zenodo.org/records/8329210/files/adotto_hprc.tdb.tar
- the catalogue itself: https://zenodo.org/records/8329210/files/adotto_repeats.hg38.bed.gz
- the ABCA7 record of those genotypes, as a TRGT VCF: https://jbrowse.org/demos/hprc/hprc_abca7_trgt.vcf.gz
The TRGT genotypes
TRGT genotypes tandem repeats from
HiFi reads against a catalogue of repeat loci, and writes a VCF whose MOTIFS
field gives each locus its repeat unit and whose AL field gives each sample's
two allele lengths. PacBio published TRGT's calls for 100 HPRC samples over the
Genome in a Bottle repeat catalogue. We host the record for the ABCA7 locus as
a VCF in TRGT's own format. Add it:
{
"type": "VariantTrack",
"trackId": "hprc_abca7_trgt",
"name": "TRGT repeat genotypes at ABCA7, 100 HPRC samples",
"assemblyNames": ["hg38"],
"adapter": {
"type": "VcfTabixAdapter",
"uri": "https://jbrowse.org/demos/hprc/hprc_abca7_trgt.vcf.gz"
}
}
jbrowse add-track https://jbrowse.org/demos/hprc/hprc_abca7_trgt.vcf.gz \
--trackId hprc_abca7_trgt \
--name "TRGT repeat genotypes at ABCA7, 100 HPRC samples" \
--assemblyNames hg38
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": "hprc_abca7_trgt",
"name": "TRGT repeat genotypes at ABCA7, 100 HPRC samples",
"assemblyNames": ["hg38"],
"adapter": {
"type": "VcfTabixAdapter",
"uri": "https://jbrowse.org/demos/hprc/hprc_abca7_trgt.vcf.gz"
}
}
Its one record spans chr19:1,049,408-1,050,096 and names a 51 bp motif. TRGT
writes the same fields for your own samples, one VCF each, which trgt merge
joins:
# one run per sample: HiFi reads aligned to GRCh38, and the repeat catalogue
trgt genotype --genome GRCh38.fa --reads sample.bam \
--repeats adotto_repeats.hg38.bed --output-prefix sample
# one multi-sample VCF, which the steps below read unchanged
trgt merge --vcf *.vcf.gz --genome GRCh38.fa --output-type z --output merged.vcf.gz
Every haplotype's walk through the repeat
The session below opens ABCA7 with the TRGT track and the catalogue's own row
for the VNTR, carried inline as a session track, and under them a graph view cut
from hprc_v2_1_gbz_lanes over the same window for every haplotype the graph
holds, drawn in Walk rows from the Layout dropdown with Uniform from
the Color dropdown:
{
"defaultSession": {
"name": "ABCA7 VNTR, walk rows",
"sessionTracks": [
{
"type": "FeatureTrack",
"trackId": "abca7_vntr",
"name": "Tandem repeat catalogue (adotto)",
"assemblyNames": ["hg38"],
"adapter": {
"type": "FromConfigAdapter",
"features": [
{
"uniqueId": "abca7_vntr",
"refName": "chr19",
"start": 1049407,
"end": 1050096,
"name": "ABCA7 VNTR"
}
]
}
}
],
"views": [
{
"type": "LinearGenomeView",
"assembly": "hg38",
"loc": "chr19:1,049,000-1,050,500",
"tracks": [
{
"trackId": "hg38_ncbiRefSeq_ucsc",
"type": "LinearBasicDisplay",
"showOnlyGenes": true,
"displayMode": "compact",
"height": 40
},
{
"trackId": "abca7_vntr",
"type": "LinearBasicDisplay",
"height": 40
},
{
"trackId": "hprc_abca7_trgt",
"type": "LinearVariantDisplay",
"height": 40
}
]
},
{
"type": "GraphGenomeView",
"loadedTrackId": "hprc_v2_1_gbz_lanes",
"loadedRegion": {
"refName": "chr19",
"assemblyName": "hg38",
"start": 1049407,
"end": 1050096
},
"layoutMode": "walkrows",
"colorScheme": "uniform",
"paneHeight": 600
}
]
}
}
jbrowse set-default-session --session - << 'EOF'
{
"name": "ABCA7 VNTR, walk rows",
"sessionTracks": [
{
"type": "FeatureTrack",
"trackId": "abca7_vntr",
"name": "Tandem repeat catalogue (adotto)",
"assemblyNames": ["hg38"],
"adapter": {
"type": "FromConfigAdapter",
"features": [
{
"uniqueId": "abca7_vntr",
"refName": "chr19",
"start": 1049407,
"end": 1050096,
"name": "ABCA7 VNTR"
}
]
}
}
],
"views": [
{
"type": "LinearGenomeView",
"assembly": "hg38",
"loc": "chr19:1,049,000-1,050,500",
"tracks": [
{
"trackId": "hg38_ncbiRefSeq_ucsc",
"type": "LinearBasicDisplay",
"showOnlyGenes": true,
"displayMode": "compact",
"height": 40
},
{
"trackId": "abca7_vntr",
"type": "LinearBasicDisplay",
"height": 40
},
{
"trackId": "hprc_abca7_trgt",
"type": "LinearVariantDisplay",
"height": 40
}
]
},
{
"type": "GraphGenomeView",
"loadedTrackId": "hprc_v2_1_gbz_lanes",
"loadedRegion": {
"refName": "chr19",
"assemblyName": "hg38",
"start": 1049407,
"end": 1050096
},
"layoutMode": "walkrows",
"colorScheme": "uniform",
"paneHeight": 600
}
]
}
EOF
Each row is one haplotype's walk between the reference nodes flanking the window, drawn on its own bp axis: blue where GRCh38 carries the same sequence, purple where it does not. GRCh38's own walk is the short bar at the top, the span the catalogue lane marks.
TRGT's calls on the same bars
With the TRGT track in the session, a Repeat dropdown appears beside Walk. Pick the ABCA7 record. The bars now start and end at the record's flanks and are divided into motif-length units, and each readout gives its copy count. The record also carries each sample's genotype, so each walk gets a black tick at the allele TRGT called for it. A VCF lists a sample's alleles in the genotype's order, which is the genotyper's own and says nothing about which assembled haplotype is which, so the walks and the alleles are paired by length. A readout turns red where its walk and its allele are more than 10% apart.
The samples where they disagree
The rows run longest first, so a sample's two haplotypes land far apart. The
session below keeps the whole cut and shows seven samples' walks in pairs, named
in walkRowSamples: three where the calls land on both walks, two where reads
and assemblies part, and two carrying a walk the view declines to score.
{
"defaultSession": {
"name": "ABCA7 VNTR, where reads and assemblies disagree",
"sessionTracks": [
{
"type": "FeatureTrack",
"trackId": "abca7_vntr",
"name": "Tandem repeat catalogue (adotto)",
"assemblyNames": ["hg38"],
"adapter": {
"type": "FromConfigAdapter",
"features": [
{
"uniqueId": "abca7_vntr",
"refName": "chr19",
"start": 1049407,
"end": 1050096,
"name": "ABCA7 VNTR"
}
]
}
}
],
"views": [
{
"type": "LinearGenomeView",
"assembly": "hg38",
"loc": "chr19:1,049,000-1,050,500",
"tracks": [
{
"trackId": "abca7_vntr",
"type": "LinearBasicDisplay",
"height": 40
},
{
"trackId": "hprc_abca7_trgt",
"type": "LinearVariantDisplay",
"height": 40
}
]
},
{
"type": "GraphGenomeView",
"loadedTrackId": "hprc_v2_1_gbz_lanes",
"loadedRegion": {
"refName": "chr19",
"assemblyName": "hg38",
"start": 1049407,
"end": 1050096
},
"layoutMode": "walkrows",
"colorScheme": "uniform",
"repeatTrackId": "hprc_abca7_trgt",
"repeatKey": "chr19:1049406-1050096",
"walkRowSamples": [
"HG00099",
"HG03688",
"HG00741",
"HG02647",
"HG01943",
"HG02559",
"HG04199"
],
"paneHeight": 360
}
]
}
}
jbrowse set-default-session --session - << 'EOF'
{
"name": "ABCA7 VNTR, where reads and assemblies disagree",
"sessionTracks": [
{
"type": "FeatureTrack",
"trackId": "abca7_vntr",
"name": "Tandem repeat catalogue (adotto)",
"assemblyNames": ["hg38"],
"adapter": {
"type": "FromConfigAdapter",
"features": [
{
"uniqueId": "abca7_vntr",
"refName": "chr19",
"start": 1049407,
"end": 1050096,
"name": "ABCA7 VNTR"
}
]
}
}
],
"views": [
{
"type": "LinearGenomeView",
"assembly": "hg38",
"loc": "chr19:1,049,000-1,050,500",
"tracks": [
{
"trackId": "abca7_vntr",
"type": "LinearBasicDisplay",
"height": 40
},
{
"trackId": "hprc_abca7_trgt",
"type": "LinearVariantDisplay",
"height": 40
}
]
},
{
"type": "GraphGenomeView",
"loadedTrackId": "hprc_v2_1_gbz_lanes",
"loadedRegion": {
"refName": "chr19",
"assemblyName": "hg38",
"start": 1049407,
"end": 1050096
},
"layoutMode": "walkrows",
"colorScheme": "uniform",
"repeatTrackId": "hprc_abca7_trgt",
"repeatKey": "chr19:1049406-1050096",
"walkRowSamples": [
"HG00099",
"HG03688",
"HG00741",
"HG02647",
"HG01943",
"HG02559",
"HG04199"
],
"paneHeight": 360
}
]
}
EOF
HG00099, HG03688 and HG00741 carry a tick at the end of each bar. Reads and assemblies agree on both haplotypes there, across a sample whose two alleles lie far apart, one whose two are both long, and one whose two are both short.
HG02647 and HG01943 are where reads and assemblies part. TRGT called each of them close to homozygous, with reads spanning both alleles, and the graph carries a haplotype neither call reaches — in HG01943 it carries two — so those readouts turn red.
The last two samples each carry a walk the view leaves unscored, because one side of that comparison is not a measurement. No read spanned HG02559's second allele, so TRGT reported the first one twice; the copy lands on the sample's long walk as a grey tick and says nothing about it. HG04199's second walk is partial — that assembly does not span the repeat — and TRGT's long allele sits far past where the bar stops, so here it is the graph that may be missing an allele.
Check it against TRGT's genotypes
Click the TRGT record in the linear view. Its sample table gives each sample's
AL, the allele lengths the ticks are drawn from, and SD, the reads spanning
each allele. HG02559's second allele has no spanning read at all, so its tick is
grey: TRGT's second call copies the first, and the walk it landed on takes no
verdict.
Reproduce it end to end
curl -fO https://raw.githubusercontent.com/GMOD/jbrowse-components/main/scripts/build_hprc_abca7_trgt.sh
bash build_hprc_abca7_trgt.sh # writes ./hprc_abca7_trgt_build/
The TRGTdb is a directory of Parquet tables, one per sample beside a table of loci and one of alleles, so DuckDB reads a locus's calls straight out of it:
# every sample's allele numbers and spanning-read counts at one locus
duckdb -json -c "
select regexp_extract(filename, 'sample\.(.*)\.pq', 1) as sample,
allele_number, spanning_reads
from read_parquet('hprc_100.tdb/sample.*.pq', filename = true)
where LocusID = (select LocusID from read_parquet('hprc_100.tdb/locus.pq')
where chrom = 'chr19' and start = 1049407)"
build_hprc_abca7_trgt.sh
downloads PacBio's TRGT database (1.1 GB) and the repeat catalogue, and writes
the ABCA7 record with every sample's genotype.
See also
- Pangenome (HPRC) part 3, every haplotype in its own coordinates
- Pangenome (HPRC) part 4, the graph as the picture
References
- De Roeck A, Duchateau L, Van Dongen J, et al. An intronic VNTR affects splicing of ABCA7 and increases risk of Alzheimer's disease. Acta Neuropathol. 2018;135(6):827-837. https://doi.org/10.1007/s00401-018-1841-z
- Dolzhenko E, English A, Dashnow H, et al. Characterization and visualization of tandem repeats at genome scale. Nat Biotechnol. 2024;42(10):1606-1614. https://doi.org/10.1038/s41587-023-02057-3
- TRGT repeat catalogues and HPRC genotypes, Zenodo. https://doi.org/10.5281/zenodo.8329210
- Liao WW, Asri M, Ebler J, et al. A draft human pangenome reference. Nature. 2023;617(7960):312-324. https://doi.org/10.1038/s41586-023-05896-x
- HPRC release 2
Feedback on this tutorial is welcome: contact us.