plot_profile_heatmap: Plot a mutation matrix as a heatmap

View source: R/plot_profile_heatmap.R

plot_profile_heatmapR Documentation

Plot a mutation matrix as a heatmap

Description

Function to plot a SNV mutation matrix as a heatmap. This is especially useful when looking at a wide mutational context.

Usage

plot_profile_heatmap(mut_matrix, by = NA, max = 0.02, condensed = FALSE)

Arguments

mut_matrix

Matrix containing mutation counts.

by

Optional grouping variable

max

Maximum value used for plotting the relative contributions. Contributions that are higher will have the maximum colour. (Default: 0.02)

condensed

More condensed plotting format. Default = F.

Value

A ggplot object

See Also

mut_matrix, plot_96_profile, plot_river

Examples


## See the 'mut_matrix()' examples for how we obtained the
## mutation matrix information:
## Get regular matrix
mut_mat <- readRDS(system.file("states/mut_mat_data.rds",
  package = "MutationalPatterns"
))

## Create heatmap of profile
plot_profile_heatmap(mut_mat, max = 0.1)

## Get extended matrix
mut_mat_extended <- readRDS(system.file("states/mut_mat_data_extended.rds",
  package = "MutationalPatterns"
))

## Create heatmap of extended profile
plot_profile_heatmap(mut_mat_extended)

## Or plot heatmap per tissue
tissue <- c(
  "colon", "colon", "colon",
  "intestine", "intestine", "intestine",
  "liver", "liver", "liver"
)

plot_profile_heatmap(mut_mat_extended, by = tissue)

## Or plot the heatmap per sample.
plot_profile_heatmap(mut_mat_extended,
  by = colnames(mut_mat_extended),
  max = 0.05
)


## Create a condensed heatmap of extended profile
plot_profile_heatmap(mut_mat_extended, condensed = TRUE)

CuppenResearch/MutationalPatterns documentation built on Nov. 23, 2022, 4:13 a.m.