# Visualization Overview

`ccnv predict` generates a self-contained, offline interactive WebGL/SVG genome copy-number profile at `<prefix>_plot.html` (enabled by default via `--plot`, disabled with `--no-plot`, and enriched automatically on GRCh38/`hg38` samples with cytogenetic bands and curated clinical genes, or overridden via `--cytobands` and `--genes`). Rendered by `render_genome_plot` ([API Reference](/ccnv/api/ccnv/report/html/#ccnv.report.html.render_genome_plot)), the viewer embeds a vendored, gzip-compressed Plotly.js (`2.35.2` `gl2d`) bundle inflated client-side via `DecompressionStream("gzip")` (supported in Chrome 80+, Edge 80+, Safari 16.4+, and Firefox 113+) alongside base64-encoded sample coordinates, copy-number signals, segment calls, gene annotations, and optional prenatal metrics inside a single HTML file with no backend server or internet/CDN requests.

![Offline HTML genome viewer assembly metro map](/ccnv/diagrams/visualization-assembly.svg)

---

## 1. What Is Visualized

### 1.1 Multi-Chromosome Axis & Alternating Contig Canvas

Modeled contigs present across bins and segments (falling back to cytoband contigs only when both bins and segments are empty, filtered to positive length in `contig_lengths`) appear left-to-right in natural sort order (`natural_sort_key`, e.g., `chr1`–`chr22`, `chrX`, `chrY`, or organism-specific header contigs). Each contig spans its proportional physical length across a unified $[0, \text{totalLen}]$ horizontal axis with $45^{\circ}$-angled contig names centered on each chromosome, alternating white (`#ffffff`) and pale slate (`#f8fafc`) background bands on odd-indexed contigs, and crisp $1\text{ px}$ `#e2e8f0` vertical chromosome boundaries.

Sex-chromosome axis behavior follows the modeled prediction branches. `chrX` is plotted across germline female (`female_sex`), germline male (`male_sex`), and prenatal (`female_sex` diploid `XX` baseline) modes. `chrY` is plotted in germline male (`male_sex`) and prenatal male-fetus (`fetal_sex == "M"`, normalized on `prenatal_ffy` against a $5\text{ kb}$ FF-calibrated 1-copy MSY baseline where euploid `XY` centers at $\log_2 R = 0$, `47,XYY` segment ratios shift to $\approx +1.0$ with a purple `SCA_DISCORDANT` highlight, and focal MSY deletions shift negative, while individual $5\text{ kb}$ bin dots reflect `+0.5` pseudocount smoothing at low-pass depth), and omitted when unmodeled (germline female or prenatal `fetal_sex == "F"`).

### 1.2 `log2` Ratio Scale & Extreme Value Clamping

The vertical axis plots normalized copy-number $\log_2$ ratios ($\log_2 R$) across a fixed viewport range of $[-2.5, +2.5]$ (`fixedrange: true`) with a solid `#64748b` neutral reference line at $\log_2 R = 0.0$ and `#f1f5f9` horizontal grid lines. Any bin or segment whose true $\log_2 R$ falls below $-2.5$ (such as deep homozygous deletions) or above $+2.5$ (such as high-copy amplifications) is visually clamped to the $\pm 2.5$ boundary so extreme events stay visible on the canvas while hover tooltips report the exact unclamped values.

### 1.3 Bin Cloud & Outlier-Preserving M4 Decimation

Every unmasked bin (`masked == False` and finite `ratio`) is plotted at its genomic midpoint $\text{offset}_c + \frac{1}{2}(\text{start}_i + \text{end}_i)$ across three WebGL `scattergl` layers (**Neutral**, **Gain**, and **Loss**). Because whole-genome $5\text{ kb}$ profiles exceed $600{,}000$ bins, `decimate_bins_m4` caps plotted points strictly at `max_plot_bins` (default `48,000`) across the unified genome axis by reserving up to $\lfloor \text{max\_plot\_bins} / 2 \rfloor$ slots for outlier bins with $\vert z_i \vert \ge \min(3.0, z_{\text{threshold}})$ (or $\ge 3.0$ when $z_{\text{threshold}} \le 0$), partitioning `m4_budget = max(4, max_points - outlier_reserve)` into $\max(1, \lfloor \text{m4\_budget} / 4 \rfloor)$ equal-width buckets (up to $12{,}000$ when no outliers exist) to keep four M4 envelope points per bucket (`first`, `argmin`, `argmax`, `last`), and downsampling any excess outliers via per-bucket min/max extrema. This preserves visual extrema and candidate focal calls while keeping HTML file size and WebGL rendering bounded.

### 1.4 Segment Tracks & Initial vs. Live Threshold Calling

Contiguous change-point segments from `SegmentResult` render on the WebGL `scattergl` layer after all bin traces so horizontal step lines spanning exact $[\text{offset}_c + \text{start}, \text{offset}_c + \text{end}]$ coordinates at their segment $\log_2 R$ appear above bin dots:

- **Initial Render (Backend Calls)**: When the toolbar thresholds match the run's configured `z_threshold` and `ratio_threshold`, non-discordant segments use the exact backend calls stored in `segment_calls` (reflecting precision-weighted segment Z-scores adjusted for neighboring-bin correlation, BH-FDR $q \le 0.05$, and integer copy-number Bayes factors $\ln \mathrm{BF} \gt 2.0$ in germline mode, as detailed in [Mathematical Methodology](../methodology.md)).
- **Interactive Recalculation**: Adjusting `|Z| >=` or `|Log2R| >=` in the top toolbar triggers a `100 ms` debounced client-side reclassification of bin markers and non-discordant segments using **Gain** ($\vert Z \vert \ge z_T$, $\vert \log_2 R \vert \ge r_T$, $\log_2 R \gt 0$, $Z \ge 0$), **Loss** ($\vert Z \vert \ge z_T$, $\vert \log_2 R \vert \ge r_T$, $\log_2 R \lt 0$, $Z \le 0$), or **Neutral** otherwise.

### 1.5 Prenatal Mode Overlays (`--mode prenatal`)

When rendered from a prenatal run (`prenatal_result` present), the viewer adds three cell-free DNA diagnostic layers:

- **Prenatal Status Banner**: Displays inferred `Fetal Sex` (showing `Twins (F/M)`, `Twins (F/F)`, or `Twins (M/M)` when `gestation == "twin"` and `fetal_sexes` is available), fused `Active FF` (with winning estimator source), individual fetal fraction readouts `FF (Y/A/X/Size)`, a combined `Twin FF (M/F)` readout when both `male_ff` and `female_ff` are available, and joint 4-channel sex-chromosome aneuploidy classification (`SCA`).
- **Expected Fetal Fraction Reference Lines**: Draws two horizontal dashed purple (`#9333ea`) guidelines ($y_{+}$ and $y_{-}$, defined below) across all diploid maternal+fetal chromosomes (`chr1`–`chr22` and `chrX`, stopping before haploid `chrY`) showing the expected $\log_2$ ratio shifts for pure fetal heterozygous trisomy ($CN_{\text{fet}} = 3$) and monosomy ($CN_{\text{fet}} = 1$) computed from `effective_ff` ($f_{\text{eff}}$, or `active_ff` when unweighted). In twin pregnancies, these horizontal guidelines track expected twin total `effective_ff` ($F_{\text{total,eff}}$), whereas each segment's `Expected` hover field reflects single-fetus `f_min_eff` (approximately half as large in equal-contribution twins).
- **High-Contrast Discordant Segment Track**: Segments flagged `discordant == True` (`SCA_DISCORDANT`, `SUB_FETAL_RATIO`, or `SUPER_FETAL_RATIO`, e.g., maternal constitutional/mosaic events or confined placental mosaicism) override standard Gain/Loss/Neutral coloring and render as thick (`6.0 px`) purple lines capped with diamond endpoint markers (`◆`), highlighting discordant dosage balance and biological origin predictions (`origin_call`).

$$
y_{+} = \log_2\left(1 + \frac{1}{2} f_{\text{eff}}\right), \qquad y_{-} = \log_2\left(\max\left(10^{-4}, 1 - \frac{1}{2} f_{\text{eff}}\right)\right)
$$

### 1.6 Cytoband Ideogram Track (Bundled GRCh38 & `--cytobands`)

When canonical chromosome names (`chr1`–`chr22`, `chrX`, `chrY` or `1`–`22`, `X`, `Y`) match exact GRCh38 (`hg38`) base-pair lengths without conflicting canonical contigs (or when a custom track is supplied via `--cytobands`) and at least one cytoband overlaps the modeled plot contigs, the viewer allocates the top strip of the canvas (`yaxis2`, domain `[0.93, 1.00]` when genes are also active, or `[0.92, 1.00]` otherwise) above the copy-number panel to a synchronized cytogenetic band strip labeled `Band` scoped to modeled plot contigs. Each cytoband draws as a colored rectangle (`y0 = 0.15` to `y1 = 0.85`) shaded by Giemsa stain intensity, with invisible midpoint hover targets revealing band coordinates and stain codes.

### 1.7 Clinical Gene Track (Bundled GRCh38 & `--genes`)

When canonical chromosome lengths match GRCh38 (`hg38`) without conflicts (auto-loading the bundled open-license ClinGen + GenCC clinical and dosage-sensitive protein-coding catalog documented in [Bundled Gene Track Provenance](#4-bundled-gene-track-provenance)) or when a custom BED4+/TSV or GTF/GFF3 file is passed via `--genes`, the viewer allocates the bottom 22% of the canvas (`yaxis3` at `[0.00, 0.22]` beneath `Log2 Ratio` `[0.25, 0.91]`, or `yaxis2` at `[0.00, 0.22]` beneath `[0.25, 1.00]` when cytobands are absent) to a synchronized `Genes` strip anchored directly above the chromosome X-axis labels:

- **Four-Lane Staggered Gene Bars & Live CNV Coloring**: Overlapping and closely spaced genes pack deterministically across four vertical lanes (`y` in `{0.72, 0.50, 0.28, 0.06}`) as WebGL `scattergl` interval bars with hover tooltips at every zoom scale. Gene bars update color live with active `|Z| >=` and `|Log2R| >=` thresholds: crimson `#c43c39` on **Gain** segments, forest `#3c8c5a` on **Loss** segments, purple `#9333ea` on prenatal **Discordant** segments, and dark slate `#334155` on **Neutral** regions.
- **Zoom-Adaptive Non-Overlapping Gene Symbols ($\le 250\text{ Mb}$)**: Whenever the horizontal viewport spans $\le 250\text{ Mb}$ (covering single-chromosome views as well as box/scroll zoom, gene/coordinate search, or clicking an aberration row), greedy pixel-width interval packing renders collision-free gene symbol labels with strand orientation (`BRCA2 ▸` on `+`, `◂ BRCA1` on `-`), prioritizing aberration-overlapping genes when crowded and updating only the single label trace via `Plotly.restyle`.

### 1.8 Collapsible Aberrations Table

Below the WebGL plot canvas, `<prefix>_plot.html` renders a synchronized collapsible bottom split-pane (`#aberrations-panel`, expanding to `30vh` by default whenever one or more aberrations are called and auto-collapsing to a single header bar when zero aberrations are present). At the configured `z_threshold` and `ratio_threshold`, rows mirror `<prefix>_calls.bed.gz` via `segment_calls` (plus `SCA_DISCORDANT` sex-chromosome segments in prenatal mode); editing `|Z| >=` or `|Log2R| >=` updates the table live with a `Custom thresholds` warning badge while rendering `CN` as `—` whenever a previously neutral segment is promoted solely by relaxed custom numeric inputs ($q \le 0.05$) so stale baseline `CN` labels (`2` on diploid branches, `1` on haploid sex branches) never appear on promoted rows. Runs display `Region`, `Cytoband` (rendered automatically when cytobands are active, e.g., `17p11.2` or `17p12-p11.2`), `Genes` (rendered automatically when genes are active, previewing up to 4 overlapping symbols plus `(+N)` with a bounded hover list and missing-last sort order), `Size`, `Type` (`GAIN` / `LOSS`, plus a `DISCORDANT` badge on discordant prenatal segments), `CN` (`0`, `1`, `2`, `3`, `4+`, or `—`; `—` on diploid prenatal segments where maternal-fetal mixtures lack sample-wide integer ploidy, and discrete MSY `CN` on male-fetus `chrY`), `Log2R`, `Z-score`, `q-value` (rendering float64 underflow at `0` as `<1e-300`), and `Bins`; prenatal runs append `Origin` (including mosaic percentage when finite), `Implied FF` (capped at `100%`, with expected $\log_2 R$ hover tooltip), and `Discordance`.

---

## 2. Interactive Controls, Navigation & Hover Tooltips

The top control bar, Plotly WebGL canvas, and bottom aberrations panel support interactive inspection without re-running `ccnv predict`:

- **Genomic Coordinate, Cytoband & Gene Search (`Go`)**: Accepts contig names (`chr21` or `21`), intervals (`chr21:13.1m-46.7m`, supporting commas and `k`/`kb`/`m`/`mb` suffixes), single positions (`chr21:15m`, zooming to a $100\text{ kb}$ window), cytoband names and spans (`21q22.11`, `chr21q22`, `17p12-p11.2`) when cytobands are active, or case-insensitive gene symbols (`BRCA1`, `NKX2-1`, or contig-qualified `chrY:SHOX`) when genes are active. Pressing `Enter` or clicking `Go` zooms the x-axis directly; `Whole Genome` resets to `[0, totalLen]`.
- **Threshold Filters (`|Z| >=` and `|Log2R| >=`)**: Live numeric controls re-bin and re-color neutral, gain, and loss clouds, segments, gene bars, and aberrations table rows after `100 ms` without resetting your current horizontal zoom window.
- **Aberrations Table Filtering, Sorting, Click-to-Zoom & TSV Export**: Filter pills (`All`, `Gain`, `Loss`, plus `Discordant` in prenatal mode) narrow visible calls, clicking any column header toggles ascending/descending sort order, clicking any row highlights the segment and zooms `#plot` to $[\text{start} - \text{pad}, \text{end} + \text{pad}]$ where $\text{pad} = \max(\mathrm{round}(0.5 \times \text{size}), 250\text{ kb})$ clamped within the chromosome, `Aberrations (N)` collapses or expands the pane while resizing the Plotly canvas, and `Export TSV` downloads currently visible sorted rows offline as `<sample>_aberrations.tsv` (`contig`, `start`, `end`, `size_bp`, optional `cytoband`, optional `gene_count` and `genes`, `type`, `copy_number`, `log2_ratio`, `zscore`, `q_value`, `bins`, plus `origin`, `mosaic_fraction`, `implied_ff`, `expected_log2r`, `discordant`, `discordance_reason`, `frag_short_ratio`, `frag_llr_size` in prenatal mode).
- **Bin Hover Card**: Hovering over any `scattergl` bin dot opens a dark floating tooltip displaying `<contig>:<start>-<end>` alongside unclamped `Log2R` (3 decimals) and `Z` (2 decimals).
- **Segment, Cytoband & Gene Hover Text**: Hovering over a segment line reports `<contig>:<start>-<end> (<N> bins)`, `Segment Log2R | Z`, overlapping `Genes (N)` preview when genes are active, and in prenatal mode appends `Short Frag` percentage, `LLR_size`, `origin_call` (or `Origin: <call>`), and discordant diagnostics (`Discordant: <reason>`, `Expected`, and `Implied FF`). Hovering over the top `Band` strip reports `<contig><band> (<start>-<end>, <stain>)`, and hovering over any gene bar in the bottom `Genes` strip reports `<symbol> (strand +/-) | <contig>:<start>-<end>`.

---

## 3. Legend of Icons, Traces, Badges & Color Coding

### 3.1 Plot Traces, Markers & Canvas Reference Lines

| Swatch / Symbol | Element | Color & Hex | Size / Width | Meaning |
| :--- | :--- | :--- | :--- | :--- |
| <span style="display:inline-block;width:10px;height:10px;border-radius:50%;background:#e11d48;vertical-align:middle;"></span> / <span style="display:inline-block;width:10px;height:10px;border-radius:50%;background:#c43c39;vertical-align:middle;"></span> | Gain Bin Dot / Header Legend Dot | Rose `#e11d48` (plot), Crimson `#c43c39` (header) | `4.5 px` dot (`0.85` opacity) / `9 px` dot | Unmasked bin exceeding $\vert Z \vert$ and $\vert \log_2 R \vert$ thresholds with $\log_2 R \gt 0$ and $Z \ge 0$ |
| <span style="display:inline-block;width:22px;height:3px;background:#c43c39;vertical-align:middle;"></span> | Gain Segment Line | Crimson `#c43c39` | `3 px` solid line | Segment classified as copy-number `gain` |
| <span style="display:inline-block;width:10px;height:10px;border-radius:50%;background:#16a34a;vertical-align:middle;"></span> / <span style="display:inline-block;width:10px;height:10px;border-radius:50%;background:#3c8c5a;vertical-align:middle;"></span> | Loss Bin Dot / Header Legend Dot | Emerald `#16a34a` (plot), Forest `#3c8c5a` (header) | `4.5 px` dot (`0.85` opacity) / `9 px` dot | Unmasked bin exceeding $\vert Z \vert$ and $\vert \log_2 R \vert$ thresholds with $\log_2 R \lt 0$ and $Z \le 0$ |
| <span style="display:inline-block;width:22px;height:3px;background:#3c8c5a;vertical-align:middle;"></span> | Loss Segment Line | Forest `#3c8c5a` | `3 px` solid line | Segment classified as copy-number `loss` |
| <span style="display:inline-block;width:10px;height:10px;border-radius:50%;background:#94a3b8;vertical-align:middle;"></span> / <span style="display:inline-block;width:10px;height:10px;border-radius:50%;background:#64748b;vertical-align:middle;"></span> | Neutral Bin Dot / Header Legend Dot | Cool Gray `#94a3b8` (plot), Slate `#64748b` (header) | `3.5 px` dot (`0.7` opacity) / `9 px` dot | Unmasked bin not meeting active Gain/Loss call thresholds |
| <span style="display:inline-block;width:22px;height:2.2px;background:#1e293b;vertical-align:middle;"></span> | Neutral Segment Line | Charcoal `#1e293b` | `2.2 px` solid line | Copy-neutral segment |
| <span style="color:#9333ea;font-weight:700;">◆━━◆</span> | Prenatal Discordant Segment (line + diamonds) | Purple `#9333ea` (`9 px` header dot, `7 px` diamond) | `6.0 px` solid line + `7 px` `diamond` markers | Prenatal segment whose depth conflicts with expected fetal dosage (`SCA_DISCORDANT`, `SUB_FETAL_RATIO`, `SUPER_FETAL_RATIO`) |
| <span style="display:inline-block;width:22px;border-top:2px dashed #9333ea;vertical-align:middle;"></span> | Prenatal Expected FF Lines (dashed) | Purple `#9333ea` | `1.5 px` dashed horizontal lines | Expected $\log_2 R$ for heterozygous fetal gain $y_{+}$ and loss $y_{-}$ at `effective_ff` |
| <span style="display:inline-block;width:22px;height:1px;background:#64748b;vertical-align:middle;"></span> | Zero Baseline & Contig Grid | Slate `#64748b` (zero), Pale `#f1f5f9` (grid) | `1 px` horizontal | Diploid neutral reference ($\log_2 R = 0.0$) and y-axis grid lines |
| <span style="display:inline-block;width:12px;height:12px;background:#f8fafc;border:1px solid #e2e8f0;vertical-align:middle;"></span> | Alternating Contig Shading & Dividers | Tint `#f8fafc` (odd) / `#ffffff` (even), border `#e2e8f0` | `1 px` vertical line | Visual separation between adjacent chromosomes across genome |

### 3.2 Prenatal Status Banner Badges, Tooltips & UI Alerts

| Swatch / Preview | UI Element | Colors (Background / Border / Text) | Trigger Condition |
| :--- | :--- | :--- | :--- |
| <span style="display:inline-block;padding:1px 6px;border-radius:3px;background:#f1f5f9;border:1px solid #cbd5e1;color:#334155;font-size:11px;font-weight:600;">EUPLOID</span> | Default Prenatal Badge (`.badge`) | `#f1f5f9` / `#cbd5e1` / `#334155` | Prenatal mode active with euploid `SCA` call and adequate fetal fraction ($\ge 4$%) |
| <span style="display:inline-block;padding:1px 6px;border-radius:3px;background:#fffbeb;border:1px solid #fde68a;color:#b45309;font-size:11px;font-weight:600;">LOW FF</span> | Warning Badge (`.badge-warn`, `#ab-custom-badge`) | `#fffbeb` / `#fde68a` / `#b45309` | Euploid `SCA` call paired with `low_ff_warning == True` (low active fetal fraction), or `Custom thresholds` badge in the aberrations bar when $\vert Z \vert \ge$ or $\vert\text{Log2R}\vert \ge$ differs from initial thresholds |
| <span style="display:inline-block;padding:1px 6px;border-radius:3px;background:#fef2f2;border:1px solid #fecaca;color:#dc2626;font-size:11px;font-weight:600;">SCA ALERT</span> | Alert Prenatal Badge (`.badge-alert`) | `#fef2f2` / `#fecaca` / `#dc2626` | Non-euploid `SCA` call (`is_aneuploid == True`, e.g., `XO`, `XXX`, `XXY`, `XYY`, `DISCORDANT_MIXED`) |
| <span style="display:inline-block;padding:1px 6px;border-radius:3px;background:#ffe4e6;color:#be123c;font-size:11px;font-weight:600;">GAIN</span> | Aberrations Gain Badge (`.ab-gain`) | `#ffe4e6` / none / `#be123c` | Aberrations table `Type` badge for segments classified as `gain` |
| <span style="display:inline-block;padding:1px 6px;border-radius:3px;background:#dcfce7;color:#15803d;font-size:11px;font-weight:600;">LOSS</span> | Aberrations Loss Badge (`.ab-loss`) | `#dcfce7` / none / `#15803d` | Aberrations table `Type` badge for segments classified as `loss` |
| <span style="display:inline-block;padding:1px 6px;border-radius:3px;background:#f3e8ff;color:#7e22ce;font-size:11px;font-weight:600;">DISCORDANT</span> | Aberrations Discordant Badge (`.ab-disc`) | `#f3e8ff` / none / `#7e22ce` | Aberrations table `Type` badge appended on discordant prenatal segments (`discordant == True`) |
| <span style="color:#dc2626;font-weight:600;">Region not found</span> | Search Error Notice (`#search-err`) | Transparent / none / `#dc2626` | Entered contig, interval, or cytoband string cannot be matched |
| <span style="display:inline-block;padding:1px 6px;border-radius:3px;background:#0f172a;color:#f8fafc;font-size:11px;">chr1:0-5,000</span> | Bin Hover Tooltip (`#bin-tooltip`) | `rgba(15, 23, 42, 0.92)` / none / `#f8fafc` | Cursor hovering over any bin marker in the WebGL scatter plot |

### 3.3 Cytoband Ideogram Giemsa Stain Colors (`--cytobands`)

| Swatch | Stain Key | Hex Color | Cytogenetic Feature |
| :--- | :--- | :--- | :--- |
| <span style="display:inline-block;width:14px;height:14px;background:#ffffff;border:1px solid #64748b;vertical-align:middle;"></span> | `gneg` | `#ffffff` | Giemsa-negative euchromatic R-band (gene-rich light band) |
| <span style="display:inline-block;width:14px;height:14px;background:#d9d9d9;border:1px solid #64748b;vertical-align:middle;"></span> | `gpos25` | `#d9d9d9` | Weakly Giemsa-positive G-band ($25$% intensity) |
| <span style="display:inline-block;width:14px;height:14px;background:#bfbfbf;border:1px solid #64748b;vertical-align:middle;"></span> | `gpos33` | `#bfbfbf` | Low-to-moderate Giemsa-positive G-band ($33$% intensity) |
| <span style="display:inline-block;width:14px;height:14px;background:#969696;border:1px solid #64748b;vertical-align:middle;"></span> | `gpos50` | `#969696` | Medium Giemsa-positive G-band ($50$% intensity) |
| <span style="display:inline-block;width:14px;height:14px;background:#737373;border:1px solid #64748b;vertical-align:middle;"></span> | `gpos66` | `#737373` | Medium-dark Giemsa-positive G-band ($66$% intensity) |
| <span style="display:inline-block;width:14px;height:14px;background:#525252;border:1px solid #64748b;vertical-align:middle;"></span> | `gpos75` | `#525252` | Dark Giemsa-positive G-band ($75$% intensity) |
| <span style="display:inline-block;width:14px;height:14px;background:#1e293b;border:1px solid #64748b;vertical-align:middle;"></span> | `gpos100` | `#1e293b` | Darkest Giemsa-positive heterochromatic G-band ($100$% intensity) |
| <span style="display:inline-block;width:14px;height:14px;background:#dc2626;border:1px solid #64748b;vertical-align:middle;"></span> | `acen` | `#dc2626` | Centromeric region (primary constriction) |
| <span style="display:inline-block;width:14px;height:14px;background:#cbd5e1;border:1px solid #64748b;vertical-align:middle;"></span> | `gvar` | `#cbd5e1` | Variable constitutive heterochromatic region |
| <span style="display:inline-block;width:14px;height:14px;background:#94a3b8;border:1px solid #64748b;vertical-align:middle;"></span> | `stalk` | `#94a3b8` | Acrocentric short-arm satellite stalk (`chr13`, `chr14`, `chr15`, `chr21`, `chr22`) |
| <span style="display:inline-block;width:14px;height:14px;background:#e2e8f0;border:1px solid #64748b;vertical-align:middle;"></span> | Other / unrecognized | `#e2e8f0` | Fallback fill when a cytoband record uses a non-standard stain label; all bands carry a `0.5 px` `#64748b` outline |

### 3.4 Toolbar Buttons & Plotly Modebar Icons

| Icon / Control | Component | Label | Action |
| :--- | :--- | :--- | :--- |
| `[chr21:13.1m-46.7m...]` + `Go` | Top Header Bar | Coordinate Search | Zooms horizontally to matching chromosome, coordinate span, `100 kb` locus, or cytoband |
| `Whole Genome` | Top Header Bar | Reset Range | Clears the coordinate input and restores `[0, totalLen]` |
| $\vert Z \vert \ge$ / $\vert\text{Log2R}\vert \ge$ | Top Header Bar | Live Call Thresholds | Debounced (`100 ms`) reclassification of neutral, gain, and loss bins, segments, and aberrations table rows |
| Camera | Plotly Modebar | Download plot as PNG | Exports the current zoomed viewport as a static PNG image |
| Magnifying glass | Plotly Modebar | Zoom | Box-drag horizontal zoom along the genome axis (`yaxis` stays locked to `[-2.5, 2.5]`) |
| Four-way arrows | Plotly Modebar | Pan *(default active)* | Click-and-drag horizontal panning across chromosomes; mouse wheel zooms horizontally (`scrollZoom: true`) |
| `▾ Aberrations (N)` | Bottom Aberrations Bar | Toggle Table Pane | Collapses or expands `#aberrations-panel` and resizes the Plotly viewport |
| `All` / `Gain` / `Loss` / `Discordant` | Bottom Aberrations Bar | Call Filter Pills | Filters visible aberration rows by direction or prenatal discordance |
| `Export TSV` | Bottom Aberrations Bar | Download Filtered Calls | Exports visible sorted aberration rows offline as `<sample>_aberrations.tsv` |
| `+` / `-` | Plotly Modebar | Zoom in / Zoom out | Step-wise horizontal zoom centered on the current viewport |
| Expand corners | Plotly Modebar | Autoscale | Fits the horizontal axis tightly to active trace bounds |
| House | Plotly Modebar | Reset axes | Restores initial Plotly viewport ranges (Note: the Plotly logo badge is hidden via `displaylogo: false`) |

:::tip
Hovering directly over any chromosome band rectangle near the top `Band` strip reveals its exact cytoband name (for example `chr21q22.11`), base-pair coordinates, and stain code, even while zoomed out to the whole genome.
:::

---

## 4. Bundled Gene Track Provenance

This section documents the upstream open-license curations, cryptographic digests, filtering criteria, and per-chromosome inventory backing the bundled GRCh38 clinical gene annotation track (`src/ccnv/io/genes_hg38.tsv.gz`) rendered inside `<prefix>_plot.html` (overridable via `--genes` in [CLI Reference](../cli.md)).

:::note
Refreshing this catalog via `pixi run update-genes` is a mandatory release gate enforced by `pixi run bump-version` and the GitHub Actions release pipeline.
:::

### 4.1 Bundle Summary

| Field | Value |
| :--- | :--- |
| **Genome Build** | `GRCh38` |
| **Updated Date (UTC)** | `2026-11-30` |
| **Stamped Release Version** | `1.2.0` |
| **License** | `CC0-1.0 / Public Domain` |
| **Bundle Resource** | `src/ccnv/io/genes_hg38.tsv.gz` |
| **Bundle Gzip Size** | `84610` bytes |
| **Bundle SHA-256** | `a661c254b65bac19e3eb39b64fea3aa503a4de9ea0b4cb78ec95929dae56c50f` |
| **Total Gene Intervals** | `5956` |
| **Unique HGNC Gene Symbols** | `5952` |

### 4.2 Curation & Coordinate Inclusion Criteria

- **Approved Protein-Coding Vocabulary**: Symbols and `HGNC` identifiers are normalized against the approved HGNC `protein-coding gene` nomenclature set, excluding pseudogenes, non-coding RNAs, and withdrawn symbols.
- **ClinGen Dosage Sensitivity (`1180` genes)**: Genes with haploinsufficiency or triplosensitivity evidence scores in `1` (Little), `2` (Emerging), `3` (Sufficient), or `30` (Autosomal Recessive).
- **ClinGen Gene-Disease Validity (`2869` genes)**: Genes carrying `Definitive`, `Strong`, `Moderate`, or `Limited` gene-disease validity classifications (excluding `Disputed`, `Refuted`, and `No Known Disease Relationship`).
- **Gene Curation Coalition / GenCC (`5896` genes)**: Genes carrying `Definitive`, `Strong`, `Moderate`, `Limited`, or `Supportive` classifications across member clinical curation panels.
- **Male-Specific `chrY` MSY Protein-Coding Genes (`43` genes)**: Approved `Yp`/`Yq` protein-coding genes ensuring complete microdeletion locus coverage (`SRY`, `AZFa`/`AZFb`/`AZFc`) in germline male and male-fetus prenatal profiles.
- **GRCh38 Coordinate Mapping**: Primary 0-based half-open gene spans are resolved from UCSC `ncbiRefSeqSelect` (MANE Select / RefSeq Select canonical transcripts) on `chr1`–`chr22`, `chrX`, and `chrY` (retaining both `chrX` and `chrY` pseudoautosomal `PAR1`/`PAR2` homologs), with fallback to longest curated `NM_` transcripts in `ncbiRefSeqCurated` and ClinGen GRCh38 coordinates.

### 4.3 Upstream Data Sources

| Source | License | Records Parsed | Bytes | Last-Modified | SHA-256 |
| :--- | :--- | ---: | ---: | :--- | :--- |
| [ClinGen Dosage Sensitivity Gene Curation List (GRCh38)](https://ftp.clinicalgenome.org/ClinGen_gene_curation_list_GRCh38.tsv) | `CC0-1.0` | 1,541 | 249,987 | `Mon, 30 Nov 2026 08:32:32 GMT` | `a8bb804aea4e5f5d9630c36a88017f8de5fcd88344543dd4513662f3226fe75a` |
| [ClinGen Gene-Disease Validity Curations](https://search.clinicalgenome.org/kb/gene-validity/download) | `CC0-1.0` | 3,741 | 1,142,450 | `Mon, 30 Nov 2026 19:25:19 GMT` | `c884231678232a8c95d484ae80b1a3d2697a73caf8266d3ea2c8aff0c5c8d4a7` |
| [Gene Curation Coalition (GenCC) Curated Submissions](https://search.thegencc.org/download/action/submissions-export-tsv) | `CC0-1.0` | 31,856 | 27,536,251 | `Sun, 29 Nov 2026 06:03:30 GMT` | `21367bbba6500e0910bd76330fd479a3d77a4ba965de959029c3669d3b152830` |
| [HGNC Complete Approved Human Gene Nomenclature Set](https://storage.googleapis.com/public-download-files/hgnc/tsv/tsv/hgnc_complete_set.txt) | `CC0-1.0` | 45,470 | 17,037,207 | `Mon, 23 Nov 2026 17:19:30 GMT` | `46b83736ec351f15e22331575dce2f08416c5233765b26a08c65e6b42e56b651` |
| [UCSC GRCh38 NCBI RefSeq Select / MANE Select Transcripts](https://hgdownload.soe.ucsc.edu/goldenPath/hg38/database/ncbiRefSeqSelect.txt.gz) | `Public Domain` | 22,438 | 2,521,395 | `Wed, 13 Aug 2025 15:30:41 GMT` | `c57ad06a75bf02c48a69ea233fa814e9f7d653b9b586d7f81435729cc1f49828` |
| [UCSC GRCh38 NCBI RefSeq Curated Transcripts](https://hgdownload.soe.ucsc.edu/goldenPath/hg38/database/ncbiRefSeqCurated.txt.gz) | `Public Domain` | 105,019 | 4,801,131 | `Wed, 13 Aug 2025 15:30:40 GMT` | `67090326b606658bdabdfe5f8dcb97b7943ac802c7945399522be7174ec021ca` |

### 4.4 Per-Chromosome Gene Interval Counts

| Chromosome | Bundled Intervals |
| :--- | ---: |
| `chr1` | 585 |
| `chr2` | 420 |
| `chr3` | 352 |
| `chr4` | 235 |
| `chr5` | 259 |
| `chr6` | 295 |
| `chr7` | 260 |
| `chr8` | 200 |
| `chr9` | 225 |
| `chr10` | 224 |
| `chr11` | 364 |
| `chr12` | 316 |
| `chr13` | 98 |
| `chr14` | 192 |
| `chr15` | 199 |
| `chr16` | 259 |
| `chr17` | 350 |
| `chr18` | 85 |
| `chr19` | 307 |
| `chr20` | 162 |
| `chr21` | 66 |
| `chr22` | 138 |
| `chrX` | 318 |
| `chrY` | 47 |
