Using result data from get_group_comparison, this function plots
genotypes/phenotypes comparison between signature groups using ggplot2 package and return
a list of ggplot
object contains individual and combined plots. The combined
plot is easily saved to local using cowplot::save_plot()
. Of note, default fisher
test p values are shown for categorical data and fdr values are shown for
continuous data.
show_group_comparison( group_comparison, xlab = "group", ylab_co = NA, legend_title_ca = NA, legend_position_ca = "bottom", set_ca_sig_yaxis = FALSE, set_ca_custom_xlab = FALSE, show_pvalue = TRUE, ca_p_threshold = 0.01, method = "wilcox.test", p.adjust.method = "fdr", base_size = 12, font_size_x = 12, text_angle_x = 30, text_hjust_x = 0.2, ... )
group_comparison | a |
---|---|
xlab | lab name of x axis for all plots. if it is |
ylab_co | lab name of y axis for plots of continuous type data. Of note,
this argument should be a character vector has same length as |
legend_title_ca | legend title for plots of categorical type data. |
legend_position_ca | legend position for plots of categorical type data.
Of note,
this argument should be a character vector has same length as |
set_ca_sig_yaxis | if |
set_ca_custom_xlab | only works when |
show_pvalue | if |
ca_p_threshold | a p threshold for categorical variables, default is 0.01.
A p value less than 0.01 will be shown as |
method | a character string indicating which method to be used for comparing means. It can be 't.test', 'wilcox.test' etc.. |
p.adjust.method | correction method, default is 'fdr'. Run |
base_size | overall font size. |
font_size_x | font size for x. |
text_angle_x | text angle for x. |
text_hjust_x | adjust x axis text |
... | other paramters pass to |
a list
of ggplot
objects.
Shixiang Wang w_shixiang@163.com
load(system.file("extdata", "toy_copynumber_signature_by_W.RData", package = "sigminer", mustWork = TRUE )) # Assign samples to clusters groups <- get_groups(sig, method = "k-means") set.seed(1234) groups$prob <- rnorm(10) groups$new_group <- sample(c("1", "2", "3", "4", NA), size = nrow(groups), replace = TRUE) # Compare groups (filter NAs for categorical coloumns) groups.cmp <- get_group_comparison(groups[, -1], col_group = "group", cols_to_compare = c("prob", "new_group"), type = c("co", "ca"), verbose = TRUE ) # Compare groups (Set NAs of categorical columns to 'Rest') groups.cmp2 <- get_group_comparison(groups[, -1], col_group = "group", cols_to_compare = c("prob", "new_group"), type = c("co", "ca"), NAs = "Rest", verbose = TRUE ) show_group_comparison(groups.cmp) ggcomp <- show_group_comparison(groups.cmp2) ggcomp$co_comb ggcomp$ca_comb