Skip to contents

Customise the look of your oncoplot.

Usage

ggoncoplot_options(
  interactive_svg_width = 12,
  interactive_svg_height = 6,
  selection_type = c("none", "multiple", "single"),
  plotsize_tmb_rel_height = 10,
  plotsize_gene_rel_width = 20,
  plotsize_metadata_rel_height = 20,
  buffer_metadata = 2,
  buffer_tmb = 1,
  xlab_title = "Sample",
  ylab_title = "Gene",
  sample_id_position = c("bottom", "top"),
  sample_id_angle = 90,
  fontsize_xlab = 26,
  fontsize_ylab = 26,
  fontsize_genes = 16,
  fontsize_samples = 12,
  fontsize_count = 14,
  fontsize_tmb_title = 14,
  fontsize_tmb_axis = 11,
  fontsize_pathway = 16,
  fontsize_legend_title = 12,
  fontsize_legend_text = 12,
  tile_height = 1,
  tile_width = 1,
  colour_backround = "grey90",
  colour_mutation_type_unspecified = "grey10",
  show_sample_ids = FALSE,
  show_ylab_title = FALSE,
  show_xlab_title = FALSE,
  show_ylab_title_tmb = FALSE,
  show_legend = TRUE,
  show_legend_titles = TRUE,
  show_axis_gene = TRUE,
  show_genebar_labels = FALSE,
  show_axis_tmb = TRUE,
  log10_transform_tmb = TRUE,
  scientific_tmb = FALSE,
  genebar_label_padding = 0.3,
  genebar_only_pad_when_labels_shown = TRUE,
  genebar_label_nudge = 2,
  genebar_label_round = 0,
  genebar_scale_breaks = ggplot2::waiver(),
  genebar_scale_n_breaks = 3,
  colour_pathway_text = "white",
  colour_pathway_bg = "grey10",
  colour_pathway_outline = "black",
  pathway_text_angle = 0,
  ggoncoplot_guide_ncol = 2,
  legend_key_size = 0.4,
  prettify_legend_titles = TRUE,
  prettify_legend_values = TRUE,
  prettify_function = prettify,
  metadata_position = c("bottom", "top"),
  fontsize_metadata_text = 12,
  fontsize_metadata_legend_title = fontsize_legend_title,
  fontsize_metadata_legend_text = fontsize_legend_text,
  fontsize_metadata_barplot_y_numbers = 8,
  metadata_legend_nrow = NULL,
  metadata_legend_ncol = NULL,
  metadata_legend_key_size = legend_key_size,
  metadata_na_marker = "!",
  metadata_na_marker_size = 8,
  metadata_maxlevels = 6,
  metadata_numeric_plot_type = c("bar", "heatmap"),
  metadata_legend_orientation_heatmap = c("horizontal", "vertical"),
  metadata_colours_default = c("#66C2A5", "#FC8D62", "#8DA0CB", "#E78AC3", "#A6D854",
    "#FFD92F", "#E5C494")
)

Arguments

interactive_svg_width

dimensions of interactive plot (number)

interactive_svg_height

dimensions of interactive plot (number)

selection_type

Defines the type of data point selection allowed when the ggplot is interactive. Options include 'none' (default), 'multiple' (enables lasso-select tool), and 'single' (supports single-click selection).

plotsize_tmb_rel_height

percentage of vertical space TMB margin plot should take up. Must be some value between 5-90 (number)

plotsize_gene_rel_width

percentage of horizontal space the gene barplot should take up. Must be some value between 5-90 (number)

plotsize_metadata_rel_height

percentage of vertical space the metadata tile plot should take up. Must be some value between 5-90 (number)

buffer_metadata, buffer_tmb

amount of space to add between the main oncoplot and tmb/metadata marginal plots (number)

xlab_title

x axis label. Set xlab_title = NULL to remove title (string)

ylab_title

y axis of interactive plot. Set ylab_title = NULL to remove title (string)

sample_id_position

should sample names on the x axis be on the top or bottom of the main oncoplot (string)

sample_id_angle

angle of the sample names (number)

fontsize_xlab

size of x axis title (number)

fontsize_ylab

size of y axis title (number)

fontsize_genes

size of y axis text (gene names) (number)

fontsize_samples

size of x axis text (sample names). Ignored unless show_sample_ids is set to true (number)

fontsize_count

fontsize of gene mutation count x axis (number)

fontsize_tmb_title

fontsize of y axis title for TMB marginal plot (number)

fontsize_tmb_axis

fontsize of y axis text for TMB marginal plot (number)

fontsize_pathway

fontsize of y axis strip text describing gene pathways (number)

fontsize_legend_title

fontsize of the legend titles (number)

fontsize_legend_text

fontsize of the legend text (number)

tile_height

proportion of available vertical space each tile will take up (0-1) (number)

tile_width

proportion of available horizontal space each tile take up (0-1) (number)

colour_backround

colour used for background non-mutated tiles (string)

colour_mutation_type_unspecified

colour of mutations in oncoplot and margin plots if col_mutation_type is not supplied (string)

show_sample_ids

show sample_ids_on_x_axis (flag)

show_ylab_title

show y axis title of oncoplot (flag)

show_xlab_title

show x axis title of oncoplot (flag)

show_ylab_title_tmb

show y axis title of TMB margin plot (flag)

show_legend

show the oncoplot legend

show_legend_titles

show legend titles (flag)

show_axis_gene

show x axis line/ticks/labels for gene barplot (flag)

show_genebar_labels

should gene barplot be labelled with % of samples the gene is mutated in (flag)

show_axis_tmb

show y axis line/ticks/labels for TMB barplot (flag)

log10_transform_tmb

log10 transform total number of mutations for TMB marginal plot (flag)

scientific_tmb

display tmb counts in scientific notation (flag)

genebar_label_padding

how much padding to add to the x axis of the gene barplot (number)

genebar_only_pad_when_labels_shown

only apply genebar_label_padding when labels are shown (flag)

genebar_label_nudge

how much padding to add between the gene barplot and bar annotations (number)

genebar_label_round

how many digits to round the genebar labels to (number)

genebar_scale_breaks

fine-grained control over the x axis breaks on the gene barplot. One of:

  • NULL for no minor breaks

  • waiver() for the default breaks (none for discrete, one minor break between each major break for continuous)

  • A numeric vector of positions

  • A function that given the limits returns a vector of minor breaks. When the function has two arguments, it will be given the limits and major break positions.

genebar_scale_n_breaks

an integer guiding the number of breaks The algorithm may choose a slightly different number to ensure nice break labels. Will only have an effect if genebar_scale_breaks = ggplot2::waiver(). Use NULL to use the default

colour_pathway_text

colour of text describing pathways (string)

colour_pathway_bg

background fill colour of pathway strips (string)

colour_pathway_outline

outline colour of pathway strips (string)

pathway_text_angle

angle of pathway text label (typically 0 or 90 degrees) (number)

ggoncoplot_guide_ncol

how many columns to use when describing oncoplot legend (number)

legend_key_size

width of the legend key block (number)

prettify_legend_titles

Should legend titles be prettified to more human-readable forms (e.g. converting 'my_title' to 'My Title'). Prettification can be customised using the 'prettify_function' argument (flag)

prettify_legend_values

Should legend values be prettified to more human-readable forms (e.g. converting 'my_title' to 'My Title'). Prettification can be customised using the 'prettify_function' argument (flag)

prettify_function

a function that takes a string and returns a nicely formatted string. Used to prettify legend titles and values (function)

metadata_position

should the metadata plot be at the top or bottom of the oncoplot.

fontsize_metadata_text

fontsize of the y axis text for in the sample metadata plot (number)

