Plot a heatmap where rows are cells, columns are genome coordinates and colours map to (allele-specific) copy-number states

plotHeatmap(
  cn,
  tree = NULL,
  clusters = NULL,
  normalize_ploidy = FALSE,
  normalize_tree = FALSE,
  branch_length = 1,
  spacer_cols = 20,
  plottree = TRUE,
  plotcol = "state",
  reorderclusters = FALSE,
  pctcells = 0.05,
  library_mapping = NULL,
  clone_pal = NULL,
  sample_label_idx = 1,
  fillna = TRUE,
  frequencycutoff = 2,
  maxf = NULL,
  plotfrequency = FALSE,
  show_legend = TRUE,
  show_library_label = TRUE,
  show_clone_label = TRUE,
  show_clone_text = TRUE,
  widenarm = FALSE,
  umapmetric = "euclidean",
  chrlabels = TRUE,
  labeladjust = -5,
  SV = NULL,
  seed = NULL,
  nticks = 4,
  Mb = TRUE,
  fillgenome = FALSE,
  annotation_height = NULL,
  annofontsize = 10,
  na_col = "white",
  linkheight = 2.5,
  newlegendname = NULL,
  str_to_remove = NULL,
  maxCNcol = 11,
  anno_width = 0.4,
  rasterquality = 15,
  ...
)

Arguments

cn

Either a hscn object or a single cell allele specific copy number dataframe with the following columns: `cell_id`, `chr`, `start`, `end`, `state`, `copy`

tree

Tree in newick format to plot alongside the heatmap, default = NULL

clusters

data.frame assigning cells to clusters, needs the following columns `cell_id`, `clone_id` default = NULL

normalize_ploidy

Normalize ploidy of all cells to 2

normalize_tree

default = FALSE

branch_length

scales branch lengths to this size, default = 2

spacer_cols

number of empty columns between chromosomes, default = 20

plottree

Binary value of whether to plot tree or not, default = TRUE

plotcol

Which column to colour the heatmap by, should be one of "state", "state_BAF", "state_phase", "state_AS", "state_min", "copy", "BAF", "A", "B"

reorderclusters

Reorder the cells according to cluster if no tree is specified

pctcells

Minimum size of cluster in terms of perecentage of cells in umap clustering

library_mapping

Named vector mapping library names to labels for legend

clone_pal

pallette to colour clusters by

sample_label_idx

default = 1

fillna

Smooth over NA values, default = TRUE

frequencycutoff

default = 2

maxf

Max frequency when plotting the frequency track, default = NULL infers this from the data

plotfrequency

Plot the frequency track of gains and losses across the genome

show_legend

plot legend or not, boolean

show_library_label

show library label or not, boolean

show_clone_label

show clone label or not, boolean

show_clone_text

Show small inset labels next to clone/cluster annotation

widenarm

Widen the copy number data table to include all bins

umapmetric

metric to use in umap dimensionality reduction if no clusters are specified

chrlabels

include chromosome labels or not, boolean

labeladjust
SV

sv data frame

seed

seed for UMAP

nticks

number of ticks in x-axis label when plotting a single chromosome

Mb

Use Mb ticks when plotting single chromosome

fillgenome

fill in any missing bins and add NA to centromeric regions

annotation_height

Height of the annotations

If clusters are set to NULL then the function will compute clusters using UMAP and HDBSCAN.

annofontsize

Font size to use for annotations, default = 10

na_col

colour of NA values

linkheight

height of x-axis ticks

newlegendname

overwrite default legend name

str_to_remove

string to remove from cell_id's when plotting labels

maxCNcol

max value for color scale when plotting raw data

anno_width

width of left annotations

rasterquality

default = 15

Examples

if (FALSE) {
data("haplotypes")
data("CNbins")
haplotypes <- format_haplotypes_dlp(haplotypes, CNbins)
hscn <- callHaplotypeSpecificCN(CNbins, haplotypes, likelihood = "binomial")
plotHeatmap(hscn)
}