This function takes the output from ggoncoplot_prep_df and plots it. Should not be exposed since it makes some assumptions about structure of input data.
Usage
ggoncoplot_plot(
data,
show_sample_ids = FALSE,
palette = NULL,
show_ylab_title = FALSE,
show_xlab_title = FALSE,
xlab_title = "Sample",
ylab_title = "Gene",
fontsize_xlab = 16,
fontsize_ylab = 16,
fontsize_genes = 14,
fontsize_samples = 10,
fontsize_legend_title = 12,
fontsize_legend_text = 12,
tile_height = 1,
tile_width = 1,
copy = c("sample", "gene", "tooltip", "mutation_type", "nothing"),
colour_backround = "grey90",
colour_mutation_type_unspecified = "grey10",
fontsize_pathway = 16,
colour_pathway_text = "white",
colour_pathway_bg = "grey10",
colour_pathway_outline = "black",
pathway_text_angle = 0,
legend_title = "Mutation Type",
show_legend_titles = TRUE,
ggoncoplot_guide_ncol = 2,
legend_key_size = 0.3,
margin_t = 0.2,
margin_r = 0.3,
margin_b = 0.2,
margin_l = 0.3,
margin_unit = "cm"
)
Arguments
- data
transformed data from
ggoncoplot_prep_df()
(data.frame)- show_sample_ids
show sample_ids_on_x_axis (flag)
- palette
a named vector mapping all possible mutation types (vector names) to colors (vector values, optional)
- show_ylab_title
show y axis title of oncoplot (flag)
- show_xlab_title
show x axis title of oncoplot (flag)
- 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)- 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_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)
- copy
value to copy to clipboard when an oncoplot tile is clicked (string, one of 'sample', 'gene', 'tooltip', 'mutation_type', 'nothing', default 'sample')
- 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)- fontsize_pathway
fontsize of y axis strip text describing gene pathways (number)
- 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)
- legend_title
name of legend title (string)
- show_legend_titles
show legend titles (flag)
- ggoncoplot_guide_ncol
how many columns to use when describing oncoplot legend (number)
- legend_key_size
width of the legend key block (number)
- margin_t, margin_r, margin_b, margin_l
margin for top, right, bottom, and left side of plot. By default, unit is 'cm' but can be changed by setting
margin_unit
to any valueggplot2::margin()
will understand (number)- margin_unit
Unit of margin specification. By default is 'cm' but can be changed by setting
margin_unit
to any valueggplot2::margin()
will understand (string)
Examples
# ===== GBM =====
gbm_csv <- system.file(
package = "ggoncoplot",
"testdata/GBM_tcgamutations_mc3_maf.csv.gz"
)
gbm_clinical_csv <- system.file(
package = "ggoncoplot",
"testdata/GBM_tcgamutations_mc3_clinical.csv"
)
gbm_df <- read.csv(file = gbm_csv, header = TRUE)
gbm_clinical_df <- read.csv(file = gbm_clinical_csv, header = TRUE)
# Plot Basic Oncoplot
ggoncoplot(
gbm_df,
"Hugo_Symbol",
"Tumor_Sample_Barcode",
col_mutation_type = "Variant_Classification",
metadata = gbm_clinical_df,
cols_to_plot_metadata = "gender"
)
#> ℹ 2 samples with metadata have no mutations. Fitering these out
#> ℹ To keep these samples, set `metadata_require_mutations = FALSE`. To view them in the oncoplot ensure you additionally set `show_all_samples = TRUE`
#> → TCGA-06-0165-01
#> → TCGA-06-0167-01
#>
#> ── 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
#>
#> ── Plotting Sample Metadata ────────────────────────────────────────────────────
#> ! Categorical columns must have <= 6 unique values to be visualised. Columns with too many unique values: (18), (327), and (327)
#>
#> ── Sorting
#> ℹ Sorting X axis by: Order of appearance
#>
#> ── Generating Plot
#> ℹ Found 1 plottable columns in data
# Customise how the Oncoplot looks
ggoncoplot(
gbm_df,
"Hugo_Symbol",
"Tumor_Sample_Barcode",
col_mutation_type = "Variant_Classification",
metadata = gbm_clinical_df,
cols_to_plot_metadata = "gender",
# Customise Visual Options
options = ggoncoplot_options(
xlab_title = "Glioblastoma Samples",
ylab_title = "Top 10 mutated genes"
)
)
#> ℹ 2 samples with metadata have no mutations. Fitering these out
#> ℹ To keep these samples, set `metadata_require_mutations = FALSE`. To view them in the oncoplot ensure you additionally set `show_all_samples = TRUE`
#> → TCGA-06-0165-01
#> → TCGA-06-0167-01
#>
#> ── 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
#>
#> ── Plotting Sample Metadata ────────────────────────────────────────────────────
#> ! Categorical columns must have <= 6 unique values to be visualised. Columns with too many unique values: (18), (327), and (327)
#>
#> ── Sorting
#> ℹ Sorting X axis by: Order of appearance
#>
#> ── Generating Plot
#> ℹ Found 1 plottable columns in data