plot_segments: Plot CNA segments.

View source: R/plot_segments.R

plot_segmentsR Documentation

Plot CNA segments.

Description

CNAqc can plot genome-wide segments showing major and minor allele counts as red and blue bars. Bottom circles annotate breakpoints; by default this plot has limited y-axis and breakpoints for segments outside the plot (e.g. very high amplifications) are in black. Areas in the genome that are mapped to the most prevalent karyotype are shadowed by default. Note that the colour scheme in CNAqc is fixed for certain segments. The colour scheme is adopted also for other information, e.g., to report the segment where a certain driver is mapped. A circular layout for this plot is also available, and total copy numbers can also be plot.

Note that two distinct colour schemas distinguish clonal and subclonal segments.

Usage

plot_segments(
  x,
  chromosomes = paste0("chr", c(1:22, "X", "Y")),
  max_Y_height = 6,
  circular = FALSE,
  cn = "absolute",
  highlight = x$most_prevalent_karyotype,
  highlight_QC = FALSE,
  ...
)

Arguments

x

A CNAqc object.

chromosomes

The chromosome to plot.

max_Y_height

Maximum height for the Y-axis of the plot. Segments witht total copy number (Major plus minor) above max_Y_height are not showm; in that case a point annotation is put on top of the plot, and max_Y_height is annotated in the grid.

circular

Uses a circular layout in polar coordinates to make the segments look like a circos plot. This visualisation can save space.

cn

Type of copy number segment to show on the plot. Either "absolute" for Major and minor annotation, or "total" for the total (Major plus minor) annotation.

highlight

A list of karyotype ids in "Major:minor" notation (e.g., "1:1", "2,1", ...) that will be shadowed with a transparent area. By default, it plots the most prevalent karyotype using 'x$most_prevalent_karyotype'.

highlight_QC

Similar to highlight but shadows segments based on the QC results and takes a boolean as an input. By default, it overrrides highlight, while if no peak analysis has been performed reverts back to highlight

...

Extra parameters passed to the hidden function blank_genome.

Value

A ggplot2 plot.

Examples

data('example_dataset_CNAqc', package = 'CNAqc')
x = init(mutations = example_dataset_CNAqc$mutations, cna = example_dataset_CNAqc$cna, purity = example_dataset_CNAqc$purity)

# Default view, works for most cases
plot_segments(x)

# A subset of chromosomes
plot_segments(x, chromosomes = 'chr13')

# Total CNAs
plot_segments(x, cn = 'total')

# Shadows all simple clonal CNAs
plot_segments(x, highlight = c('1:0', '1:1', '2:0', '2:1', '2:2'))

caravagnalab/CNAqc documentation built on Oct. 31, 2024, 3:54 a.m.