Skip to contents

Generate a bar plot visualizing total variant (SSM or SVs) count for selected contigs.

Usage

fancy_v_count(
  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,
  plot_title = paste0(this_sample_id),
  plot_subtitle = "Variant Count For Selected Contigs",
  chr_select = paste0("chr", c(1:22)),
  variant_select = c("DEL", "INS", "DUP"),
  snp_colours = c(SNP = "#2B9971", DNP = "#993F2B", TNP = "#A62656"),
  hide_legend = FALSE,
  log10_y = FALSE
)

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_manta_sv (SVs). Default value is TRUE (plots SSM retrieved from get_ssm_by_sample).

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).

plot_title

Title of plot (default to sample ID).

plot_subtitle

Subtitle for created plot.

chr_select

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

variant_select

Subtypes of SVs to be included in plot, default is DEL, INS and DUP.

snp_colours

Optional vector with colours for SNPs (DNP and TNP).

hide_legend

Set to True to remove legend from plot, default is FALSE.

log10_y

Set to TRUE to force y axis to be in log10.

Value

A plot as a ggplot object (grob).

Details

This function creates a barplot showing the total number of variants for a selected sample. Convenience parameters for restricting the returned plot are available. For example, with `ssm` (Boolean) you can toggle if the plot will be in respect to SSM (`ssm = TRUE`) or if you wish to count SVs (`ssm = FALSE`). In addition, this plot can also accept a variety of incoming data types. Either, you supply the function with a sample ID (`this_sample_id`) and the function will retrieve data using get_ssm_by_sample or get_manta_sv (depending on how the `ssm` parameter is used). This function also supports a maf or maf-like data frame directly, this is done with `maf_data` or `maf_path`. If data is supplied with either of these parameters, the user can specify what column holds the variant type information as well as chromosome information (`variant_type_col` and `chromosome_col`). Lastly, this plotting function also have convenient parameters for customizing the returned plot, e.g `plot_title`, `y_interval`, `hide_legend`, and`plot_subtitle` and `snp_colours`. lastly, it is also possible to control what variants are to be counted with `variant_select`. Default is deletions, insertions and duplications, c("DEL", "DUP", "INS"). Not that the variant types specified in this parameter must match with whatever is present in the corresponding `variant_type_col`.

Examples

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

#count all variants for one sample (default parameters)
fancy_v_count(this_sample_id = "DOHH-2")
} # }