SV Plotting Functions
1 SV Plotting Functions
This reference is curated against the current app/logic/plot_sv.R implementation. The primary plotting entry point is sv_plotly() (not plot_sv_tracks()).
1.1 Overview
The plot_sv.R module provides visualization for structural variants in the IMPACT Plot. SVs are displayed as horizontal segments positioned by genomic coordinates, separated by SV type along the y-axis.
Location: app/logic/plot_sv.R
1.2 Key Functions
1.2.1 sv_plotly()
Builds the SV plot as a plotly widget from an AnnotSV TSV file path.
Parameters: - sv_path (character|NULL): Path to SV TSV file. If missing/invalid, returns baseline_sv_plotly(). - selected_chr (character): "All" or chromosome string. - variant_states (list|data.frame|NULL): Optional per-variant annotations keyed by AnnotSV_ID (or SV_<AnnotSV_ID>). - show_failed_qc (logical): If FALSE, filters out SVs failing READ_SUPPORT_FILTERING. - acmg_filter (character|NULL): Optional subset of allowed ACMG_class values. - sv_genotype (character|NULL): Optional allowed genotype set (normalized to 0/1, 1/1, etc.).
Returns: plotly object
Details: - Coordinates are computed in Mb; in genome-wide mode, cumulative chromosome offsets from plot_gds$chr_lengths() are applied. - Y-axis categories are SV types (Deletion/Duplication/Insertion/Inversion/Translocation). - Point shape is derived from genotype (diamond for 1/1, otherwise circle) when genotype fields are available.
1.3 Usage
box::use(
app/logic/plot_sv[sv_plotly]
)
# Create SV panel for IMPACT Plot
p <- sv_plotly(
sv_path = "app/data/sample_1_SV_IMPACT.tsv",
selected_chr = "All",
show_failed_qc = FALSE
)1.4 Supporting helpers (exported)
sv_colors(): named vector mapping SV types to colors.baseline_sv_plot()/baseline_sv_plotly(): empty placeholders used when no data is available.load_sv_data(sv_path): permissive file reader + light AnnotSV column normalization used internally bysv_plotly().
1.5 Interactivity
All plots return plotly objects with hover tooltips, zoom, and pan capabilities: - Hover Tooltips: View detailed SV annotations (type, coordinates, genes affected, etc.) - Zoom/Pan: Synchronized with other IMPACT Plot panels - Track Separation: Five distinct horizontal tracks prevent visual overlap