Skip to contents

Generate a violin plot showing variant (SSM or SVs) size distributions for selected contigs.

Usage

fancy_v_sizedis(
  this_sample_id,
  maf_data,
  maf_path = NULL,
  ssm = TRUE,
  projection = "grch37",
  this_seq_type = "genome",
  min_vaf = 0,
  variant_type_col = 10,
  chromosome_col = 5,
  start_col = 6,
  end_col = 7,
  plot_title = paste0(this_sample_id),
  plot_subtitle = "Variant Size Distribution",
  scale_value = "width",
  log_10 = TRUE,
  plot_trim = FALSE,
  chr_select = paste0("chr", c(1:22))
)

Arguments

this_sample_id

Sample to be plotted.

maf_data

Optional parameter with maf like df already loaded into R.

maf_path

Optional parameter with path to external maf like file.

ssm

Set to FALSE to get plotting data from get_combined_sv (SVs). Default value is TRUE (plots SSM retrieved from annotate_cn_by_ssm$maf).

projection

Genome build for returned variants (only applicable for ssm = FALSE).

this_seq_type

Seq type for returned CN segments. One of "genome" (default) or "capture".

min_vaf

The minimum tumour VAF for a SV to be returned. Recommended: 0 (only applicable for ssm = FALSE).

variant_type_col

Index of column holding Variant Type (to be used with either maf_data or maf_path).

chromosome_col

Index of column holding Chromosome (to be used with either maf_data or maf_path).

start_col

Index of column with variant start coordinates (to be used with either maf_data or maf_path).

end_col

Index of column with variant end coordinates (to be used with either maf_data or maf_path).

plot_title

Title of plot (default to sample ID).

plot_subtitle

Subtitle for created plot.

scale_value

Scale type for violin plot, accepted values are "area", "width", and "count", default is "count.

log_10

Boolean statement for y-axis, default is TRUE.

plot_trim

If TRUE, trim the tails of the violins to the range of the data. If FALSE (default), don't trim the tails.

chr_select

vector of chromosomes to be included in plot, defaults to autosomes.

Value

A plot as a ggplot object (grob).

Details

Function for plotting variant size distributions. This function takes either a sample ID given to the `this_sample` parameter. In addition, the function can also accept an already loaded MAF or MAF-like object given to the `maf_data` parameter. As a third option, the function can also read a maf from disk (provide path to maf with `maf_path`). A collection of convenient filtering and data subsetting parameters are also available for this function. This plot can also deal with SVs as well as SSM data. To control this, please use the `ssm` parameter. If set to TRUE and if `this_sample` is called, the function gets data with get_ssm_by_sample and if set to FALSE, the function calls `get_manta_sv` to get SV calls for plotting. If the user calls either `maf_data` or `maf_path`, there are a collection of parameters available for specifying the relevant columns in the given data frame (`variant_type_col`, `chhromosome_col`, `start_col`, `end_col`). It is also possible to restrict the returned plot to any given chromosome. This is done with the `chr_select` parameter (default is all autosomes). In addition, plot aesthetics can also be controlled with `plot_title`, `plot_subtitle`, `scale_value`, `log10`, and `trim`. For more info on how to run with these parameters, refer to the parameter descriptions.

Examples

if (FALSE) { # \dontrun{
library(GAMBLR.data)

#plot SSM size distributions:
fancy_v_sizedis(this_sample_id = "DOHH-2")
} # }