R/illustration_functions.R
plot_truth_heatmap.RdCreates a ComplexHeatmap visualization of copy number data across genomic coordinates, with annotations for clone identities and chromosome locations. The function specifically handles integer copy number states and includes customizable color schemes.
plot_truth_heatmap(
seg_dat,
title,
clone_identity_vector,
clone_color_anno,
chr_bar,
integer_col,
max_int = 8
)A numeric matrix containing segmented copy number data, where rows represent cells and columns represent genomic windows
Character string specifying the title for the heatmap
A vector specifying clone assignments for each cell (row)
A named vector of colors for clone annotation
A HeatmapAnnotation object for chromosome visualization (typically created by draw_chr_bar function)
Logical indicating whether to treat data as integer copy numbers (TRUE) or continuous values (FALSE)
Integer specifying the maximum copy number state to display. Values above this will be shown as NA (default: 8)
Draws a ComplexHeatmap visualization and invisibly returns the Heatmap object
The function creates a heatmap with the following features:
Left annotation showing clone identities
Top annotation showing chromosome boundaries
Custom color scheme for integer copy numbers using ocean.balance palette
NA values (including values > max_int) shown in yellow
Non-clustered visualization preserving genomic order
draw_chr_bar for creating chromosome bar annotations
if (FALSE) { # \dontrun{
# Create sample data
seg_data <- matrix(sample(0:8, 1000, replace = TRUE), nrow = 20)
clone_ids <- rep(c("Clone1", "Clone2"), each = 10)
clone_colors <- c("Clone1" = "red", "Clone2" = "blue")
# Create chromosome bar annotation
chr_bar <- draw_chr_bar(window_data)
# Plot heatmap
plot_truth_heatmap(
seg_dat = seg_data,
title = "Copy Number Profile",
clone_identity_vector = clone_ids,
clone_color_anno = clone_colors,
chr_bar = chr_bar,
integer_col = TRUE,
max_int = 8
)
} # }