added delta symbol to plotting_data.R and pretty labels for dr_other_muts figure
This commit is contained in:
parent
f6a440dc55
commit
8648320de7
3 changed files with 108 additions and 83 deletions
|
@ -32,12 +32,13 @@ plot_point_legend = paste0(plotdir,"/", point_legend)
|
|||
#my_comparisons <- list( c(dr_muts_col, other_muts_col) )
|
||||
my_comparisons <- list( c("DM", "OM") )
|
||||
|
||||
|
||||
my_ats = 15# axis text size
|
||||
my_ats = 22# axis text size
|
||||
my_als = 20 # axis label size
|
||||
my_fls = 20 # facet label size
|
||||
my_pts = 22 # plot title size
|
||||
|
||||
##########################################################################
|
||||
|
||||
#===========
|
||||
# Plot1: PS
|
||||
#===========
|
||||
|
@ -65,7 +66,8 @@ p1 = ggplot(df_lf_ps, aes(x = mutation_info
|
|||
, vjust = 0)
|
||||
, axis.title.x = element_text(size = my_ats)
|
||||
, axis.title.y = element_text(size = my_ats)
|
||||
, plot.title = element_text(size = my_pts , hjust = 0.5)
|
||||
, plot.title = element_text(size = my_pts , hjust = 0.5, colour = "black", face = "bold")
|
||||
, strip.background = element_rect(fill = "khaki2")
|
||||
, strip.text.x = element_text(size = my_fls, colour = "black")
|
||||
, legend.title = element_text(color = "black", size = my_als)
|
||||
, legend.text = element_text(size = my_ats)
|
||||
|
@ -79,17 +81,65 @@ p1 = ggplot(df_lf_ps, aes(x = mutation_info
|
|||
#, label = "p.format")
|
||||
, label = "p.signif")
|
||||
p1
|
||||
#===============================================================
|
||||
#===========
|
||||
# Plot 2: LIG
|
||||
#===========
|
||||
|
||||
##########################################################################
|
||||
#=================
|
||||
# Plot 2: Foldx
|
||||
#=================
|
||||
my_stat_foldx = compare_means(param_value~mutation_info, group.by = "param_type"
|
||||
, data = df_lf_foldx, paired = FALSE, p.adjust.method = "BH")
|
||||
|
||||
y_value = "param_value"
|
||||
|
||||
p2 = ggplot(df_lf_foldx, aes(x = mutation_info
|
||||
, y = eval(parse(text=y_value)) )) +
|
||||
facet_wrap(~ param_type
|
||||
, nrow = 1
|
||||
, scales = "free_y") +
|
||||
geom_boxplot(fill = "white", outlier.colour = NA
|
||||
#, position = position_dodge(width = 0.2)
|
||||
, width = 0.5) +
|
||||
geom_point(position = position_jitterdodge(dodge.width=0.01)
|
||||
, alpha = 0.5
|
||||
, show.legend = FALSE
|
||||
, aes(colour = factor(foldx_outcome))) +
|
||||
theme(axis.text.x = element_text(size = my_ats)
|
||||
, axis.text.y = element_text(size = my_ats
|
||||
, angle = 0
|
||||
, hjust = 1
|
||||
, vjust = 0)
|
||||
, axis.title.x = element_text(size = my_ats)
|
||||
, axis.title.y = element_text(size = my_ats)
|
||||
, plot.title = element_text(size = my_pts , hjust = 0.5, colour = "black", face = "bold")
|
||||
, strip.background = element_rect(fill = "palegreen1")
|
||||
, strip.text.x = element_text(size = my_fls, colour = "black")
|
||||
, legend.title = element_text(color = "black", size = my_als)
|
||||
, legend.text = element_text(size = my_ats)
|
||||
#, legend.title = element_blank()
|
||||
, legend.direction = "vertical") +
|
||||
labs(title = "Foldx"
|
||||
, x = ""
|
||||
, y = "") +
|
||||
stat_compare_means(comparisons = my_comparisons
|
||||
, method = "wilcox.test"
|
||||
, paired = FALSE
|
||||
#, label = "p.format")
|
||||
, label = "p.signif")
|
||||
|
||||
p2
|
||||
|
||||
|
||||
##########################################################################
|
||||
#==============
|
||||
# Plot 3: LIG
|
||||
#==============
|
||||
|
||||
my_stat_lig = compare_means(param_value~mutation_info, group.by = "param_type"
|
||||
, data = df_lf_lig, paired = FALSE, p.adjust.method = "BH")
|
||||
|
||||
y_value = "param_value"
|
||||
|
||||
p2 = ggplot(df_lf_lig, aes(x = mutation_info
|
||||
p3 = ggplot(df_lf_lig, aes(x = mutation_info
|
||||
, y = eval(parse(text=y_value)) )) +
|
||||
facet_wrap(~ param_type
|
||||
, nrow = 1
|
||||
|
@ -108,7 +158,8 @@ p2 = ggplot(df_lf_lig, aes(x = mutation_info
|
|||
, vjust = 0)
|
||||
, axis.title.x = element_text(size = my_ats)
|
||||
, axis.title.y = element_text(size = my_ats)
|
||||
, plot.title = element_text(size = my_pts , hjust = 0.5)
|
||||
, plot.title = element_text(size = my_pts , hjust = 0.5, colour = "black", face = "bold")
|
||||
, strip.background = element_rect(fill = "thistle3")
|
||||
, strip.text.x = element_text(size = my_fls, colour = "black")
|
||||
, legend.title = element_text(color = "black", size = my_als)
|
||||
, legend.text = element_text(size = my_ats)
|
||||
|
@ -122,58 +173,12 @@ p2 = ggplot(df_lf_lig, aes(x = mutation_info
|
|||
#, label = "p.format")
|
||||
, label = "p.signif")
|
||||
|
||||
p2
|
||||
p3
|
||||
|
||||
#====================================================================
|
||||
#===========
|
||||
# Plot 3: Foldx
|
||||
#===========
|
||||
my_stat_foldx = compare_means(param_value~mutation_info, group.by = "param_type"
|
||||
, data = df_lf_foldx, paired = FALSE, p.adjust.method = "BH")
|
||||
|
||||
y_value = "param_value"
|
||||
|
||||
p3 = ggplot(df_lf_foldx, aes(x = mutation_info
|
||||
, y = eval(parse(text=y_value)) )) +
|
||||
facet_wrap(~ param_type
|
||||
, nrow = 1
|
||||
, scales = "free_y") +
|
||||
geom_boxplot(fill = "white", outlier.colour = NA
|
||||
#, position = position_dodge(width = 0.2)
|
||||
, width = 0.5) +
|
||||
geom_point(position = position_jitterdodge(dodge.width=0.01)
|
||||
, alpha = 0.5
|
||||
, show.legend = FALSE
|
||||
, aes(colour = factor(foldx_outcome))) +
|
||||
theme(axis.text.x = element_text(size = my_ats)
|
||||
, axis.text.y = element_text(size = my_ats
|
||||
, angle = 0
|
||||
, hjust = 1
|
||||
, vjust = 0)
|
||||
, axis.title.x = element_text(size = my_ats)
|
||||
, axis.title.y = element_text(size = my_ats)
|
||||
, plot.title = element_text(size = my_pts , hjust = 0.5)
|
||||
, strip.text.x = element_text(size = my_fls, colour = "black")
|
||||
#, legend.title = element_text(color = "black", size = my_als)
|
||||
, legend.text = element_text(size = my_ats)
|
||||
, legend.direction = "vertical"
|
||||
, legend.title = element_blank()) +
|
||||
labs(title = ""
|
||||
, x = ""
|
||||
, y = "") +
|
||||
stat_compare_means(comparisons = my_comparisons
|
||||
, method = "wilcox.test"
|
||||
, paired = FALSE
|
||||
#, label = "p.format")
|
||||
, label = "p.signif")
|
||||
|
||||
p3
|
||||
|
||||
#====================================================================
|
||||
##########################################################################
|
||||
#===========
|
||||
# legend
|
||||
#===========
|
||||
|
||||
legend = ggplot(df_lf_foldx, aes(x = mutation_info
|
||||
, y = eval(parse(text=y_value)) )) +
|
||||
facet_wrap(~ param_type
|
||||
|
@ -186,12 +191,15 @@ legend = ggplot(df_lf_foldx, aes(x = mutation_info
|
|||
, aes(colour = factor(foldx_outcome))) +
|
||||
theme(legend.text = element_text(size = 25)
|
||||
, legend.direction = "vertical"
|
||||
, legend.title = element_blank())+
|
||||
|
||||
, legend.title = element_blank()
|
||||
#, axis.text.y = element_text(size = 30, colour = "black", angle = 90)
|
||||
#, axis.text.x = element_text(size = 30, colour = "black", angle = 0)
|
||||
#, strip.background = element_rect(fill="orange")
|
||||
) +
|
||||
guides(color = guide_legend(override.aes = list(size = 6)))
|
||||
|
||||
legend
|
||||
|
||||
##########################################################################
|
||||
#===========================
|
||||
# combine
|
||||
#===========================
|
||||
|
@ -202,24 +210,19 @@ cat("Output plot:",plot_dr_other_combined)
|
|||
svg(plot_dr_other_combined, width = 24, height = 12)
|
||||
|
||||
#theme_set(theme_gray()) # to preserve default theme
|
||||
OutPlot = cowplot::plot_grid(p1, p2
|
||||
, nrow = 2
|
||||
, align = "hv"
|
||||
, axis = "b"
|
||||
, labels = c("", "", "")
|
||||
, label_size = my_als)
|
||||
|
||||
|
||||
# first combine fold and lig plots (2 and 3)
|
||||
c1 = cowplot::plot_grid(p2, p3
|
||||
, nrow = 1
|
||||
, rel_widths = c(1/6, 5/6))
|
||||
c1
|
||||
|
||||
OutPlot = cowplot::plot_grid(p1, c1
|
||||
, nrow = 2)
|
||||
print(OutPlot)
|
||||
dev.off()
|
||||
|
||||
|
||||
#---------
|
||||
# plot 2
|
||||
#---------
|
||||
svg(plot_dr_other_foldx , width = 6, height = 7)
|
||||
OutPlot2 = p3
|
||||
print(OutPlot2)
|
||||
dev.off()
|
||||
|
||||
#---------
|
||||
# plot 3: legend
|
||||
#---------
|
||||
|
@ -227,3 +230,13 @@ svg(plot_point_legend, width = 6, height = 7)
|
|||
OutPlot3 = legend
|
||||
print(OutPlot3)
|
||||
dev.off()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue