Local ancestry (Dog10K)
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.22. Desktop beta builds for Linux and
macOS are on the releases page;
the Windows build waits on code signing.
Two of the Dog10K breeds are wolf hybrids, so some stretches of their genome trace back to a gray wolf ancestor and the rest to domestic dogs. FLARE calls which of the two sources each stretch of DNA came from, against a wolf panel and a panel of breed dogs, and a converter merges its per-marker calls into BED blocks. Along chr1 of the wolfdogs, held-out wolves and other breeds, we:
- load the blocks as a multi-row feature track, one colored row per haplotype (one copy of a chromosome)
- order the rows with
rows.sortand key the BED's colors with an identity color scale - read the wolf blocks along chr1 in the wolfdogs against held-out wolves and a German Shepherd
- cluster a track of every animal with Clustering → Cluster rows by similarity...
Prerequisites
- the
UU_Cfam_GSD_1.0dog assembly (UCSC's canFam4) set up in JBrowse. The canFam4 hub on genomes.jbrowse.org is a config that loads it with its gene and repeat tracks, and the assemblies guide builds one by hand. These tracks read only itschrom.sizes. - Java 8+, for FLARE
bcftoolsbuilt with libcurlcurlpython3- htslib (
bgzip,tabix) node, for the JBrowse CLI
# Debian/Ubuntu
sudo apt install bcftools tabix nodejs
# or conda, which has every tool above
conda install -c bioconda -c conda-forge bcftools htslib nodejs
# any platform
npm install -g @jbrowse/cli@nextflare.jar is a single download from FLARE's
releases page. The painted BED
is a local file, so JBrowse Desktop opens it by
path, while JBrowse Web needs it served.
The data
The Dog10K consortium's public phased reference panel (Meadows et al. 2023), plus a canFam4 genetic map published separately.
The tracks below read local files that the build script writes from these, so run it first, or run The files FLARE reads and writes on a phased VCF, reference panels and genetic map of your own. The script fetches everything itself.
| What it is | File |
|---|---|
| The phased reference panel of 1929 canids FLARE runs against | AutoAndXPAR.Dog10K.phased.bcf |
| The sample table, breed and category labels the panels and targets are derived from | dog10K-alignment-sample-table.2022-02-23-v7.txt |
| The Campbell pedigree map, transitioned onto the assembly of this panel (Wang et al. 2025) | campbell_sex_average_canFam4.tar.gz |
Loading the UU_Cfam_GSD_1.0 dog assembly
UU_Cfam_GSD_1.0 is the Dog10K reference that UCSC calls canFam4. We load it
from UCSC's 2bit, with the alias file that maps the chr names to GenBank
accessions:
Goes in the assemblies array of config.json. See Assemblies.
{
"name": "UU_Cfam_GSD_1.0",
"aliases": ["canFam4"],
"sequence": {
"adapter": {
"type": "TwoBitAdapter",
"uri": "https://hgdownload.soe.ucsc.edu/goldenPath/canFam4/bigZips/canFam4.2bit"
}
},
"refNameAliases": {
"uri": "https://hgdownload.soe.ucsc.edu/goldenPath/canFam4/bigZips/canFam4.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/canFam4/bigZips/canFam4.2bit \
--name UU_Cfam_GSD_1.0 \
--alias canFam4 \
--refNameAliases https://hgdownload.soe.ucsc.edu/goldenPath/canFam4/bigZips/canFam4.chromAlias.txtTwo wolfdog breeds and their wolf blocks
Local ancestry labels each stretch of a chromosome with the reference panel (a labelled set of animals) it most resembles. The Dog10K consortium's panel of 1929 canids includes both wolfdog breeds, gray wolves and many breed dogs. As targets, FLARE paints one dog from each breed with enough sequenced animals, to catch a wolf cross in any breed, plus:
- The two wolfdog breeds: the Saarloos Wolfdog and the Czechoslovakian Wolfdog are 20th-century crosses between German Shepherd Dogs and captive gray wolves, bred back to dogs afterwards. Each should have wolf-derived haplotype blocks on a dog background, and a German Shepherd essentially none.
- The Shiloh Shepherd, from the Dog10K paper's discussion of wolf-like dogs, shares more of its doubleton (F2) sites, those present on only two chromosomes, with wolves than any other breed dog in the collection.
- The Tamaskan, from the same discussion, is a wolf-lookalike bred from ordinary sled and herding dogs.
- Eight European wolves, held out of the wolf panel.
The files FLARE reads and writes
Every file between the phased panel and the painted track is text, VCF or BED:
Choosing the wolf and dog reference panels
FLARE compares each target animal against a wolf panel and a dog panel. The build script derives both lists from the sample table's breed and category per animal: European gray wolves for the wolf panel, and one dog from every breed for the dog panel, minus the targets and both wolfdog breeds. The dog panel has to include the breed of each target, or the ordinary haplotypes of that target have no close match there.
Each animal is painted against panels that exclude it:
- the script removes the eight gray wolves from the wolf panel, since a target matched against itself is painted solid
- each target dog comes out of the dog panel while another dog of its breed stays in, so a Chow Chow is painted against a different Chow Chow
FLARE reads the two lists as one ref-panel file:
CLUPGR000001 Wolf
CLUPGR000002 Wolf
AFFN000001 Dog
AFGH000001 DogSlicing one chromosome out of the phased BCF
The panel is a single large BCF, which bcftools reads over HTTP by range
request. The chromosome subset splits into chr1.ref.vcf.gz (the two panels)
and chr1.gt.vcf.gz (the targets).
PANEL=https://kiddlabshare.med.umich.edu/dog10K/phased-imputation-panel/AutoAndXPAR.Dog10K.phased.bcf
# -r fetches one chromosome of the 6 GB file by range request
# the two later views re-slice that local subset
bcftools view -r chr1 -S all.txt --force-samples -Oz -o chr1.subset.vcf.gz "$PANEL"
bcftools view -S <(cat wolves.txt dogs.txt) --force-samples \
-Oz -o chr1.ref.vcf.gz chr1.subset.vcf.gz
bcftools view -S targets.txt --force-samples -Oz -o chr1.gt.vcf.gz chr1.subset.vcf.gzall.txt, wolves.txt, dogs.txt and targets.txt list one sample per line.
Reshaping the Campbell genetic map for FLARE
FLARE requires a genetic map in four PLINK columns: chromosome, marker ID,
genetic position in cM and base-pair position. The build script reshapes the
Campbell pedigree map's POS/rate/Map(cM) columns into them, and the
chromosome names must match the VCF's. With no map for your organism, write one
at a constant rate per megabase from the assembly's chrom.sizes; segment edges
are then approximate.
Running FLARE
FLARE takes the two panel VCFs, the ref-panel file and the map, and writes
wolfdog_chr1.anc.vcf.gz plus a summary:
# FLARE draws random samples while it infers, so two runs of the same input
# give slightly different block boundaries unless the seed is pinned.
# seed=42 any fixed number, so a re-run reproduces this painting exactly
# -Xmx12g the Java memory ceiling; raise it for more targets or a longer
# chromosome, since FLARE exits with an OutOfMemoryError past it
# out= a prefix; FLARE appends .anc.vcf.gz and .global.anc.gz
java -Xmx12g -jar flare.jar ref=chr1.ref.vcf.gz ref-panel=refpanel.txt \
gt=chr1.gt.vcf.gz map=chr1.map out=wolfdog_chr1 seed=42wolfdog_chr1.global.anc.gz is the per-sample summary, and chr1 alone is enough
to rank the targets:
SAMPLE Wolf Dog
CLUPRU000001 0.996 0.004 held-out gray wolf
SAAR000001 0.446 0.554 Saarloos Wolfdog
CZEC000003 0.281 0.719 Czechoslovakian Wolfdog
SHIL000001 0.225 0.775 Shiloh Shepherd
THAI000009 0.08 0.92 top of the 219-breed sweep
TMSK000001 0.033 0.967 Tamaskan
GRSD000002 0 1 German Shepherd DogThe wolfdogs sit far above the swept breeds, apart from one Czechoslovakian
Wolfdog (CZEC000002) that falls within their range and has no long block
anywhere.
Merging FLARE's calls into BED blocks
FLARE writes per-marker calls into the AN1/AN2 FORMAT fields of
wolfdog_chr1.anc.vcf.gz.
flare_anc_to_bed.py
merges each haplotype's run of identical calls into one BED9 line and colors by
ancestry via itemRgb. labels.tsv has two tab-separated columns, a sample
name and a row label. Each listed sample gets the rows <label> hap1 and
<label> hap2, in file order, and an unlisted sample is skipped:
curl -fO https://raw.githubusercontent.com/GMOD/jbrowse-components/main/scripts/flare_anc_to_bed.py
python3 flare_anc_to_bed.py wolfdog_chr1.anc.vcf.gz labels.tsv ancestry.chr1.bedThe BED sorts and indexes like any other BED track. The build script sorts inline to run without node:
jbrowse sort-bed ancestry.chr1.bed | bgzip > ancestry.chr1.bed.gz
tabix -C -p bed ancestry.chr1.bed.gzEach output line looks like this:
#chrom chromStart chromEnd name score strand thickStart thickEnd itemRgb sample ancestry
chr1 49135137 57939751 Wolf 0 . 49135137 57939751 230,159,0 Czechoslovakian 1 hap1 WolfThe last two columns hold the block's row and its called ancestry, and the #
header names them, so the track config needs no columnNames. The build script
runs the converter twice:
labels.tsvover every target, intodog10k_wolfdog_ancestry.chr1.bed.gznamed.tsvover the animals the figure names, intodog10k_wolfdog_named.chr1.bed.gz, the file the track below loads
Loading the blocks as a multi-row track
The multi-row feature display (LinearMultiRowFeatureDisplay) draws one row per
sample. In grammar-of-graphics terms,
rows assigns the rows and rows.sort orders them, and encoding.color is a
color scale whose scale.type: "identity" names the BED's itemRgb colors in
the key.
Goes in the tracks array of config.json. See Tracks.
{
"type": "FeatureTrack",
"trackId": "dog10k_wolfdog_named",
"name": "Local ancestry, named animals (FLARE, chr1)",
"assemblyNames": ["UU_Cfam_GSD_1.0"],
"adapter": {
"type": "BedTabixAdapter",
"disableGeneHeuristic": true,
"uri": "dog10k_wolfdog_named.chr1.bed.gz",
"csi": true
},
"displays": [
{
"type": "LinearMultiRowFeatureDisplay",
"rows": {
"field": "sample",
"sort": [
"Gray wolf 7 hap1",
"Gray wolf 7 hap2",
"Saarloos 1 hap1",
"Saarloos 1 hap2",
"Czechoslovakian 3 hap1",
"Czechoslovakian 3 hap2",
"German Shepherd hap1",
"German Shepherd hap2"
]
},
"encoding": {
"color": {
"scale": {
"type": "identity",
"domain": ["rgb(0,114,178)", "rgb(230,159,0)"],
"names": ["Breed dog", "Gray wolf"]
},
"legend": { "title": "Ancestry (FLARE)" }
}
}
}
]
}Edits config.json in the current folder. See JBrowse CLI with Desktop.
jbrowse add-track-json '{
"type": "FeatureTrack",
"trackId": "dog10k_wolfdog_named",
"name": "Local ancestry, named animals (FLARE, chr1)",
"assemblyNames": ["UU_Cfam_GSD_1.0"],
"adapter": {
"type": "BedTabixAdapter",
"disableGeneHeuristic": true,
"uri": "dog10k_wolfdog_named.chr1.bed.gz",
"csi": true
},
"displays": [
{
"type": "LinearMultiRowFeatureDisplay",
"rows": {
"field": "sample",
"sort": [
"Gray wolf 7 hap1",
"Gray wolf 7 hap2",
"Saarloos 1 hap1",
"Saarloos 1 hap2",
"Czechoslovakian 3 hap1",
"Czechoslovakian 3 hap2",
"German Shepherd hap1",
"German Shepherd hap2"
]
},
"encoding": {
"color": {
"scale": {
"type": "identity",
"domain": ["rgb(0,114,178)", "rgb(230,159,0)"],
"names": ["Breed dog", "Gray wolf"]
},
"legend": { "title": "Ancestry (FLARE)" }
}
}
}
]
}'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": "dog10k_wolfdog_named",
"name": "Local ancestry, named animals (FLARE, chr1)",
"assemblyNames": ["UU_Cfam_GSD_1.0"],
"adapter": {
"type": "BedTabixAdapter",
"disableGeneHeuristic": true,
"uri": "dog10k_wolfdog_named.chr1.bed.gz",
"csi": true
},
"displays": [
{
"type": "LinearMultiRowFeatureDisplay",
"rows": {
"field": "sample",
"sort": [
"Gray wolf 7 hap1",
"Gray wolf 7 hap2",
"Saarloos 1 hap1",
"Saarloos 1 hap2",
"Czechoslovakian 3 hap1",
"Czechoslovakian 3 hap2",
"German Shepherd hap1",
"German Shepherd hap2"
]
},
"encoding": {
"color": {
"scale": {
"type": "identity",
"domain": ["rgb(0,114,178)", "rgb(230,159,0)"],
"names": ["Breed dog", "Gray wolf"]
},
"legend": { "title": "Ancestry (FLARE)" }
}
}
}
]
}dog10k_wolfdog_named.chr1.bed.gz is relative to a config.json. Replace it with its URL or its path on this computer.
Advanced → Edit plot... in the track menu shows rows and encoding as
text and applies edits live.
rows.sort is abbreviated here; the build script writes every row in descending
order of chr1 wolf fraction from FLARE's summary. For your own animals:
- omit
sortand cluster the rows, or list the animals in the order you want - load a second BED of all the animals the same way, with no
sort: at two rows per animal there is no room for labels, so the named-animals track shows the labels and the all-animals track the extent
Wolf blocks along chr1 in wolfdogs and controls
Open the whole of chr1 with the named-animals track:
Each pair of rows is the two chromosome copies of one animal. Orange marks a stretch resembling a present-day gray wolf more than a breed dog. Wolf on one row and dog on the other is heterozygous, and both orange is homozygous wolf-derived.
Blocks break up towards the end of chr1, tracking the genetic map.
Held-out wolves where FLARE and allele counts disagree
Most held-out wolves come out essentially all wolf. The two Swedish museum specimens come out partly dog in FLARE's calls, yet score highest of the held-out wolves on a second measure the build script prints, the fraction of near-fixed differing sites with the wolf allele. That measure scores one site at a time, where FLARE matches whole haplotypes against a panel.
How long the Tamaskan's and Shiloh Shepherd's wolf blocks run
The build script prints a count of wolf blocks with their median and longest, one line per animal:
- The Tamaskan's wolf blocks are many and short, no longer than ordinary breeds' (the Kars, the Eurasier, the Spanish Mastiff).
- The Shiloh Shepherd has the longest wolf block of any dog outside the two wolfdog breeds, and many more blocks than the runner-up, a Great Anglo-French Tricolor Hound. A later genome-wide run over the same collection puts it among the three dogs with the longest, most recent wolf tracts (Lin et al. 2025).
Clustering → Cluster rows by similarity... in the track menu orders the rows of the full-cohort track by their blocks. It puts the held-out wolves on a small branch with the wolfdog haplotypes with the most wolf, apart from the breed dogs. Clustering runs over the region in view, and a chip in the corner of the tree shows the locus.
Reproduce it end to end
build_dog10k_wolfdog_ancestry.sh
runs every step above. It:
- derives the panel and target lists and slices the chromosome
- generates the map and runs FLARE
- writes both painted BEDs
(
flare_anc_to_bed.py) plus indexes - prints every measurement read above and, for each painted block edge, how many ancestry-informative markers each haplotype has on either side. The long wolfdog blocks have marker support at their edges, and the short blocks in ordinary breeds lack it.
curl -fO https://raw.githubusercontent.com/GMOD/jbrowse-components/main/scripts/build_dog10k_wolfdog_ancestry.sh
bash build_dog10k_wolfdog_ancestry.sh # chr1, into ./dog10k_wolfdog_build
bash build_dog10k_wolfdog_ancestry.sh chr38 # any other autosomeSee also
- Tutorial: Structural variants (Dog10K)
- Tutorial: A loss-of-function allele across breeds (Dog10K)
- Tutorial: A selected haplotype (Dog10K)
- Tutorial: Phased trio analysis (1000 Genomes)
- Tutorial: QTL mapping (BXD mice)
- User guide: Multi-row feature track
- User guide: Variant sample rows
Citations
- Meadows et al. (2023). Genome sequencing of 2000 canids by the Dog10K consortium advances the understanding of demography, genome function and architecture
- Browning et al. (2023). Fast, accurate local ancestry inference with FLARE
- Lin et al. (2025). A legacy of genetic entanglement with wolves shapes modern dogs, local ancestry over the same collection
- Campbell et al. (2016). A pedigree-based map of recombination in the domestic dog genome, the genetic map used here, in the canFam4 transition published with Wang et al. (2025), Fine-scale recombination rates inferred using the canFam4 assembly
Feedback on this tutorial is welcome: contact us.