fontsize_metadata_legend_title

fontsize of the titles of metadata legends. Will default to fontsize_legend_text (number)

fontsize_metadata_legend_text

fontsize of the text in metadata legends. Will default to fontsize_legend_title (number)

fontsize_metadata_barplot_y_numbers

fontsize of the text describing numeric barplot max & min values (number)

metadata_legend_nrow

number of rows allowed per metadata legend (number)

metadata_legend_ncol

number of columns allowed per metadata legend (number)

metadata_legend_key_size

width of the legend key block (number). Defaults to legend_key_size

metadata_na_marker

character used to indicate data is missing (string)

metadata_na_marker_size

size of character used when data is missing (number)

metadata_maxlevels

or categorical variables, what is the maximum number of distinct values to allow (too many will make it hard to find a palette that suits) (number)

metadata_numeric_plot_type

visual representation of numeric properties. One of 'bar', for bar charts, or 'heatmap' for heatmaps

metadata_legend_orientation_heatmap

the orientation of heatmaps in legends. One of "horizontal" or "vertical" number of breaks given by the transformation.

metadata_colours_default

Default colors for categorical variables without a custom palette.

Value

ggoncoplot options object ready to be passed to ggoncoplot() options argument

Examples


# Read GBM MAF file
gbm_csv <- system.file(
  package = "ggoncoplot",
  "testdata/GBM_tcgamutations_mc3_maf.csv.gz"
)
gbm_df <- read.csv(file = gbm_csv, header = TRUE)

# Plot Oncoplot and Customise Options
gbm_df |>
  ggoncoplot(
    col_genes = "Hugo_Symbol",
    col_samples = "Tumor_Sample_Barcode",
    col_mutation_type = "Variant_Classification",

    # Customise Visual Options
    options = ggoncoplot_options(

      # Interactive Plot Options
      interactive_svg_width = 12,
      interactive_svg_height = 6,

      # Relative height of different plotsizes
      plotsize_tmb_rel_height = 10,
      plotsize_gene_rel_width = 20,
      plotsize_metadata_rel_height = 20,

      # Axis Titles
      xlab_title = "Glioblastoma Samples",
      ylab_title = "Top 10 mutated genes",

      # Fontsizes
      fontsize_xlab = 40,
      fontsize_ylab = 40,
      fontsize_genes = 16,
      fontsize_samples = 12,
      fontsize_count = 14,
      fontsize_tmb_title = 14,
      fontsize_tmb_axis = 11,
      fontsize_pathway = 16,

      # Customise Tiles
      tile_height = 1,
      tile_width = 1,
      colour_backround = "grey90",
      colour_mutation_type_unspecified = "grey10",

      # Show different elements
      show_sample_ids = FALSE,
      show_ylab_title = FALSE,
      show_xlab_title = FALSE,
      show_ylab_title_tmb = FALSE,
      show_axis_gene = TRUE,
      show_axis_tmb = TRUE,

      # Transformation and label scales
      log10_transform_tmb = TRUE,
      scientific_tmb = FALSE,

      # Gene Barplot Specific Options
      show_genebar_labels = TRUE,
      genebar_label_padding = 0.2,
      genebar_only_pad_when_labels_shown = TRUE,
      genebar_label_nudge = 2,
      genebar_label_round = 1,

      # Pathway Faceting Colours / Text
      colour_pathway_text = "white",
      colour_pathway_bg = "grey10",
      colour_pathway_outline = "black",
      pathway_text_angle = 0,

      # Legend number of columns
      ggoncoplot_guide_ncol = 2
    )
  )
#> 
#> ── Identify Class ──
#> 
#>  Found 7 unique mutation types in input set
#>  0/7 mutation types were valid PAVE terms
#>  0/7 mutation types were valid SO terms
#>  7/7 mutation types were valid MAF terms
#>  Mutation Types are described using valid MAF terms ... using MAF palete