Sometimes it is very useful to check details about copy number profile for one or multiple samples. This function is designed to do this job and can be further modified by ggplot2 related packages.

show_cn_profile(
  data,
  samples = NULL,
  show_n = NULL,
  show_title = FALSE,
  show_labels = NULL,
  chrs = paste0("chr", 1:22),
  position = NULL,
  genome_build = c("hg19", "hg38", "T2T", "mm10", "mm9", "ce11"),
  ylim = NULL,
  nrow = NULL,
  ncol = NULL,
  return_plotlist = FALSE
)

Arguments

data

a CopyNumber object or a data.frame containing at least 'chromosome', 'start', 'end', 'segVal' these columns.

samples

default is NULL, can be a chracter vector representing multiple samples. If data argument is a data.frame, a column called sample must exist.

show_n

number of samples to show, this is used for checking.

show_title

if TRUE, show title for multiple samples.

show_labels

one of NULL, "s" (for labelling short segments < 1e7) or "a" (all segments).

chrs

chromosomes start with 'chr'.

position

a position range, e.g. "chr1:3218923-116319008". Only data overlaps with this range will be shown.

genome_build

genome build version, used when data is a data.frame, should be 'hg19' or 'hg38'.

ylim

limites for y axis.

nrow

number of rows in the plot grid when multiple samples are selected.

ncol

number of columns in the plot grid when multiple samples are selected.

return_plotlist

default is FALSE, if TRUE, return a plot list instead of a combined plot.

Value

a ggplot object or a list

Examples

# Load copy number object
load(system.file("extdata", "toy_copynumber.RData",
  package = "sigminer", mustWork = TRUE
))

p <- show_cn_profile(cn, nrow = 2, ncol = 1)
p

# \donttest{
p2 <- show_cn_profile(cn,
  nrow = 2, ncol = 1,
  position = "chr1:3218923-116319008"
)
p2

# }