Pangenome (C. elegans)
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.24. Desktop beta builds for Linux and
macOS are on the releases page;
the Windows build waits on code signing.
Geneticists have mapped several traits of the nematode Caenorhabditis elegans to structural variants between the laboratory strain N2 and wild strains: two selfish toxin-antidote elements that kill part of the progeny of a cross between strains, a retrotransposon that stops N2 males from leaving a copulatory plug on their mates, and a deletion of four genes beside glc-1 in strains resistant to the anthelmintic abamectin.
We find each one in long-read assemblies of 39 wild isolates, one per isotype
(CaeNDR's grouping of strains that share a genome), aligned with minigraph
into a graph on ce11, the N2 reference. The graph track draws each bubble, a
place where the strains' sequences split and rejoin. A callset made by mapping
every assembly back onto the graph lists which allele each strain has there, one
VCF column per strain. The reference is N2, so an insertion that N2 has appears
in the callset as a deletion in the strains without it. We:
- load ce11 with its RefSeq genes, the graph, its bubbles and the callset as tracks in JBrowse
- sort the callset's rows by genotype at the two toxin-antidote elements, peel-1 with zeel-1 and sup-35 with pha-1
- load each strain's
minimap2alignment and its walk through the graph, and check the sup-35 alleles against them as lanes and as threads - find the strains without N2's retrotransposon in plg-1, checking one against its reads as alignments tracks, and those with the four-gene deletion beside glc-1
- check the assemblies, then build the graph, the callset and the walk file from them
The graph view is a beta plugin. We welcome your feedback.
Prerequisites
- the GraphGenomeView plugin, for the
GraphTrackbelow, which needs JBrowse 5; until JBrowse 5 ships, that is the development build. In your own JBrowse, install it from the plugin store - to build the graph, the callset and the walk file:
minigraph, thek8JavaScript shell that runs minigraph'smgutilsscripts, bcftools, htslib (bgzip,tabix), gfatools,gfa-to-tabix5.2.0 or later and NCBI'sdatasets - to check the assemblies first: minimap2,
purge_dupsand the SRA toolkit, for the reads purge_dups reads - to align a strain's reads: minimap2 and samtools
# Debian/Ubuntu
sudo apt install bcftools tabix minimap2 sra-toolkit samtools
# or conda, which has every tool above
conda install -c bioconda -c conda-forge minigraph k8 bcftools htslib \
gfatools ncbi-datasets-cli minimap2 purge_dups sra-tools samtools
# or Linux x86_64 binaries for the tools apt lacks
wget -P ~/.local/bin \
https://ftp.ncbi.nlm.nih.gov/pub/datasets/command-line/v2/linux-amd64/datasets \
https://ftp.ncbi.nlm.nih.gov/pub/datasets/command-line/v2/linux-amd64/dataformat
chmod +x ~/.local/bin/datasets ~/.local/bin/dataformat
# any platform
cargo install gfa-to-tabix
npm install -g @jbrowse/cli@nextThe data
The reference is ce11, which the build takes from NCBI as GCF_000002985.6 and JBrowse reads as UCSC's copy. The assemblies are NCBI GenBank records: three panels (Lee et al. 2021, Konan University and the Wellcome Sanger Institute) and three single submissions, listed with their accessions and the input checks in the README beside the files.
Nothing to download: the track configs below read the files by URL. Check the assemblies, Build the C. elegans graph, Make the callset and Make the walk file build them from assemblies of your own.
Read by URL (no download needed)
| What it is | File |
|---|---|
| ce11 (WBcel235), as 2bit | ce11.2bit |
| The graph, as rGFA | celegans-ce11-minigraph.rgfa.gz |
| Segments and links, the graph's nodes and edges at their reference coordinates | celegans-ce11-minigraph.graph.bed.gz |
| Bubbles, where the strains' paths split and rejoin | celegans-ce11-minigraph.bubbles.bed.gz |
| The whole-chromosome overview, with variants under 10 kb folded into the reference | celegans-ce11-minigraph.fold10000.graph.bed.gz |
| The callset, each strain's allele at every bubble | celegans-ce11-minigraph.vcf.gz |
| The walk file, each strain's route through the graph | celegans-ce11-minigraph.ce11.walks.gz |
| Each strain's assembly aligned to ce11 by minimap2, one indexed PAF per strain, such as CB4856's | CB4856_vs_ce11.pif.gz |
| MY2693's Illumina reads around plg-1, aligned to ce11 by minimap2 | MY2693_illumina.plg1.bam |
| MY2693's PacBio HiFi reads around plg-1, aligned to ce11 by minimap2 | MY2693_hifi.plg1.bam |
Load the genome, the graph and the callset
We'll load ce11 and its RefSeq genes from the UCSC hub on jbrowse.org, whose
alias table maps ce11's NCBI names onto chrI and the rest:
genomes.jbrowse.org hosts ce11, and this page's ce11 tracks attach to it by that name. The other tabs build the same assembly from its files.
- In JBrowse Desktop, click Browse hosted genomes on the start screen and pick ce11, or launch
jbrowse-desktop --genome ce11. - On the web, open ce11 on genomes.jbrowse.org.
- In your own JBrowse Web,
jbrowse add-assembly --genome ce11adds it to theconfig.jsonin the current folder.
Goes in the assemblies array of config.json. See Assemblies.
{
"name": "ce11",
"uri": "https://hgdownload.soe.ucsc.edu/goldenPath/ce11/bigZips/ce11.2bit",
"refNameAliases": {
"uri": "https://jbrowse.org/ucsc/ce11/ce11.chromAlias.txt"
}
}Edits config.json in the current folder, creating it if there is none. See JBrowse CLI with Desktop.
jbrowse add-assembly https://hgdownload.soe.ucsc.edu/goldenPath/ce11/bigZips/ce11.2bit \
--name ce11 \
--refNameAliases https://jbrowse.org/ucsc/ce11/ce11.chromAlias.txtce11 is one of the genomes JBrowse Desktop hosts, with gene tracks already set up: on the start screen click Browse hosted genomes and pick it. To load the files of this config instead:
In JBrowse Desktop, Open your own genome on the start screen (or File → Open genome... in a session), then Open from a URL and paste:
https://hgdownload.soe.ucsc.edu/goldenPath/ce11/bigZips/ce11.2bitJBrowse reads the format off the file name. Then fill in:
- Genome name:
ce11 - refName aliases (under More options):
https://jbrowse.org/ucsc/ce11/ce11.chromAlias.txt
Goes in the tracks array of config.json. See Tracks.
{
"type": "FeatureTrack",
"trackId": "ce11_ncbiRefSeq_ucsc",
"name": "NCBI RefSeq genes (ce11)",
"assemblyNames": ["ce11"],
"adapter": {
"type": "Gff3TabixAdapter",
"uri": "https://jbrowse.org/ucsc/ce11/ncbiRefSeq.gff.gz",
"csi": true
}
}Edits config.json in the current folder. See JBrowse CLI with Desktop.
jbrowse add-track-json '{
"type": "FeatureTrack",
"trackId": "ce11_ncbiRefSeq_ucsc",
"name": "NCBI RefSeq genes (ce11)",
"assemblyNames": ["ce11"],
"adapter": {
"type": "Gff3TabixAdapter",
"uri": "https://jbrowse.org/ucsc/ce11/ncbiRefSeq.gff.gz",
"csi": true
}
}'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": "FeatureTrack",
"trackId": "ce11_ncbiRefSeq_ucsc",
"name": "NCBI RefSeq genes (ce11)",
"assemblyNames": ["ce11"],
"adapter": {
"type": "Gff3TabixAdapter",
"uri": "https://jbrowse.org/ucsc/ce11/ncbiRefSeq.gff.gz",
"csi": true
}
}The graph track's uri is the file prefix of the segment index and its
overview. The graph names the reference's sequences ce11#1#chrI, so
assemblyNameToPanSN maps the assembly to that prefix. Swap the uris for your
own build's:
Goes in the tracks array of config.json. See Tracks.
{
"type": "GraphTrack",
"trackId": "celegans_minigraph_segments",
"name": "C. elegans pangenome (rGFA segments)",
"assemblyNames": ["ce11"],
"adapter": {
"type": "GfaTabixAdapter",
"uri": "https://jbrowse.org/demos/celegans_pangenome/celegans-ce11-minigraph",
"format": 2,
"assemblyNameToPanSN": { "ce11": "ce11" },
"coarse": {
"uri": "https://jbrowse.org/demos/celegans_pangenome/celegans-ce11-minigraph.fold10000",
"format": 2,
"aboveBpPerPx": 1000
}
},
"displays": [
{ "type": "LinearGraphDisplay" },
{ "type": "LinearBasicDisplay" }
]
}Edits config.json in the current folder. See JBrowse CLI with Desktop.
jbrowse add-track-json '{
"type": "GraphTrack",
"trackId": "celegans_minigraph_segments",
"name": "C. elegans pangenome (rGFA segments)",
"assemblyNames": ["ce11"],
"adapter": {
"type": "GfaTabixAdapter",
"uri": "https://jbrowse.org/demos/celegans_pangenome/celegans-ce11-minigraph",
"format": 2,
"assemblyNameToPanSN": { "ce11": "ce11" },
"coarse": {
"uri": "https://jbrowse.org/demos/celegans_pangenome/celegans-ce11-minigraph.fold10000",
"format": 2,
"aboveBpPerPx": 1000
}
},
"displays": [
{ "type": "LinearGraphDisplay" },
{ "type": "LinearBasicDisplay" }
]
}'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": "GraphTrack",
"trackId": "celegans_minigraph_segments",
"name": "C. elegans pangenome (rGFA segments)",
"assemblyNames": ["ce11"],
"adapter": {
"type": "GfaTabixAdapter",
"uri": "https://jbrowse.org/demos/celegans_pangenome/celegans-ce11-minigraph",
"format": 2,
"assemblyNameToPanSN": { "ce11": "ce11" },
"coarse": {
"uri": "https://jbrowse.org/demos/celegans_pangenome/celegans-ce11-minigraph.fold10000",
"format": 2,
"aboveBpPerPx": 1000
}
},
"displays": [
{ "type": "LinearGraphDisplay" },
{ "type": "LinearBasicDisplay" }
]
}Goes in the tracks array of config.json. See Tracks.
{
"type": "FeatureTrack",
"trackId": "celegans_minigraph_bubbles",
"name": "C. elegans pangenome bubbles",
"assemblyNames": ["ce11"],
"adapter": {
"type": "MinigraphBubbleAdapter",
"uri": "https://jbrowse.org/demos/celegans_pangenome/celegans-ce11-minigraph.bubbles.bed.gz",
"csi": true,
"assemblyNameToPanSN": { "ce11": "ce11" }
}
}Edits config.json in the current folder. See JBrowse CLI with Desktop.
jbrowse add-track-json '{
"type": "FeatureTrack",
"trackId": "celegans_minigraph_bubbles",
"name": "C. elegans pangenome bubbles",
"assemblyNames": ["ce11"],
"adapter": {
"type": "MinigraphBubbleAdapter",
"uri": "https://jbrowse.org/demos/celegans_pangenome/celegans-ce11-minigraph.bubbles.bed.gz",
"csi": true,
"assemblyNameToPanSN": { "ce11": "ce11" }
}
}'In JBrowse Desktop, or in any running JBrowse Web session, open a view on this track’s assembly, then File → Open track..., choose Add pangenome graph track, and fill in:
- File type:
Minigraph bubbles (tabix BED) - Path:
https://jbrowse.org/demos/celegans_pangenome/celegans-ce11-minigraph.bubbles.bed.gz - Sample name in the graph:
ce11 - Track name:
C. elegans pangenome bubbles - Assembly:
ce11
The callset has a record for each bubble where ce11's own call is the reference
allele, and one haploid genotype per strain, since C. elegans is a selfing
hermaphrodite and each wild strain is inbred. Its alleles are symbolic (<X:1>,
<X:2>), and the ALEN field lists each allele's length, the reference's
first. The display config:
rows.field: "haplotype"draws one row per strain, a color per allele, the rarest sharing the last. The track menu's Rows → Per sample draws every allele other than N2's in one blue, which suits a locus where every alternate allele is a path around an insertion N2 hasrecords.labels.name.show: falsehides each record's ID, which names the bubble's end segmentsrecords.labels.descriptionwrites the allele lengths on each record in the band above the rows, followed by the share of the strains with an alternate allele
Goes in the tracks array of config.json. See Tracks.
{
"type": "VariantTrack",
"trackId": "celegans_pangenome_vcf",
"name": "C. elegans pangenome callset",
"assemblyNames": ["ce11"],
"adapter": {
"type": "VcfTabixAdapter",
"uri": "https://jbrowse.org/demos/celegans_pangenome/celegans-ce11-minigraph.vcf.gz"
},
"displays": [
{
"type": "LinearVariantDisplay",
"rows": { "field": "haplotype" },
"records": {
"labels": {
"name": { "show": false },
"description": "jexl:feature.INFO.ALEN + ' bp'"
}
}
}
]
}Edits config.json in the current folder. See JBrowse CLI with Desktop.
jbrowse add-track-json '{
"type": "VariantTrack",
"trackId": "celegans_pangenome_vcf",
"name": "C. elegans pangenome callset",
"assemblyNames": ["ce11"],
"adapter": {
"type": "VcfTabixAdapter",
"uri": "https://jbrowse.org/demos/celegans_pangenome/celegans-ce11-minigraph.vcf.gz"
},
"displays": [
{
"type": "LinearVariantDisplay",
"rows": { "field": "haplotype" },
"records": {
"labels": {
"name": { "show": false },
"description": "jexl:feature.INFO.ALEN + '\'' bp'\''"
}
}
}
]
}'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": "celegans_pangenome_vcf",
"name": "C. elegans pangenome callset",
"assemblyNames": ["ce11"],
"adapter": {
"type": "VcfTabixAdapter",
"uri": "https://jbrowse.org/demos/celegans_pangenome/celegans-ce11-minigraph.vcf.gz"
},
"displays": [
{
"type": "LinearVariantDisplay",
"rows": { "field": "haplotype" },
"records": {
"labels": {
"name": { "show": false },
"description": "jexl:feature.INFO.ALEN + ' bp'"
}
}
}
]
}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%2Fce11%2Fconfig.json&session=spec-%7B%22sessionTracks%22%3A%5B%7B%22type%22%3A%22VariantTrack%22%2C%22trackId%22%3A%22celegans_pangenome_vcf%22%2C%22name%22%3A%22C.+elegans+pangenome+callset%22%2C%22assemblyNames%22%3A%5B%22ce11%22%5D%2C%22adapter%22%3A%7B%22type%22%3A%22VcfTabixAdapter%22%2C%22uri%22%3A%22https%3A%2F%2Fjbrowse.org%2Fdemos%2Fcelegans_pangenome%2Fcelegans-ce11-minigraph.vcf.gz%22%7D%2C%22displays%22%3A%5B%7B%22type%22%3A%22LinearVariantDisplay%22%2C%22rows%22%3A%7B%22field%22%3A%22haplotype%22%7D%2C%22records%22%3A%7B%22labels%22%3A%7B%22name%22%3A%7B%22show%22%3Afalse%7D%2C%22description%22%3A%22jexl%3Afeature.INFO.ALEN+%2B+%27+bp%27%22%7D%7D%7D%5D%7D%5D%2C%22views%22%3A%5B%7B%22type%22%3A%22LinearGenomeView%22%2C%22assembly%22%3A%22ce11%22%2C%22loc%22%3A%22chrI%3A2%2C336%2C001-2%2C360%2C000%22%2C%22tracks%22%3A%5B%22celegans_pangenome_vcf%22%5D%7D%5D%7D&sessionName=JBrowse+docs%3A+C.+elegans+pangenome+callsetThis view in a notebook, with jbrowse-anywidget. Swap a track's uri for your file.
from jbrowse_anywidget import JBrowseApp, fetch_hub
config = fetch_hub("https://jbrowse.org/ucsc/ce11/config.json")
app = JBrowseApp(
assemblies=config["assemblies"],
tracks=config.get("tracks", []) + [
{
"type": "VariantTrack",
"trackId": "celegans_pangenome_vcf",
"name": "C. elegans pangenome callset",
"assemblyNames": [
"ce11"
],
"adapter": {
"type": "VcfTabixAdapter",
"uri": "https://jbrowse.org/demos/celegans_pangenome/celegans-ce11-minigraph.vcf.gz"
},
"displays": [
{
"type": "LinearVariantDisplay",
"rows": {
"field": "haplotype"
},
"records": {
"labels": {
"name": {
"show": False
},
"description": "jexl:feature.INFO.ALEN + ' bp'"
}
}
}
]
}
],
views=[
{
"type": "LinearGenomeView",
"assembly": "ce11",
"loc": "chrI:2,336,001-2,360,000",
"tracks": [
"celegans_pangenome_vcf"
]
}
],
)
app # display the widgetThis view in your React 19 app, with @jbrowse/react-app2 and @jbrowse/core. Add your own files to tracks.
import { use } from 'react'
import { JBrowse } from '@jbrowse/react-app2'
import '@jbrowse/react-app2/styles.css'
import { addRelativeUris } from '@jbrowse/core/util/addRelativeUris'
const configUrl = "https://jbrowse.org/ucsc/ce11/config.json"
const configPromise = fetch(configUrl)
.then(res => res.json())
.then(config => {
addRelativeUris(config, new URL(configUrl))
return config
})
export default function Figure() {
const config = use(configPromise)
return (
<JBrowse
assemblies={config.assemblies}
tracks={[...(config.tracks ?? []), ...[
{
"type": "VariantTrack",
"trackId": "celegans_pangenome_vcf",
"name": "C. elegans pangenome callset",
"assemblyNames": [
"ce11"
],
"adapter": {
"type": "VcfTabixAdapter",
"uri": "https://jbrowse.org/demos/celegans_pangenome/celegans-ce11-minigraph.vcf.gz"
},
"displays": [
{
"type": "LinearVariantDisplay",
"rows": {
"field": "haplotype"
},
"records": {
"labels": {
"name": {
"show": false
},
"description": "jexl:feature.INFO.ALEN + ' bp'"
}
}
}
]
}
]]}
aggregateTextSearchAdapters={config.aggregateTextSearchAdapters}
configuration={config.configuration}
views={[
{
"type": "LinearGenomeView",
"assembly": "ce11",
"loc": "chrI:2,336,001-2,360,000",
"tracks": [
"celegans_pangenome_vcf"
]
}
]}
/>
)
}jbrowse-img draws this view as an SVG, no browser needed. Swap --config or a track for your own.
cat > tracks.json <<'JSON'
[
{
"type": "VariantTrack",
"trackId": "celegans_pangenome_vcf",
"name": "C. elegans pangenome callset",
"assemblyNames": [
"ce11"
],
"adapter": {
"type": "VcfTabixAdapter",
"uri": "https://jbrowse.org/demos/celegans_pangenome/celegans-ce11-minigraph.vcf.gz"
},
"displays": [
{
"type": "LinearVariantDisplay",
"rows": {
"field": "haplotype"
},
"records": {
"labels": {
"name": {
"show": false
},
"description": "jexl:feature.INFO.ALEN + ' bp'"
}
}
}
]
}
]
JSON
npx @jbrowse/img --config https://jbrowse.org/ucsc/ce11/config.json \
--trackConfigs tracks.json \
--assembly ce11 --loc chrI:2,336,001-2,360,000 \
--track celegans_pangenome_vcf \
--out figure.svgFor a PNG, --out figure.png (needs rsvg-convert: apt install librsvg2-bin, brew install librsvg).
Sort the callset by genotype at peel-1 and zeel-1
Seidel et al. (2008) found that crosses between N2 and the Hawaiian strain CB4856 kill embryos through a genetic incompatibility on chromosome I, and Seidel et al. (2011) traced it to a 19 kb insertion in N2 with two genes: a sperm-delivered toxin, peel-1, and its zygotic antidote, zeel-1. An embryo dies when its father has the element and it inherits no zeel-1. Lee et al. (2021) found the element inside a block of hyper-divergent sequence, where wild haplotypes differ from N2's at many sites. CB4856 and other strains of the panel lack the 19 kb.
- Type
chrI:2,336,001-2,360,000into the location box and turn on the gene track, the callset and the graph track. - Right-click the record over zeel-1 and peel-1 and pick Sort rows by genotype here, which groups the rows by allele.
- In the callset's track menu, choose Rows → Per sample, so every strain without the element is one blue, whichever path it takes instead.
- In the graph track's menu, open Graph settings... and set Bubble spread to Compress lengths, so the kb and bp segments fit one pane.
Each strain without the element takes a short path through the hyper-divergent block, and the paths differ among groups of strains, so the callset lists them as separate alleles. Rows → Per haplotype draws each of those alleles in a separate color.
Read the sup-35 and pha-1 alleles
Ben-David et al. (2017) found a second toxin-antidote element on chromosome III: a mother with the element loads the toxin SUP-35 into every egg, and an embryo that inherits no pha-1, the antidote, dies with a malformed pharynx. They assembled DL238 and QX1211 and found there the arrangement other Caenorhabditis species share, without the inversion N2 has. DL238 lacks pha-1, and ECA36 has a mutated copy.
- Type
chrIII:11,100,001-11,145,000into the location box and turn off the graph track, whose alleles here draw as one knot. - Choose Rows → Per haplotype, so that each allele length takes a separate color.
- Right-click the record over sup-35 and pha-1 and pick Sort rows by genotype here.
The shortest alleles are DL238's, ECA396's, XZ1516's and the one ECA36 shares with QX1211. Liu and Zheng (2026) found pha-1 split in XZ1516.
Check the sup-35 alleles against each strain's assembly
The callset's alleles come from minigraph's alignment of each assembly to the
graph. We'll read the same locus from two more tracks, each with a lane per
strain: the strain's assembly aligned to ce11 by minimap2, an aligner other
than the graph's, and the strain's walk through the graph.
The minimap2 track reads the alignments the
assembly check makes. A
MultiPairwiseSyntenyAdapter lists one indexed PAF per strain, and the track's
assemblyNames are the lanes it opens with; the lane picker in its menu offers
the others. Three of the 39 strains:
Goes in the tracks array of config.json. See Tracks.
{
"type": "SyntenyTrack",
"trackId": "celegans_strains_vs_ce11",
"name": "C. elegans strains vs ce11 (minimap2 -cx asm20)",
"assemblyNames": ["ce11", "CB4856", "DL238", "QX1211"],
"adapter": {
"type": "MultiPairwiseSyntenyAdapter",
"adapters": [
{
"type": "PairwiseIndexedPAFAdapter",
"uri": "https://jbrowse.org/demos/celegans_pangenome/vsref/CB4856_vs_ce11.pif.gz",
"csi": true,
"assemblyNames": ["CB4856", "ce11"]
},
{
"type": "PairwiseIndexedPAFAdapter",
"uri": "https://jbrowse.org/demos/celegans_pangenome/vsref/DL238_vs_ce11.pif.gz",
"csi": true,
"assemblyNames": ["DL238", "ce11"]
},
{
"type": "PairwiseIndexedPAFAdapter",
"uri": "https://jbrowse.org/demos/celegans_pangenome/vsref/QX1211_vs_ce11.pif.gz",
"csi": true,
"assemblyNames": ["QX1211", "ce11"]
}
]
}
}Edits config.json in the current folder. See JBrowse CLI with Desktop.
jbrowse add-track-json '{
"type": "SyntenyTrack",
"trackId": "celegans_strains_vs_ce11",
"name": "C. elegans strains vs ce11 (minimap2 -cx asm20)",
"assemblyNames": ["ce11", "CB4856", "DL238", "QX1211"],
"adapter": {
"type": "MultiPairwiseSyntenyAdapter",
"adapters": [
{
"type": "PairwiseIndexedPAFAdapter",
"uri": "https://jbrowse.org/demos/celegans_pangenome/vsref/CB4856_vs_ce11.pif.gz",
"csi": true,
"assemblyNames": ["CB4856", "ce11"]
},
{
"type": "PairwiseIndexedPAFAdapter",
"uri": "https://jbrowse.org/demos/celegans_pangenome/vsref/DL238_vs_ce11.pif.gz",
"csi": true,
"assemblyNames": ["DL238", "ce11"]
},
{
"type": "PairwiseIndexedPAFAdapter",
"uri": "https://jbrowse.org/demos/celegans_pangenome/vsref/QX1211_vs_ce11.pif.gz",
"csi": true,
"assemblyNames": ["QX1211", "ce11"]
}
]
}
}'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": "SyntenyTrack",
"trackId": "celegans_strains_vs_ce11",
"name": "C. elegans strains vs ce11 (minimap2 -cx asm20)",
"assemblyNames": ["ce11", "CB4856", "DL238", "QX1211"],
"adapter": {
"type": "MultiPairwiseSyntenyAdapter",
"adapters": [
{
"type": "PairwiseIndexedPAFAdapter",
"uri": "https://jbrowse.org/demos/celegans_pangenome/vsref/CB4856_vs_ce11.pif.gz",
"csi": true,
"assemblyNames": ["CB4856", "ce11"]
},
{
"type": "PairwiseIndexedPAFAdapter",
"uri": "https://jbrowse.org/demos/celegans_pangenome/vsref/DL238_vs_ce11.pif.gz",
"csi": true,
"assemblyNames": ["DL238", "ce11"]
},
{
"type": "PairwiseIndexedPAFAdapter",
"uri": "https://jbrowse.org/demos/celegans_pangenome/vsref/QX1211_vs_ce11.pif.gz",
"csi": true,
"assemblyNames": ["QX1211", "ce11"]
}
]
}
}That shows it in the linear view. For the synteny view, open Add → Linear synteny view, pick the track under Quick start, and click Launch.
The walk track reads the walk file, which lists each strain's route through the
graph. The rGFA has no path lines, so the build maps each assembly onto the
graph once more and turns each contig's alignments into walks, as
Make the walk file shows. walksUri is the file's
prefix, and assemblyNameToPanSN maps each lane to its walks' PanSN prefix:
Goes in the tracks array of config.json. See Tracks.
{
"type": "GraphTrack",
"trackId": "celegans_minigraph_walks",
"name": "C. elegans strains through the pangenome, read from the walk file",
"assemblyNames": ["ce11", "CB4856", "DL238", "QX1211"],
"adapter": {
"type": "GfaWalksSyntenyAdapter",
"walksUri": "https://jbrowse.org/demos/celegans_pangenome/celegans-ce11-minigraph.ce11",
"assemblyNames": ["ce11"],
"assemblyNameToPanSN": {
"ce11": "ce11#1",
"CB4856": "CB4856#1",
"DL238": "DL238#1",
"QX1211": "QX1211#1"
}
},
"displays": [
{ "type": "LinearGraphDisplay" },
{ "type": "MultiWaySyntenyDisplay" }
]
}Edits config.json in the current folder. See JBrowse CLI with Desktop.
jbrowse add-track-json '{
"type": "GraphTrack",
"trackId": "celegans_minigraph_walks",
"name": "C. elegans strains through the pangenome, read from the walk file",
"assemblyNames": ["ce11", "CB4856", "DL238", "QX1211"],
"adapter": {
"type": "GfaWalksSyntenyAdapter",
"walksUri": "https://jbrowse.org/demos/celegans_pangenome/celegans-ce11-minigraph.ce11",
"assemblyNames": ["ce11"],
"assemblyNameToPanSN": {
"ce11": "ce11#1",
"CB4856": "CB4856#1",
"DL238": "DL238#1",
"QX1211": "QX1211#1"
}
},
"displays": [
{ "type": "LinearGraphDisplay" },
{ "type": "MultiWaySyntenyDisplay" }
]
}'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": "GraphTrack",
"trackId": "celegans_minigraph_walks",
"name": "C. elegans strains through the pangenome, read from the walk file",
"assemblyNames": ["ce11", "CB4856", "DL238", "QX1211"],
"adapter": {
"type": "GfaWalksSyntenyAdapter",
"walksUri": "https://jbrowse.org/demos/celegans_pangenome/celegans-ce11-minigraph.ce11",
"assemblyNames": ["ce11"],
"assemblyNameToPanSN": {
"ce11": "ce11#1",
"CB4856": "CB4856#1",
"DL238": "DL238#1",
"QX1211": "QX1211#1"
}
},
"displays": [
{ "type": "LinearGraphDisplay" },
{ "type": "MultiWaySyntenyDisplay" }
]
}- Turn on C. elegans strains through the pangenome, read from the walk file and pick Display types → Multi-way synteny display in its menu.
- Turn on C. elegans strains vs ce11 (minimap2 -cx asm20) below it. Both tracks open with a lane each for CB4856, DL238 and QX1211.
CB4856 has ce11's allele in the callset, and both its lanes run collinear with ce11. DL238's lanes are close in length to its 6.5 kb allele in the callset, and neither aligns over pha-1.
The walk track also draws each route as a thread through the graph:
- Pick Display types → Graph in the walk file track's menu.
- Press the button beside Haplotypes in the track's key and check
ce11,CB4856,DL238andQX1211. - Open Graph settings... in the track's menu and set Bubble spread to Compress lengths.
Threads drawn side by side pass through the same segments, and a thread that leaves the others passes through segments they skip. DL238's thread skips every gene of the loop, pha-1 among them, as its 6.5 kb allele does in the callset.
Find the strains without N2's retrotransposon in plg-1
Palopoli et al. (2008) found that males of many wild strains leave a gelatinous plug over their mate's vulva and N2 males do not, because a Cer1 retrotransposon sits in an exon of the mucin gene plg-1 in N2. They found it at the same site and orientation in every non-plugging strain they examined, and inferred one mutation that spread. ce11 has the Cer1, so the plugging strains have a deletion in the callset.
- Type
chrIII:8,850,501-8,862,500into the location box and turn the graph track back on. - Right-click the record over plg-1 and pick Sort rows by genotype here.
- Choose Rows → Per sample.
The record's two alternate alleles are both 1 bp, each stepping past the Cer1 from a different flanking segment, so both mean the strain lacks the insertion.1
To check one plugging strain against its own sequencing data, load MY2693's
Illumina and PacBio HiFi reads aligned to all of ce11, so that reads from Cer1
copies elsewhere in the genome land on those copies. One minimap2 command
aligns each read set, and samtools index reads.bam indexes the result:
# -ax sr: paired short reads, as SAM; use -ax map-hifi for HiFi reads
minimap2 -ax sr ce11.fa reads_1.fastq reads_2.fastq | samtools sort -o reads.bamBoth tracks open as coverage with per-read arcs, which join a pair's mates or a split read's pieces when they align far apart (Read connections → Per-read arcs), and with the pileup hidden:
Goes in the tracks array of config.json. See Tracks.
{
"type": "AlignmentsTrack",
"trackId": "celegans_my2693_illumina",
"name": "MY2693 Illumina reads (CaeNDR)",
"assemblyNames": ["ce11"],
"uri": "https://jbrowse.org/demos/celegans_pangenome/plg1_reads/MY2693_illumina.plg1.bam",
"displayDefaults": {
"height": 170,
"pileup": { "show": false },
"coverage": {
"height": 60,
"encoding": { "y": { "scale": { "domainMin": 0, "domainMax": 100 } } }
},
"readConnections": { "show": true, "mark": "link" }
}
}Edits config.json in the current folder. See JBrowse CLI with Desktop.
jbrowse add-track https://jbrowse.org/demos/celegans_pangenome/plg1_reads/MY2693_illumina.plg1.bam \
--trackId celegans_my2693_illumina \
--name "MY2693 Illumina reads (CaeNDR)" \
--assemblyNames ce11 \
--displayDefaults '{"height":170,"pileup":{"show":false},"coverage":{"height":60,"encoding":{"y":{"scale":{"domainMin":0,"domainMax":100}}}},"readConnections":{"show":true,"mark":"link"}}'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": "AlignmentsTrack",
"trackId": "celegans_my2693_illumina",
"name": "MY2693 Illumina reads (CaeNDR)",
"assemblyNames": ["ce11"],
"uri": "https://jbrowse.org/demos/celegans_pangenome/plg1_reads/MY2693_illumina.plg1.bam",
"displayDefaults": {
"height": 170,
"pileup": { "show": false },
"coverage": {
"height": 60,
"encoding": { "y": { "scale": { "domainMin": 0, "domainMax": 100 } } }
},
"readConnections": { "show": true, "mark": "link" }
}
}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%2Fce11%2Fconfig.json&session=spec-%7B%22sessionTracks%22%3A%5B%7B%22type%22%3A%22AlignmentsTrack%22%2C%22trackId%22%3A%22celegans_my2693_illumina%22%2C%22name%22%3A%22MY2693+Illumina+reads+%28CaeNDR%29%22%2C%22assemblyNames%22%3A%5B%22ce11%22%5D%2C%22uri%22%3A%22https%3A%2F%2Fjbrowse.org%2Fdemos%2Fcelegans_pangenome%2Fplg1_reads%2FMY2693_illumina.plg1.bam%22%2C%22displayDefaults%22%3A%7B%22height%22%3A170%2C%22pileup%22%3A%7B%22show%22%3Afalse%7D%2C%22coverage%22%3A%7B%22height%22%3A60%2C%22encoding%22%3A%7B%22y%22%3A%7B%22scale%22%3A%7B%22domainMin%22%3A0%2C%22domainMax%22%3A100%7D%7D%7D%7D%2C%22readConnections%22%3A%7B%22show%22%3Atrue%2C%22mark%22%3A%22link%22%7D%7D%7D%5D%2C%22views%22%3A%5B%7B%22type%22%3A%22LinearGenomeView%22%2C%22assembly%22%3A%22ce11%22%2C%22loc%22%3A%22chrIII%3A8%2C850%2C501-8%2C865%2C000%22%2C%22tracks%22%3A%5B%22celegans_my2693_illumina%22%5D%7D%5D%7D&sessionName=JBrowse+docs%3A+MY2693+Illumina+reads+%28CaeNDR%29This view in a notebook, with jbrowse-anywidget. Swap a track's uri for your file.
from jbrowse_anywidget import JBrowseApp, fetch_hub
config = fetch_hub("https://jbrowse.org/ucsc/ce11/config.json")
app = JBrowseApp(
assemblies=config["assemblies"],
tracks=config.get("tracks", []) + [
{
"type": "AlignmentsTrack",
"trackId": "celegans_my2693_illumina",
"name": "MY2693 Illumina reads (CaeNDR)",
"assemblyNames": [
"ce11"
],
"uri": "https://jbrowse.org/demos/celegans_pangenome/plg1_reads/MY2693_illumina.plg1.bam",
"displayDefaults": {
"height": 170,
"pileup": {
"show": False
},
"coverage": {
"height": 60,
"encoding": {
"y": {
"scale": {
"domainMin": 0,
"domainMax": 100
}
}
}
},
"readConnections": {
"show": True,
"mark": "link"
}
}
}
],
views=[
{
"type": "LinearGenomeView",
"assembly": "ce11",
"loc": "chrIII:8,850,501-8,865,000",
"tracks": [
"celegans_my2693_illumina"
]
}
],
)
app # display the widgetThis view in your React 19 app, with @jbrowse/react-app2 and @jbrowse/core. Add your own files to tracks.
import { use } from 'react'
import { JBrowse } from '@jbrowse/react-app2'
import '@jbrowse/react-app2/styles.css'
import { addRelativeUris } from '@jbrowse/core/util/addRelativeUris'
const configUrl = "https://jbrowse.org/ucsc/ce11/config.json"
const configPromise = fetch(configUrl)
.then(res => res.json())
.then(config => {
addRelativeUris(config, new URL(configUrl))
return config
})
export default function Figure() {
const config = use(configPromise)
return (
<JBrowse
assemblies={config.assemblies}
tracks={[...(config.tracks ?? []), ...[
{
"type": "AlignmentsTrack",
"trackId": "celegans_my2693_illumina",
"name": "MY2693 Illumina reads (CaeNDR)",
"assemblyNames": [
"ce11"
],
"uri": "https://jbrowse.org/demos/celegans_pangenome/plg1_reads/MY2693_illumina.plg1.bam",
"displayDefaults": {
"height": 170,
"pileup": {
"show": false
},
"coverage": {
"height": 60,
"encoding": {
"y": {
"scale": {
"domainMin": 0,
"domainMax": 100
}
}
}
},
"readConnections": {
"show": true,
"mark": "link"
}
}
}
]]}
aggregateTextSearchAdapters={config.aggregateTextSearchAdapters}
configuration={config.configuration}
views={[
{
"type": "LinearGenomeView",
"assembly": "ce11",
"loc": "chrIII:8,850,501-8,865,000",
"tracks": [
"celegans_my2693_illumina"
]
}
]}
/>
)
}jbrowse-img draws this view as an SVG, no browser needed. Swap --config or a track for your own.
cat > tracks.json <<'JSON'
[
{
"type": "AlignmentsTrack",
"trackId": "celegans_my2693_illumina",
"name": "MY2693 Illumina reads (CaeNDR)",
"assemblyNames": [
"ce11"
],
"uri": "https://jbrowse.org/demos/celegans_pangenome/plg1_reads/MY2693_illumina.plg1.bam",
"displayDefaults": {
"height": 170,
"pileup": {
"show": false
},
"coverage": {
"height": 60,
"encoding": {
"y": {
"scale": {
"domainMin": 0,
"domainMax": 100
}
}
}
},
"readConnections": {
"show": true,
"mark": "link"
}
}
}
]
JSON
npx @jbrowse/img --config https://jbrowse.org/ucsc/ce11/config.json \
--trackConfigs tracks.json \
--assembly ce11 --loc chrIII:8,850,501-8,865,000 \
--track celegans_my2693_illumina \
--out figure.svgFor a PNG, --out figure.png (needs rsvg-convert: apt install librsvg2-bin, brew install librsvg).
Goes in the tracks array of config.json. See Tracks.
{
"type": "AlignmentsTrack",
"trackId": "celegans_my2693_hifi",
"name": "MY2693 PacBio HiFi reads",
"assemblyNames": ["ce11"],
"uri": "https://jbrowse.org/demos/celegans_pangenome/plg1_reads/MY2693_hifi.plg1.bam",
"displayDefaults": {
"height": 170,
"pileup": { "show": false },
"coverage": {
"height": 60,
"encoding": { "y": { "scale": { "domainMin": 0, "domainMax": 40 } } }
},
"readConnections": { "show": true, "mark": "link" }
}
}Edits config.json in the current folder. See JBrowse CLI with Desktop.
jbrowse add-track https://jbrowse.org/demos/celegans_pangenome/plg1_reads/MY2693_hifi.plg1.bam \
--trackId celegans_my2693_hifi \
--name "MY2693 PacBio HiFi reads" \
--assemblyNames ce11 \
--displayDefaults '{"height":170,"pileup":{"show":false},"coverage":{"height":60,"encoding":{"y":{"scale":{"domainMin":0,"domainMax":40}}}},"readConnections":{"show":true,"mark":"link"}}'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": "AlignmentsTrack",
"trackId": "celegans_my2693_hifi",
"name": "MY2693 PacBio HiFi reads",
"assemblyNames": ["ce11"],
"uri": "https://jbrowse.org/demos/celegans_pangenome/plg1_reads/MY2693_hifi.plg1.bam",
"displayDefaults": {
"height": 170,
"pileup": { "show": false },
"coverage": {
"height": 60,
"encoding": { "y": { "scale": { "domainMin": 0, "domainMax": 40 } } }
},
"readConnections": { "show": true, "mark": "link" }
}
}The walk file track's graph opens cut for its four lanes, so cut it for ce11 and MY2693 instead, then draw it as a tube map on reference, which runs each strain's path as a tube through boxed segments at their ce11 positions, in line with the reads:
- Type
chrIII:8,850,501-8,865,000into the location box and turn on both read tracks and the walk file track. - Open Graph settings... in the walk file track's menu and type
ce11#1, MY2693#1under Haplotypes. - Beside Layout in its key, open more and pick Tube map on reference.
MY2693's tube passes beneath the Cer1's segment without entering it, from one end to the other, where the reads' coverage stops and starts again and the per-read arcs land.
Find the four-gene deletion beside glc-1
Ghosh et al. (2012) traced CB4856's resistance to abamectin to glc-1, a glutamate-gated chloride channel subunit. O'Connor et al. (2026), in a preprint, found that resistant strains other than ECA36 also lack four genes upstream of glc-1: F11A5.18, irld-26, oac-15 and F11A5.16. ECA36 has all four genes on a diverged sequence.
- Type
chrV:16,200,001-16,223,000into the location box. - Right-click the record over the four genes and pick Sort rows by genotype here.
- Choose Rows → Per haplotype, which tells the deletion from the strains that keep the genes on another path.
CB4856 and JU751, both resistant in Ghosh et al. (2012), have the deletion, and ECA36's allele keeps the genes.
Check the assemblies before building the graph
We'll check each assembly before minigraph reads it, because a duplicated
contig in an input becomes a false allele in the callset. The inputs stay
unmasked, since minigraph needs no masking.
Two assemblies in the panel, JU310 and QX1794, hold some regions twice, as two contigs each. purge_dups tells such a copy from a real duplication by read depth, so it needs the reads the assembly was built from, mapped onto the assembly:
# -x map-pb: PacBio CLR reads; map-hifi for HiFi
minimap2 -t 8 -x map-pb asm.fa reads.fa | gzip > reads.paf.gzpurge_dups then reads the depth, aligns the assembly to itself and marks the duplicated stretches:
# pbcstat: per-base read depth (PB.base.cov) and its histogram (PB.stat)
pbcstat reads.paf.gz
# calcuts: the depth cutoffs, from the histogram
calcuts PB.stat > cutoffs
# split_fa: split the assembly at its gaps
split_fa asm.fa > split.fa
# -DP: all-vs-all, keeping every self-overlap
minimap2 -t 8 -x asm5 -DP split.fa split.fa | gzip > split.self.paf.gz
# -2: a second round of chaining, to catch duplicates split across contigs
purge_dups -2 -T cutoffs -c PB.base.cov split.self.paf.gz > dups.bed
# -e: remove duplicates at contig ends only, never splitting a contig;
# writes purged.fa and the removed copies to hap.fa
get_seqs -e dups.bed asm.faThe other checks start from each assembly's alignment to the reference, which is
also the alignment the minimap2 lanes above draw:
# -x asm20: assembly to a reference up to about 20% divergent
# --secondary=no: each contig's best placement only
minimap2 -t 8 -cx asm20 --secondary=no ce11.fa asm.fa > asm.vsref.pafFrom that alignment and an alignment of each assembly's contigs under 2 Mb to the whole assembly, the build script drops:
- homopolymer contigs, under 5% or over 95% GC, found in some PacBio CLR assemblies
- mitochondrial contigs, which only some assemblies include, a few as concatemers
- contigs lying within a longer contig of the same assembly at 97% identity or more
qc.dropped.tsv beside the hosted files lists each dropped contig with its
reason.
Build the C. elegans graph
We'll rename each assembly's sequences to PanSN, sample#haplotype#contig, so
the graph's segments name the strain they came from:
# prefix every sequence name in CB4856.fa with CB4856#1#
sed 's/^>/>CB4856#1#/' CB4856.fa > CB4856.pansn.faJBrowse and the callset below strip the reference's prefix from the graph's
sequence names, and the names left (chrI) must be sequence names or aliases of
the JBrowse assembly. The build script renames from each assembly's NCBI
sequence report, so the reference's chromosomes read chrI to chrX and
chrM, and a contig-level assembly's contigs keep their GenBank accessions.
One minigraph run builds the graph over every chromosome at once, reference
first so that its segments take rank 0, the earliest build order:
# -xggs: incremental graph construction, adding each genome in turn
# -c: base-level alignment, which minigraph recommends for graph generation
minigraph -cxggs -t 8 ce11.pansn.fa CB4856.pansn.fa KR314.pansn.fa ... JU1395.pansn.fa > worm.rgfagfa-to-tabix and minigraph --call read the graph bgzipped, and gfatools
reads it plain:
# -k: keep worm.rgfa beside worm.rgfa.gz
bgzip -k worm.rgfaThree commands then write the files the tracks read. gfa-to-tabix writes the
segment and link index, with each segment at its coordinate on the reference:
# --layout contig: each segment at its SN/SO coordinate; writes
# worm.graph.bed.gz and its .tbi
gfa-to-tabix worm.rgfa.gz --layout contig -o wormThe bubbles come from gfatools:
gfatools bubble worm.rgfa | sort -k1,1 -k2,2n | bgzip > worm.bubbles.bed.gz
tabix -C -p bed worm.bubbles.bed.gzThe overview folds every variant under 10 kb into the reference, for whole chromosomes:
# --below: the size to fold under; --layout matches the index's
gfa-to-tabix fold worm.rgfa.gz --below 10000 --layout contig -o worm.fold10000Make the callset
The callset comes from mapping each assembly back onto the graph, whose rGFA
holds no path lines. minigraph --call writes the walk one assembly takes
through every bubble. Run it once per assembly, the reference included, since
the merge below reads the reference's own call as allele 0:
# -c: base-level alignment, which --call reads
# -xasm: the assembly-to-graph preset
# --call: one line per bubble, in the same order for every assembly
minigraph -cxasm --call -t 8 worm.rgfa.gz CB4856.pansn.fa > CB4856.call.bedTwo scripts in minigraph's
misc/ folder, which the
bioconda package leaves out, merge the calls into a VCF. We'll fetch them at the
revision the hosted callset was built with:
MGUTILS=https://raw.githubusercontent.com/lh3/minigraph/2f569ebe3071fcb242f1bf0eabbb917941b47239/misc
curl -fsSL -o mgutils.js "$MGUTILS/mgutils.js"
curl -fsSL -o mgutils-es6.js "$MGUTILS/mgutils-es6.js"merge2vcf copies the ## lines of its input into the VCF header. Those lines
go in header.txt: a ##contig line per reference chromosome, and the END
and AN tags merge2vcf writes without declaring them, which
bcftools view -s otherwise stops on with "Undefined tags in the header".
ref.chrom.sizes lists each reference chromosome's name, as the VCF spells it,
and its length:
# UCSC's ce11 names and lengths, which the RefSeq sequences match
curl -fsSL -o ref.chrom.sizes https://jbrowse.org/ucsc/ce11/ce11.chrom.sizes{
awk '{ printf "##contig=<ID=%s,length=%d>\n", $1, $2 }' ref.chrom.sizes
echo '##INFO=<ID=END,Number=1,Type=Integer,Description="End of the bubble">'
echo '##INFO=<ID=AN,Number=1,Type=Integer,Description="Number of called alleles">'
} > header.txtmgutils.js merge pastes the call files into one row per bubble, behind the
header:
# samples.txt: one name per line, in the order of the call files, the
# reference's first
# sed: drop the PanSN prefix on the graph's sequence names, so CHROM is chrI
paste ce11.call.bed CB4856.call.bed KR314.call.bed \
| k8 mgutils.js merge -s samples.txt - \
| sed 's/^ce11#1#//' | cat header.txt - > merged.bedmgutils-es6.js merge2vcf turns that into the VCF, with the reference's column
as allele 0:
# -r0: the first column is the reference
# -a: the most alternate alleles a record lists, here one per assembly; a
# smaller cap merges the rarer alleles into the last one
# annotate --set-id: the bubble's end segments as the record ID
# view -i: keep the records where the reference's own call is allele 0
# view -s ^ce11: drop the reference's own column
k8 mgutils-es6.js merge2vcf -r0 -a "$(wc -l < samples.txt)" merged.bed \
| bcftools annotate --set-id '%INFO/VS%INFO/VE' -Ou \
| bcftools view -i 'GT[0]="ref"' -Ou \
| bcftools view -s ^ce11 -Ou \
| bcftools sort -Oz -o worm.vcf.gz
tabix -p vcf worm.vcf.gzA strain whose assembly has no contig across a bubble gets a no-call there.
Make the walk file
The walk file comes from one more mapping of each assembly onto the graph.
--vc writes each alignment's path as segment ids, and gfa-to-tabix from-gaf
turns each contig's alignments into walks. A walk starts where the alignment
puts its first node, its other nodes follow by their lengths, and it ends where
the contig and the graph part by more than 1 kb, so no node sits more than 1 kb
from where the alignment puts it.
# --vc: the path as segment ids, which from-gaf reads
minigraph -cxasm --vc -t 8 worm.rgfa.gz CB4856.pansn.fa > CB4856.gaf
# one GAF per assembly, the reference left out: its walk comes from the
# rGFA's own tags
gfa-to-tabix from-gaf worm.rgfa.gz CB4856.gaf DL238.gaf -o walks.gfa.gz
# --walks: write worm.ce11.walks.gz and its index, in ce11's coordinates
gfa-to-tabix walks.gfa.gz --walks --refs ce11 -o wormReproduce it end to end
build_celegans_pangenome.sh
runs every step on this page. It runs on Linux, since it needs GNU tools, and
takes about four hours with THREADS=16: an hour of minigraph, an hour and a
half of calls, most of an hour mapping the assemblies again for the walk file,
and the purge, which downloads 12 GB of PacBio reads. The script:
- downloads ce11 and one assembly per wild isotype from NCBI with their sequence reports, and renames their sequences to PanSN
- purges JU310 and QX1794 with their reads, drops homopolymer, mitochondrial and contained contigs from every assembly, and stops unless each is 95 to 110 Mb
- builds the graph and stops if a segment's
SNtag is not a PanSN name, if a segment id repeats, or if the rank-0 segments are not ce11's seven sequences at their full length - writes the segment index, the bubbles and the overview, then maps each assembly back onto the graph and merges the calls into the callset
- maps each assembly onto the graph once more for the walk file, and indexes the assembly check's minimap2 alignments as lanes
curl -fO https://raw.githubusercontent.com/GMOD/jbrowse-components/main/scripts/build_celegans_pangenome.sh
bash build_celegans_pangenome.sh celegans_pangenome # writes ./celegans_pangenome/Point each track's uri at the files it writes to open your own run.
build_celegans_plg1_reads.sh
makes the two read tracks at plg-1. It downloads about 9 GB of MY2693's reads,
then aligns them in about ten minutes with THREADS=22. The script:
- downloads ce11 and MY2693's Illumina and HiFi runs from the SRA
- aligns each read set to all of ce11 with
minimap2 - keeps the reads in a 120 kb window around plg-1 and indexes them
curl -fO https://raw.githubusercontent.com/GMOD/jbrowse-components/main/scripts/build_celegans_plg1_reads.sh
bash build_celegans_plg1_reads.sh celegans_plg1_reads # writes ./celegans_plg1_reads/See also
- Tutorial: Pangenome (fly)
- Tutorial: Pangenome (rice)
- Tutorial: Pangenome (hosting your own graph)
Citations
- Li et al. (2020). The design and construction of reference pangenome graphs with minigraph
- Guan et al. (2020). Identifying and removing haplotypic duplication in primary genome assemblies
- Lee et al. (2021). Balancing selection maintains hyper-divergent haplotypes in Caenorhabditis elegans
- Seidel et al. (2008). Widespread genetic incompatibility in C. elegans maintained by balancing selection
- Seidel et al. (2011). A novel sperm-delivered toxin causes late-stage embryo lethality and transmission ratio distortion in C. elegans
- Palopoli et al. (2008). Molecular basis of the copulatory plug polymorphism in Caenorhabditis elegans
- Blevins et al. (2026). A male expressed copulatory plug increases female fertility in Caenorhabditis nematodes (preprint)
- Ben-David et al. (2017). A maternal-effect selfish genetic element in Caenorhabditis elegans
- Liu and Zheng (2026). sept-1/zina-1 is an ancient toxin-antidote system in Caenorhabditis elegans
- Ghosh et al. (2012). Natural variation in a chloride channel subunit confers avermectin resistance in C. elegans
- O'Connor et al. (2026). The Caenorhabditis elegans pangenome elucidates hyper-divergent region gene content to reveal extensive gene copy-number variation and a novel anthelmintic resistance locus (preprint)
Notes
-
JU310's assembly has the whole Cer1 within one contig, flanks included, while Blevins et al. (2026) call JU310 plugging from short reads. ↩
Feedback on this tutorial is welcome: contact us.