Composing a Genome Browser¶
This example builds a genome-browser-like visualization by importing existing track specifications and stacking them vertically. The imported cytoband, six-frame translation, BAM alignment, and gene annotation views can also be used independently.
{
"description": [
"A genome-browser-like view with multiple tracks",
"Combines existing visualizations into a genome-browser-like view with multiple tracks sharing the x-axis.",
"Data source: See the imported specifications."
],
"assembly": "hg38",
"scales": {
"x": {
"domain": [
{ "chrom": "chr20", "pos": 10006452 },
{ "chrom": "chr20", "pos": 10006533 }
]
}
},
"resolve": { "axis": { "x": "shared" } },
"axes": { "x": { "orient": "top", "title": null } },
"vconcat": [
{ "import": { "url": "docs/examples/genomic-data/cytobands.json" } },
{
"import": {
"url": "docs/examples/genomic-data/indexed-fasta-six-frame-translation.json"
}
},
{
"import": { "url": "docs/examples/genomic-data/bam-read-alignments.json" }
},
{
"import": { "url": "docs/examples/genomic-data/scored-refSeq-genes.json" }
}
],
"config": { "legend": { "disable": true } }
}
This composed view uses the data sources described in the individual cytoband, six-frame translation, BAM alignment, and RefSeq gene annotation examples. See those pages for source details and applicable disclaimers.
What to notice¶
The parent view supplies the genomic region and a shared x-axis for the whole composition. Its view-level scale and axis properties take precedence over the standalone defaults in the imported tracks, so the tracks remain aligned and pan and zoom together.
Because the tracks are imported rather than copied, improvements to the standalone visualizations are automatically available in the composed genome browser.
GenomeSpy Features¶
- View imports reuse complete visualization specifications as tracks.
vconcatstacks the imported tracks vertically.- View-level scale properties set the shared genomic domain for the composition.
- View-level axis properties place one shared x-axis above the tracks.
resolvemakes the x-axis shared across the imported tracks.