Skip to contents

Visualizing the number of SNVs per chromosome.

Usage

fancy_snv_chrdistplot(
  this_sample_id,
  maf_data,
  maf_path = NULL,
  variant_type_col = 10,
  chromosome_col = 5,
  plot_title = paste0(this_sample_id),
  plot_subtitle = "SNV Distribution Per Chromosome",
  chr_select = paste0("chr", c(1:22)),
  include_dnp = FALSE,
  hide_legend = FALSE,
  this_seq_type = "genome",
  projection = "grch37"
)

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.

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.

include_dnp

Optional argument for including DNPs. Default is FALSE.

hide_legend

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

this_seq_type

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

projection

Genome build for returned variants. Default is grch37.

Value

A plot as a ggplot object (grob).

Details

This function takes on an already loaded maf-like data frame, or a path to the maf file of interest. In addition, the user can also give this function a sample ID and the function will run get_ssm_by_sample to get data for plotting. If a maf file or data frame is used, the user has the chance to specify what column that holds the Variant Type information (`variant_type_col`), in addition the user can also specify what column in the incoming maf that is corresponding to the chromosome annotations. This function also includes useful subsetting options. For example, `chr_select` allows the user to restrict the plot to specific chromosomes. `include_dnp` is an optional argument (Boolean) for if variants of this subtype should be included or not. Lastly, this plotting function also have convenient parameters for customizing the returned plot, e.g `plot_title`, `y_interval`, `hide_legend`, and`plot_subtitle`.

Examples

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

#plot SNVs
fancy_snv_chrdistplot(this_sample_id = "DOHH-2")

#plot SNVs and DNPs
fancy_snv_chrdistplot(this_sample_id = "DOHH-2",
                      include_dnp = TRUE,
                      plot_subtitle = "SNV + DNP Distribution Per Chromosome")
} # }