plotCNprofile.RdPlot 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,
sv_arcs_above = FALSE,
sv_band_frac = 0.25,
sv_arc_scale = "span",
sv_arc_side = NULL,
sv_foldback_dist = 30000,
sv_arc_min_height = 0.15,
sv_arc_min_width = 0.004,
show_chrbreaks = TRUE,
ybreaks = NULL,
sv_show_lines = TRUE,
sv_line_alpha = NULL,
regions = NULL,
region_gap = 5,
show_region_labels = TRUE,
...
)Single cell copy number dataframe with the following columns: cell_id, chr, start, end, state, copy
Which cell to plot, if no cell is specific will plot the first cell in the dataframe
Vector of chromosomes to plot, if NULL (default) will plot all chromosomes
The point size in the plot
Alpha value of points
The maximum on the y axis, if any points are above this value they will be winsorized rather than removed
idx of cell to plot if cellid = NULL
The colour mapping, default is to map colours to the state column
Return a list rather than the ggplot object
use ggrastr or not, default = FALSE
genome to use, default = "hg19" (only used for ideogram)
What transformation to use on the y-axis, default is identity, the other option is "squashy" which uses a tanh transformation
Default is "genome_position"
Where to place the legend, default is "bottom"
Dataframe with chr start and end positions to annotate, will draw a dashed vertical line at this position
linetype for region annotation, default = 2 (dashed)
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.
Default is TRUE. Colour SVs or not
the alpha scaling of the SV lines, default = 0.5
Width of SV width curves, default = 1.0
adjustment for gene labels
vector of genes to annotate, will add a dashed vertical line and label
Spacing of ticks (in Mb) when only 1 chromosome is plotted
Start of region (in Mb) when plotting a single chromosome
End of region (in Mb) when plotting a single chromosome
shape for plotting, default = 16
set to TRUE to use position ticks rather than chromosome ticks
plot ideogram at the top, default = TRUE
visualization style for structural variants: "curves" (default, bezier curves), "lines_and_arcs" (colored lines with arcs), or "both"
transparency of SV arcs when using lines_and_arcs style, default = 0.3
height of SV arcs as fraction of maxCN when using lines_and_arcs style, default = 0.2
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.
maximum value for SV read support axis (auto-scaled if NULL), default = NULL
show legend for SV orientations when using lines_and_arcs style, default = FALSE
draw SV arcs in a dedicated band above the copy number panel rather than on top of it, default = FALSE. Read count is no longer encoded as arc height and the SV read support secondary axis is switched off.
height of the SV band as a fraction of the total panel height when sv_arcs_above = TRUE, default = 0.25. Consider ~0.35 when sv_arc_side is set, since each side then gets half the band.
how the apex of each arc is chosen when sv_arcs_above = TRUE: "span" (default, apex scales with the sqrt of the arc's width so nested SVs nest visually) or "fixed" (every arc reaches the same height).
split arcs onto both sides of a baseline inside the SV band. NULL (default) draws all arcs upwards. One of the built-in rules "cn_effect" (gain-associated junctions up, loss-associated and CN-neutral down), "translocation" or "foldback", or the name of a column in SV holding "up"/"down".
maximum breakpoint distance (bp) for a "++"/"–" inversion to count as a foldback in the sv_arc_side rules, default = 30000
minimum apex of an arc as a fraction of the available band half-height, default = 0.15. Only used when sv_arc_scale = "span". Raise it so short-range SVs such as foldbacks stay visible.
minimum width of an arc as a fraction of the plotted x range, default = 0.004. An SV whose two breakends fall in the same bin (a foldback at 10kb bins, say) would otherwise have zero width and not render at all.
draw the light grey vertical lines separating chromosomes, or regions when regions is supplied. Default = TRUE.
y axis breaks. Default NULL uses c(0, 2, 5, 10, maxCN) for the squashy transform and seq(0, maxCN, 2) otherwise. Useful for short panels, where the default breaks collide: the squashy transform packs 0/2/5 into the lower part of the axis, so their labels overlap once the panel drops below roughly 7 mm.
draw the vertical line at each breakpoint, default = TRUE. Set to FALSE for arcs only. In band mode the lines run from 0 up to the arc baseline; in read count mode they run from the bottom of the panel to a height set by read_count.
transparency of the vertical breakpoint lines. Default NULL uses sv_arc_alpha. Because the lines are drawn behind the copy number points they can be made stronger than the arcs without obscuring the data.
Optional data.frame with columns chr, start, end (in Mb) to plot multiple regions. If provided, takes precedence over chrfilt/chrstart/chrend.
Gap size between regions in Mb, default = 5 Mb. Only used when regions is provided.
Annotate each region with its chromosome name at the top of the panel. Only used when regions is provided. Default = TRUE.
ggplot2 plot
plotCNprofile(CNbins)
#> Making CN profile and BAF plot for cell - SA921-A90554A-R03-C44
#> Making fixed-width bins for bin size 500000 ...