plot_exposures: Plot signature exposures

Description Usage Arguments Examples

View source: R/sigfit_plotting.R

Description

plot_exposures plots the distribution of signature exposures across samples.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
plot_exposures(
  mcmc_samples = NULL,
  pdf_path = NULL,
  counts = NULL,
  exposures = NULL,
  signature_names = NULL,
  thresh = 0.01,
  hpd_prob = 0.95,
  pdf_width = 24,
  pdf_height = 10,
  margin_bottom = 10.5,
  legend_pos = "topleft",
  legend_cex = 2,
  cex_names = 1.9,
  sig_color_palette = NULL
)

Arguments

mcmc_samples

List with two elements named `data` and `results`, produced via fit_signatures, extract_signatures, or fit_extract_signatures. This is the preferred option for supplying data and results, but can be replaced by the combination of arguments counts, exposures and signature_names.

pdf_path

Character indicating the path to an optional output PDF file for the plots. The PDF dimensions and graphical parameters are automatically set to appropriate values, but custom dimensions can be specified via the arguments pdf_width and pdf_height.

counts

Numeric matrix of observed mutation counts, with one row per sample and one column per mutation type. Only needed if mcmc_samples is not provided.

exposures

Either a numeric matrix of signature exposures, with one row per sample and one column per signature, or a list of matrices generated via retrieve_pars. Only needed if mcmc_samples is not provided.

signature_names

Character vector containing the name of each signature. Only needed if mcmc_samples is not provided and the exposures were obtained via signature fitting (rather than extraction).

thresh

Numeric indicating the minimum threshold for the lower HPD limits of signature exposures (default is 0.01). Exposures with a lower HPD limit below this value will be shown in grey.

hpd_prob

Numeric value in the interval (0, 1), indicating the desired probability content of HPD intervals (default is 0.95).

pdf_width

Numeric indicating the width of the output PDF, in inches (default is 24). Only used if pdf_path is provided.

pdf_height

Numeric indicating the height of the output PDF, in inches (default is 10). Only used if pdf_path is provided.

margin_bottom

Numeric indicating the width of the bottom margin, in inches (default is 10.5).

legend_pos

Character indicating the position of the legend. Admits values "top", "bottom", "center", "left", "right", "topleft", "topright", "bottomleft" and "bottomright" (default is "topleft").

legend_cex

Numeric indicating the relative size of the legend (default is 2).

cex_names

Numeric indicating the relative size of sample labels (default is 1.9).

sig_color_palette

Character vector of custom color names or hexadecimal codes to use for each signature in exposure and reconstruction plots. Must have at least as many elements as the number of signatures.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
## Not run: 
# Load example mutational catalogues and COSMIC signatures
data("counts_21breast")
data("cosmic_signatures_v2")

# Fit signatures and retrieve exposures
samples <- fit_signatures(counts_21breast, cosmic_signatures_v2)
exposures <- retrieve_pars(samples, "exposures")

# Plot exposures using MCMC samples
plot_exposures(mcmc_samples = samples, pdf_path = "Exposures.pdf")

# Plot exposures using retrieved exposures matrix
plot_exposures(counts = counts_21breast, exposures = exposures,
               signature_names = rownames(cosmic_signatures_v2),
               pdf_path = "Exposures.pdf")

## End(Not run)

kgori/sigfit documentation built on Feb. 3, 2022, 12:04 p.m.