Skip to contents

Visualise a signature overlayed on observed mutational profile

Usage

sig_visualise_compare_reconstructed_to_observed(
  signature,
  catalogue,
  ...,
  foreground = c("reconstructed", "observed")
)

Arguments

signature

a sigverse signature object representing the exposure model (data.frame)

catalogue

a sigverse catalogue (tally) representing an observed mutational profile (data.frame)

...

Arguments passed on to sig_visualise_compare

catalogue1,catalogue2

a sigverse catalogue (tally) representing an observed mutational profile (data.frame)

compare

what metric to compare (counts or fractions)

names

a 2 element character vector describing the names that should be used to describe catalogue 1 and 2 retrospectively.

title

plot title

subtitle

plot subtitle

palette

colours based on the 'type' column. By default 'auto' will automatically pick a palette if the values of the 'type' column matches COSMIC SBS, Doublet or Indel mutations. Otherwise should be a named vector where names = types and values are colours.

channel_order

How channels should be ordered on the X axis. By default 'auto' will automatically pick palette if channels are recognised as a standard COSMIC SBS/DBS/INDEL signature, or if not sorts in alphabetical order. Can also be a vector of channels in the order they should appear

na.value

colour to use when type = NA

options

other visualisation options. See vis_options() for details

foreground

choose whether the signature or the catalogue are rendered in the foreground as coloured bars instead of in the background as a black outline (one of reconstructed or observed)

Value

a ggplot object.

Examples

library(sigstats) # For combining signature models
library(sigstash) # For pulling signatures
library(TCGAcatalogues) # For pulling example TCGA catalogue data

# Load Signature
signatures <- sig_load("COSMIC_v3.3.1_SBS_GRCh38")

# Create a model (combination of signatures)
model_signature <- sig_combine(
  signatures,
  model = c('SBS2' = 0.6, 'SBS13' = 0.4),
  format = "signature"
)

# Load a catalogue (Tally of variant types)
tally <- catalogues_load("BRCA", type = "SBS_96")

# Get tally of a single sample
sample = "TCGA-5L-AAT1-01A-12D-A41F-09"
tally_single_sample <- tally[[sample]]

# Visualise the overlay
gg <- sig_visualise_compare_reconstructed_to_observed(
  catalogue = tally_single_sample,
  signature = model_signature
)
#>  All channels matched perfectly to set [sbs_96]. Using this set for sort order
#>  All types matched perfectly to set [sbs_type]. Using this set for sort order
#>  Types matched perfectly to palette [snv_type]

# Make interactive
sig_make_interactive(gg)