plot_regional_similarity: Plot regional similarity

View source: R/plot_regional_similarity.R

plot_regional_similarityR Documentation

Plot regional similarity

Description

Plot the cosine similarity of the mutation profiles of small genomic windows with the rest of the genome.

Usage

plot_regional_similarity(
  region_cossim,
  per_chrom = FALSE,
  oligo_correction = TRUE,
  max_cossim = NA,
  title = NA,
  plot_rug = FALSE,
  x_axis_breaks = NA
)

Arguments

region_cossim

A region_cossim object.

per_chrom

Boolean. Determines whether to create a separate plot per chromosome. (Default: FALSE)

oligo_correction

Boolean describing whether the oligonucleotide frequency corrected cosine similarities should be plotted. If no correction has been applied then the regular cosine similarities will be plotted. (Default: TRUE)

max_cossim

Maximum cosine similarity for a window to be considered an outlier. Any window with a lower cosine similarity is given a different color. (Default: NA)

title

Optional plot title. (Default: NA). When the default option is used, the number of mutations per window and the step size are shown.

plot_rug

Add a bottom rug to the plot, depicting the location of the mutations. (Default: FALSE)

x_axis_breaks

Vector of custom x-axis breaks. (Default: NA)

Details

Each dot shows the cosine similarity between the mutation profiles of a single window and the rest of the genome. A region with a different mutation profile will have a lower cosine similarity. The dots are colored based on the sizes in mega bases of the windows. This size is the distance between the first and last mutations in a window. The locations of the mutations can be plotted on the bottom of the figure. The cosine similarity can be plotted both with and without oligonucleotide frequency correction. This can be done for all chromosomes at once or separate plots can be made per chromosome.

Value

ggplot2 object

See Also

determine_regional_similarity

Other regional_similarity: determine_regional_similarity()

Examples


## See the 'determine_regional_similarity()' example for how we obtained the
## following data:
regional_sims <- readRDS(system.file("states/regional_sims.rds",
  package = "MutationalPatterns"
))

## Plot the regional similarity
plot_regional_similarity(regional_sims)

## Plot outlier samples with a different color.
## The value of 0.5 that is used here is arbitrarily chosen
## and should in practice be based on the data.
plot_regional_similarity(regional_sims, max_cossim = 0.5)

## Plot samples per chromosome
fig_l = plot_regional_similarity(regional_sims, per_chrom = TRUE)

## Plot without a title
plot_regional_similarity(regional_sims, title = "")

## Add a rug to the plot, that shows the location of the mutations.
plot_regional_similarity(regional_sims, plot_rug = FALSE)

## Use custom x axis breaks
plot_regional_similarity(regional_sims, x_axis_breaks = c(50, 150))


UMCUGenetics/MutationalPatterns documentation built on Nov. 24, 2022, 4:31 a.m.