Plot a single cell copy number profile

plotCNprofile(
  CNbins,
  cellid = NULL,
  chrfilt = NULL,
  pointsize = 1,
  alphaval = 0.6,
  maxCN = 10,
  cellidx = 1,
  statecol = "state",
  returnlist = FALSE,
  raster = FALSE,
  genome = "hg19",
  y_axis_trans = "identity",
  xaxis_order = "genome_position",
  legend.position = "bottom",
  annotateregions = NULL,
  annotateregions_linetype = 2,
  SV = NULL,
  SVcol = TRUE,
  svalpha = 0.5,
  svwidth = 1,
  adj = 0.03,
  genes = NULL,
  tickwidth = 50,
  chrstart = NULL,
  chrend = NULL,
  shape = 16,
  positionticks = FALSE,
  ideogram = FALSE,
  overwrite_color = NULL,
  sv_style = "curves",
  sv_arc_alpha = 0.3,
  sv_arc_height = 0.2,
  show_sv_read_axis = TRUE,
  sv_read_axis_scale = NULL,
  show_sv_legend = FALSE,
  ...
)

Arguments

CNbins

Single cell copy number dataframe with the following columns: cell_id, chr, start, end, state, copy

cellid

Which cell to plot, if no cell is specific will plot the first cell in the dataframe

chrfilt

Vector of chromosomes to plot, if NULL (default) will plot all chromosomes

pointsize

The point size in the plot

alphaval

Alpha value of points

maxCN

The maximum on the y axis, if any points are above this value they will be winsorized rather than removed

cellidx

idx of cell to plot if cellid = NULL

statecol

The colour mapping, default is to map colours to the state column

returnlist

Return a list rather than the ggplot object

raster

use ggrastr or not, default = FALSE

genome

genome to use, default = "hg19" (only used for ideogram)

y_axis_trans

What transformation to use on the y-axis, default is identity, the other option is "squashy" which uses a tanh transformation

xaxis_order

Default is "genome_position"

legend.position

Where to place the legend, default is "bottom"

annotateregions

Dataframe with chr start and end positions to annotate, will draw a dashed vertical line at this position

annotateregions_linetype

linetype for region annotation, default = 2 (dashed)

SV

Default is NULL. If a dataframe with structural variant position is passed it will add rearrangement links between bins. For lines_and_arcs style, SV must include columns: strand_1, strand_2 (values '+' or '-'), and read_count.

SVcol

Default is TRUE. Colour SVs or not

svalpha

the alpha scaling of the SV lines, default = 0.5

svwidth

Width of SV width curves, default = 1.0

adj

adjustment for gene labels

genes

vector of genes to annotate, will add a dashed vertical line and label

tickwidth

Spacing of ticks (in Mb) when only 1 chromosome is plotted

chrstart

Start of region (in Mb) when plotting a single chromosome

chrend

End of region (in Mb) when plotting a single chromosome

shape

shape for plotting, default = 16

positionticks

set to TRUE to use position ticks rather than chromosome ticks

ideogram

plot ideogram at the top, default = TRUE

sv_style

visualization style for structural variants: "curves" (default, bezier curves), "lines_and_arcs" (colored lines with arcs), or "both"

sv_arc_alpha

transparency of SV arcs when using lines_and_arcs style, default = 0.3

sv_arc_height

height of SV arcs as fraction of maxCN when using lines_and_arcs style, default = 0.2

show_sv_read_axis

show secondary y-axis for SV read support when using lines_and_arcs style, default = TRUE. Works with both identity and squashy y-axis transformations.

sv_read_axis_scale

maximum value for SV read support axis (auto-scaled if NULL), default = NULL

show_sv_legend

show legend for SV orientations when using lines_and_arcs style, default = FALSE

Value

ggplot2 plot

Examples


plotCNprofile(CNbins)
#> Making CN profile and BAF plot for cell - SA921-A90554A-R03-C44
#> Making fixed-width bins for bin size 500000 ...