plot_lesion_segregation: Plot the strands of variants to show lesion segregation

View source: R/plot_lesion_segregation.R

plot_lesion_segregationR Documentation

Plot the strands of variants to show lesion segregation

Description

The strands of variants in a GRanges object is plotted. This way the presence of any lesion segregation is visualized. The function can plot either a single or multiple samples. Per chromosome, the ratio of the mutations on the chromosomal strands is visualised by a line. The position of this line is calculated as the mean of the "+" and "-" strand, where "+" equals 1 and "-" equals 0. In other words: this line lies between the two strands if the mutations are equally distributed between them, and approaches a strand if the majority of mutations on a chromosome lie on that strand.

Usage

plot_lesion_segregation(
  vcf,
  per_chrom = FALSE,
  sample_name = NA,
  min_muts_mean = 10,
  chromosomes = NA,
  subsample = NA
)

Arguments

vcf

GRanges or RGrangesList object.

per_chrom

Boolean. Determines whether to create a separate plot per chromosome.

sample_name

Name of the sample. Is used as the title of the plot. Not very useful if you have more than one sample.

min_muts_mean

Integer. The minimum of mutations, required for the mean strand of a chromosome to be calculated.

chromosomes

Character vector. Determines chromosomes to be used and their order.

subsample

Double between 0 and 1. Subsamples the amount of mutations to create a plot with less dots. Such a plot is easier to modify in a vector program like illustrator. (default: NA)

Value

ggplot2 object

See Also

calculate_lesion_segregation

Other Lesion_segregation: calculate_lesion_segregation()

Examples


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

## Plot lesion segregation
plot_lesion_segregation(grl[1:3])

## Select a single GRanges object to plot.
gr <- grl[[1]]

## Plot lesion segregation for a single sample. 
## Also add a title to the plot.
plot_lesion_segregation(gr, sample_name = "Colon1")

## Plot lesion segregation per chromosome.
## We here store the results in a list.
figure_l = plot_lesion_segregation(gr, per_chrom = TRUE, sample_name = "Colon1")

## Plot specific chromosomes in a user specified order
plot_lesion_segregation(grl[1:3], chromosomes = c(2,3))

## Subsample the mutations, so less points are plotted.
plot_lesion_segregation(grl[1:3], subsample = 0.2)


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