ClinVar Small-Variant Classifications¶
This example shows ClinVar small variants in a zoomed DSG2 region on hg38. It recreates the small-variant classification view described in NCBI's "New ClinVar graphical display" post: each variant is placed by genomic position, while vertical position and color encode the germline classification.
{
"description": [
"ClinVar Small-Variant Classifications",
"Recreates NCBI's ClinVar graphical classification view for small variants in a DSG2 region, using genomic position, row placement, and color to show germline classifications.",
"Data source: mirrored copy of the ClinVar GRCh38 VCF release from NCBI FTP (`/pub/clinvar/vcf_GRCh38/`). Terms: attribute ClinVar as the data source."
],
"assembly": "hg38",
"name": "clinvar",
"title": {
"text": "ClinVar Variants",
"style": "overlay"
},
"height": { "step": 13 },
"view": { "fill": "#f8f8f8" },
"scales": {
"x": {
"domain": [
{ "chrom": "chr18", "pos": 31524101 },
{ "chrom": "chr18", "pos": 31525003 }
]
}
},
"layer": [
{
"name": "baseline",
"data": {
"values": [{}]
},
"mark": {
"type": "rule",
"color": "lightgray"
},
"encoding": {
"y": { "datum": "Uncertain significance", "type": "ordinal" }
}
},
{
"data": {
"lazy": {
"type": "vcf",
"url": "https://data.genomespy.app/sample-data/clinvar_20241215.vcf.gz",
"addChrPrefix": true,
"windowSize": 1000000
}
},
"transform": [
{
"type": "formula",
"expr": "replace(datum.INFO['CLNSIG'], /_/g, ' ')",
"as": "Germline classification"
},
{
"type": "regexExtract",
"field": "Germline classification",
"regex": "^([^/]+)",
"as": "Germline classification"
},
{
"type": "formula",
"expr": "replace(datum['Germline classification'], /^Conflicting.*/g, 'Conflicting')",
"as": "Germline classification"
},
{
"type": "filter",
"expr": "datum['Germline classification'] == 'Pathogenic' || datum['Germline classification'] == 'Likely pathogenic' || datum['Germline classification'] == 'Uncertain significance' || datum['Germline classification'] == 'Likely benign' || datum['Germline classification'] == 'Benign' || datum['Germline classification'] == 'Conflicting'"
}
],
"layer": [
{
"name": "sticks",
"mark": {
"type": "rule",
"tooltip": false
},
"encoding": {
"y2": { "datum": "Uncertain significance" }
}
},
{
"name": "balls",
"mark": {
"type": "point",
"size": 80,
"geometricZoomBound": 13
}
}
],
"encoding": {
"x": {
"chrom": "CHROM",
"pos": "POS",
"type": "locus",
"offset": 1
},
"y": {
"field": "Germline classification",
"type": "ordinal",
"scale": {
"domain": [
"Pathogenic",
"Likely pathogenic",
"Uncertain significance",
"Likely benign",
"Benign",
"Conflicting"
]
},
"axis": {
"title": "Classification"
}
},
"color": {
"field": "Germline classification",
"type": "ordinal",
"scale": {
"domain": [
"Pathogenic",
"Likely pathogenic",
"Uncertain significance",
"Likely benign",
"Benign",
"Conflicting"
],
"range": [
"firebrick",
"orange",
"#f0f000",
"#00a000",
"darkgreen",
"gray"
]
}
}
}
}
]
}
The visualization uses a mirrored copy of the ClinVar GRCh38 VCF release from NCBI's ClinVar FTP downloads. ClinVar asks that redistributed data be attributed to ClinVar as the data source.
What to notice¶
The track uses a lollipop-like encoding for variant classifications. Each variant has a point at its classification row and a rule that connects it to the uncertain-significance baseline. This makes pathogenic, benign, uncertain, and conflicting classifications easy to compare across the visible locus.
The source VCF stores clinical significance values in the CLNSIG INFO field.
The spec normalizes those values by replacing underscores, taking the first
slash-delimited classification, and grouping conflicting interpretations under a
single category.
GenomeSpy Features¶
This example combines several GenomeSpy capabilities in one compact track:
- Lazy data sources load only the visible VCF records from a tabix-indexed file.
formulaandregexExtractderive a user-facing germline classification fromCLNSIG.filterkeeps the classification categories shown in the track.- The
locusscale maps VCF chromosome and position fields to genomic coordinates. layercombines the baseline, rules, and points.- Ordinal position and color scales use the same classification domain so the rows and colors stay aligned.