Plot box plots for metric for combo data grouped by selected variable
Source:R/plot-boxplot_metric.R
plot_boxplot_metric_combo_by_grp.RdPlot box plots for metric for combo data grouped by selected variable
Usage
plot_boxplot_metric_combo_by_grp(
dt_scores,
selection_var,
selection_name,
group_var,
group_names = NULL,
normalization_type = "GR",
metric = "hsa_score",
fit_source = "gDR",
named_n = 5,
named_n_mode = "top",
grouped_flag = FALSE,
colors_vec = NULL
)Arguments
- dt_scores
data.tablerepresenting data from thescoresassay, outputted bygDRutils::convert_se_assay_to_dt(se, "scores")and comboSummarizedExperiment- selection_var
string name of selected main variable - one value from column
"CellLineName"or"DrugName"- selection_name
string name of selected variable value from column
selection_varto filter data for plotting- group_var
string name of group variable; should to be not numeric variable from
dt_metricsdifferent thanselection_varand not containing unique values for each row- group_names
character vector with names to subset from column
group_var; ifNULLthen all values will be plotted- normalization_type
string with normalization types to be selected one of: "GR" ("GRvalue") or "RV" ("RelativeViability")
- metric
string name of the combo metric; one of: "hsa_score"("Bliss Excess GR" or "Bliss Excess RV" - respectively depending on
normalization_type) or "bliss_score" ("Bliss Score GR" or "Bliss Score RV")- fit_source
string source name for metrics
- named_n
number of points to label based on the highest or lowest
metricvalues; ifgroup_varis"DrugName", points are labeled by"CellLineName"and similarly vice versa- named_n_mode
string determines whether the labels are applied to the highest or lowest values of
metric; one of:"top"or"bottom"- grouped_flag
logical flag whether the boxplots should be colored by
group_var- colors_vec
character vector with colors (name or hex value) to color boxplots; for
grouped_flagset asFALSEonly first from vector will be used
Author
Janina Smoła janina.smola@external.roche.com
Examples
mae <- gDRutils::get_synthetic_data("combo_matrix")
se <- mae[[gDRutils::get_supported_experiments("combo")]]
dt_scores <- gDRutils::convert_se_assay_to_dt(se = se,
assay_name = "scores")
invisible(dt_scores[, Tissue_grp := data.table::fifelse(Tissue == "tissue_w",
"tissue_w",
"tissue_other")])
plot_boxplot_metric_combo_by_grp(dt_scores,
selection_var = "DrugName",
selection_name = c("drug_001", "drug_021"),
group_var = "Tissue")
plot_boxplot_metric_combo_by_grp(dt_scores,
selection_var = "DrugName",
selection_name = c("drug_001", "drug_021"),
group_var = "Tissue_grp",
grouped_flag = TRUE,
colors_vec = c("darkblue", "deeppink"))
plot_boxplot_metric_combo_by_grp(dt_scores,
selection_var = "DrugName",
selection_name = c("drug_001", "drug_021"),
group_var = "Tissue",
grouped_flag = TRUE)
plot_boxplot_metric_combo_by_grp(dt_scores,
selection_var = "DrugName",
selection_name = c("drug_001", "drug_021"),
group_var = "Tissue",
colors_vec = c("darkblue", "orange"))