Skip to contents

This function visualizes copy number alteration (CNA) segments across clusters based on data stored in a muscadet object. It displays CNAs for each clusters and scales the y-axis based on the proportion of cells in each cluster.

Usage

plotCNA(
  x,
  title = NULL,
  labels = "auto",
  cna.colors = c(gain = "#EF6F6AFF", loss = "#6699CCFF", cnloh = "#44AA99FF"),
  cf.gradient = FALSE
)

Arguments

x

A muscadet object containing CNA calling data to be visualized (generated using cnaCalling()).

title

An optional title for the plot. Default is NULL.

labels

Labels for clusters. One of "auto" (cluster and cell number information), "clusters" (cluster identifier), or "cells" (number of cells), or a vector of length equal to the number of clusters, or NULL for no labels. Default is "auto".

cna.colors

A vector of 3 colors for CNA states: gain, loss, and cnloh (or named vector where names are "gain", "loss", and "cnloh" and the values are their respective colors). Default is c("gain" = "#EF6F6AFF", "loss" = "#6699CCFF", "cnloh" = "#44AA99FF").

cf.gradient

Logical. If TRUE adds a alpha transparency gradient on CNA color block based on the cell fraction. Default is FALSE.

Value

A ggplot object representing the CNA segments plot.

Examples

if (FALSE) { # \dontrun{
library("ggplot2")

# Load example muscadet object
# data("exdata_muscadet")

# Plot CNA segments
p <- plotCNA(exdata_muscadet, title = "Copy Number Alterations in Example Data")
p
ggsave(
    filename = file.path("CNAplot.png"),
    plot = p,
    width = 3000,
    height = 800,
    units = "px"
)
} # }