Plot a single cell allele specific copy number profile

plotCNprofileBAF(
  cn,
  cellid = NULL,
  chrfilt = NULL,
  pointsize = 1,
  alphaval = 0.6,
  maxCN = 10,
  cellidx = 1,
  BAFcol = "state_phase",
  statecol = "state",
  returnlist = FALSE,
  raster = FALSE,
  y_axis_trans = "identity",
  xaxis_order = "genome_position",
  legend.position = "bottom",
  genes = NULL,
  annotateregions = NULL,
  annotateregions_linetype = 2,
  homolog = FALSE,
  SV = NULL,
  adj = 0.03,
  svalpha = 0.5,
  svwidth = 1,
  plotdata = TRUE,
  offset = NULL,
  my_title = NULL,
  tickwidth = 50,
  chrstart = NULL,
  chrend = NULL,
  shape = 16,
  positionticks = FALSE,
  ...
)

Arguments

cn

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

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

BAFcol

state to use to colour BAF track, default = `state_phase`

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

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"

genes

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

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)

homolog

Rather than plot the BAF and CN seperately this will plot the 2 homologs on the same track

SV

Default is NULL. If a dataframe with structural variant position is passed it will add a track on the top showin rearrangement links

svalpha

the alpha scaling of the SV lines, default = 0.5

svwidth

width of rearrangement connections

plotdata

Binary value whether to plot raw data or inferred states in homolog plot

my_title

string to use for title, if NULL cell_id is shown

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

offest

to use when plotting inferred states in homolog plot

Value

ggplot2 plot

Examples


if (FALSE) {
data("haplotypes")
data("CNbins")
haplotypes <- format_haplotypes_dlp(haplotypes, CNbins)
hscn <- callHaplotypeSpecificCN(CNbins, haplotypes, likelihood = "binomial")
plotCNprofileBAF(hscn, genes = "MYC")
plotCNprofileBAF(hscn, homolog = TRUE, chrfilt = c("1", "8"))
}