added delta symbol to plotting_data.R and pretty labels for dr_other_muts figure
This commit is contained in:
parent
ecbc7541e9
commit
8d9ede186c
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(dr_muts_col, other_muts_col) )
|
||||||
my_comparisons <- list( c("DM", "OM") )
|
my_comparisons <- list( c("DM", "OM") )
|
||||||
|
|
||||||
|
my_ats = 22# axis text size
|
||||||
my_ats = 15# axis text size
|
|
||||||
my_als = 20 # axis label size
|
my_als = 20 # axis label size
|
||||||
my_fls = 20 # facet label size
|
my_fls = 20 # facet label size
|
||||||
my_pts = 22 # plot title size
|
my_pts = 22 # plot title size
|
||||||
|
|
||||||
|
##########################################################################
|
||||||
|
|
||||||
#===========
|
#===========
|
||||||
# Plot1: PS
|
# Plot1: PS
|
||||||
#===========
|
#===========
|
||||||
|
@ -65,7 +66,8 @@ p1 = ggplot(df_lf_ps, aes(x = mutation_info
|
||||||
, vjust = 0)
|
, vjust = 0)
|
||||||
, axis.title.x = element_text(size = my_ats)
|
, axis.title.x = element_text(size = my_ats)
|
||||||
, axis.title.y = 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")
|
, strip.text.x = element_text(size = my_fls, colour = "black")
|
||||||
, legend.title = element_text(color = "black", size = my_als)
|
, legend.title = element_text(color = "black", size = my_als)
|
||||||
, legend.text = element_text(size = my_ats)
|
, 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.format")
|
||||||
, label = "p.signif")
|
, label = "p.signif")
|
||||||
p1
|
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"
|
my_stat_lig = compare_means(param_value~mutation_info, group.by = "param_type"
|
||||||
, data = df_lf_lig, paired = FALSE, p.adjust.method = "BH")
|
, data = df_lf_lig, paired = FALSE, p.adjust.method = "BH")
|
||||||
|
|
||||||
y_value = "param_value"
|
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)) )) +
|
, y = eval(parse(text=y_value)) )) +
|
||||||
facet_wrap(~ param_type
|
facet_wrap(~ param_type
|
||||||
, nrow = 1
|
, nrow = 1
|
||||||
|
@ -108,7 +158,8 @@ p2 = ggplot(df_lf_lig, aes(x = mutation_info
|
||||||
, vjust = 0)
|
, vjust = 0)
|
||||||
, axis.title.x = element_text(size = my_ats)
|
, axis.title.x = element_text(size = my_ats)
|
||||||
, axis.title.y = 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")
|
, strip.text.x = element_text(size = my_fls, colour = "black")
|
||||||
, legend.title = element_text(color = "black", size = my_als)
|
, legend.title = element_text(color = "black", size = my_als)
|
||||||
, legend.text = element_text(size = my_ats)
|
, 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.format")
|
||||||
, label = "p.signif")
|
, label = "p.signif")
|
||||||
|
|
||||||
p2
|
|
||||||
|
|
||||||
#====================================================================
|
|
||||||
#===========
|
|
||||||
# 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
|
p3
|
||||||
|
|
||||||
#====================================================================
|
##########################################################################
|
||||||
#===========
|
#===========
|
||||||
# legend
|
# legend
|
||||||
#===========
|
#===========
|
||||||
|
|
||||||
legend = ggplot(df_lf_foldx, aes(x = mutation_info
|
legend = ggplot(df_lf_foldx, aes(x = mutation_info
|
||||||
, y = eval(parse(text=y_value)) )) +
|
, y = eval(parse(text=y_value)) )) +
|
||||||
facet_wrap(~ param_type
|
facet_wrap(~ param_type
|
||||||
|
@ -186,12 +191,15 @@ legend = ggplot(df_lf_foldx, aes(x = mutation_info
|
||||||
, aes(colour = factor(foldx_outcome))) +
|
, aes(colour = factor(foldx_outcome))) +
|
||||||
theme(legend.text = element_text(size = 25)
|
theme(legend.text = element_text(size = 25)
|
||||||
, legend.direction = "vertical"
|
, 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)))
|
guides(color = guide_legend(override.aes = list(size = 6)))
|
||||||
|
|
||||||
legend
|
legend
|
||||||
|
##########################################################################
|
||||||
#===========================
|
#===========================
|
||||||
# combine
|
# combine
|
||||||
#===========================
|
#===========================
|
||||||
|
@ -202,24 +210,19 @@ cat("Output plot:",plot_dr_other_combined)
|
||||||
svg(plot_dr_other_combined, width = 24, height = 12)
|
svg(plot_dr_other_combined, width = 24, height = 12)
|
||||||
|
|
||||||
#theme_set(theme_gray()) # to preserve default theme
|
#theme_set(theme_gray()) # to preserve default theme
|
||||||
OutPlot = cowplot::plot_grid(p1, p2
|
|
||||||
, nrow = 2
|
|
||||||
, align = "hv"
|
# first combine fold and lig plots (2 and 3)
|
||||||
, axis = "b"
|
c1 = cowplot::plot_grid(p2, p3
|
||||||
, labels = c("", "", "")
|
, nrow = 1
|
||||||
, label_size = my_als)
|
, rel_widths = c(1/6, 5/6))
|
||||||
|
c1
|
||||||
|
|
||||||
|
OutPlot = cowplot::plot_grid(p1, c1
|
||||||
|
, nrow = 2)
|
||||||
print(OutPlot)
|
print(OutPlot)
|
||||||
dev.off()
|
dev.off()
|
||||||
|
|
||||||
|
|
||||||
#---------
|
|
||||||
# plot 2
|
|
||||||
#---------
|
|
||||||
svg(plot_dr_other_foldx , width = 6, height = 7)
|
|
||||||
OutPlot2 = p3
|
|
||||||
print(OutPlot2)
|
|
||||||
dev.off()
|
|
||||||
|
|
||||||
#---------
|
#---------
|
||||||
# plot 3: legend
|
# plot 3: legend
|
||||||
#---------
|
#---------
|
||||||
|
@ -227,3 +230,13 @@ svg(plot_point_legend, width = 6, height = 7)
|
||||||
OutPlot3 = legend
|
OutPlot3 = legend
|
||||||
print(OutPlot3)
|
print(OutPlot3)
|
||||||
dev.off()
|
dev.off()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -110,14 +110,12 @@ df_lig = merged_df3_lig
|
||||||
# name tidying
|
# name tidying
|
||||||
df_lig$mutation_info = as.factor(df_lig$mutation_info)
|
df_lig$mutation_info = as.factor(df_lig$mutation_info)
|
||||||
df_lig$duet_outcome = as.factor(df_lig$duet_outcome)
|
df_lig$duet_outcome = as.factor(df_lig$duet_outcome)
|
||||||
df_lig$ligand_outcome = as.factor(df_lig$ligand_outcome)
|
#df_lig$ligand_outcome = as.factor(df_lig$ligand_outcome)
|
||||||
|
|
||||||
# check
|
# check
|
||||||
table(df_lig$mutation_info)
|
table(df_lig$mutation_info)
|
||||||
|
|
||||||
#========================================================================
|
#========================================================================
|
||||||
|
|
||||||
|
|
||||||
#===========
|
#===========
|
||||||
# Data: ps
|
# Data: ps
|
||||||
#===========
|
#===========
|
||||||
|
@ -155,8 +153,16 @@ str(df_lf_ps)
|
||||||
# assign pretty labels: param_type
|
# assign pretty labels: param_type
|
||||||
levels(df_lf_ps$param_type); table(df_lf_ps$param_type)
|
levels(df_lf_ps$param_type); table(df_lf_ps$param_type)
|
||||||
|
|
||||||
levels(df_lf_ps$param_type)[levels(df_lf_ps$param_type)=="duet_scaled"] <- "DUET"
|
ligand_dist_colname = paste0("Distance to ligand (", angstroms_symbol, ")")
|
||||||
levels(df_lf_ps$param_type)[levels(df_lf_ps$param_type)=="ligand_distance"] <- "Ligand Distance"
|
ligand_dist_colname
|
||||||
|
|
||||||
|
duet_stability_name = paste0(delta_symbol, delta_symbol, "G")
|
||||||
|
duet_stability_name
|
||||||
|
|
||||||
|
#levels(df_lf_ps$param_type)[levels(df_lf_ps$param_type)=="duet_scaled"] <- "Stability"
|
||||||
|
levels(df_lf_ps$param_type)[levels(df_lf_ps$param_type)=="duet_scaled"] <- duet_stability_name
|
||||||
|
#levels(df_lf_ps$param_type)[levels(df_lf_ps$param_type)=="ligand_distance"] <- "Ligand Distance"
|
||||||
|
levels(df_lf_ps$param_type)[levels(df_lf_ps$param_type)=="ligand_distance"] <- ligand_dist_colname
|
||||||
levels(df_lf_ps$param_type)[levels(df_lf_ps$param_type)=="asa"] <- "ASA"
|
levels(df_lf_ps$param_type)[levels(df_lf_ps$param_type)=="asa"] <- "ASA"
|
||||||
levels(df_lf_ps$param_type)[levels(df_lf_ps$param_type)=="rsa"] <- "RSA"
|
levels(df_lf_ps$param_type)[levels(df_lf_ps$param_type)=="rsa"] <- "RSA"
|
||||||
levels(df_lf_ps$param_type)[levels(df_lf_ps$param_type)=="rd_values"] <- "RD"
|
levels(df_lf_ps$param_type)[levels(df_lf_ps$param_type)=="rd_values"] <- "RD"
|
||||||
|
@ -183,7 +189,7 @@ cols_to_select_lig = c("mutationinformation", "mutation", "position", "mutation_
|
||||||
, "ligand_outcome"
|
, "ligand_outcome"
|
||||||
|
|
||||||
, "affinity_scaled"
|
, "affinity_scaled"
|
||||||
, "ligand_distance"
|
#, "ligand_distance"
|
||||||
, "asa"
|
, "asa"
|
||||||
, "rsa"
|
, "rsa"
|
||||||
, "rd_values"
|
, "rd_values"
|
||||||
|
@ -210,7 +216,7 @@ if (nrow(df_lf_lig) == expected_rows_lf_lig){
|
||||||
levels(df_lf_lig$param_type); table(df_lf_lig$param_type)
|
levels(df_lf_lig$param_type); table(df_lf_lig$param_type)
|
||||||
|
|
||||||
levels(df_lf_lig$param_type)[levels(df_lf_lig$param_type)=="affinity_scaled"] <- "Ligand Affinity"
|
levels(df_lf_lig$param_type)[levels(df_lf_lig$param_type)=="affinity_scaled"] <- "Ligand Affinity"
|
||||||
levels(df_lf_lig$param_type)[levels(df_lf_lig$param_type)=="ligand_distance"] <- "Ligand Distance"
|
#levels(df_lf_lig$param_type)[levels(df_lf_lig$param_type)=="ligand_distance"] <- "Ligand Distance"
|
||||||
levels(df_lf_lig$param_type)[levels(df_lf_lig$param_type)=="asa"] <- "ASA"
|
levels(df_lf_lig$param_type)[levels(df_lf_lig$param_type)=="asa"] <- "ASA"
|
||||||
levels(df_lf_lig$param_type)[levels(df_lf_lig$param_type)=="rsa"] <- "RSA"
|
levels(df_lf_lig$param_type)[levels(df_lf_lig$param_type)=="rsa"] <- "RSA"
|
||||||
levels(df_lf_lig$param_type)[levels(df_lf_lig$param_type)=="rd_values"] <- "RD"
|
levels(df_lf_lig$param_type)[levels(df_lf_lig$param_type)=="rd_values"] <- "RD"
|
||||||
|
@ -260,10 +266,14 @@ if (nrow(df_lf_foldx) == expected_rows_lf_foldx){
|
||||||
exit()
|
exit()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
foldx_stability_name = paste0(delta_symbol, delta_symbol, "G")
|
||||||
|
foldx_stability_name
|
||||||
|
|
||||||
# assign pretty labels: param type
|
# assign pretty labels: param type
|
||||||
levels(df_lf_foldx$param_type); table(df_lf_foldx$param_type)
|
levels(df_lf_foldx$param_type); table(df_lf_foldx$param_type)
|
||||||
|
|
||||||
levels(df_lf_foldx$param_type)[levels(df_lf_foldx$param_type)=="foldx_scaled"] <- "Foldx"
|
#levels(df_lf_foldx$param_type)[levels(df_lf_foldx$param_type)=="foldx_scaled"] <- "Stability"
|
||||||
|
levels(df_lf_foldx$param_type)[levels(df_lf_foldx$param_type)=="foldx_scaled"] <- foldx_stability_name
|
||||||
#levels(df_lf_foldx$param_type)[levels(df_lf_foldx$param_type)=="ligand_distance"] <- "Ligand Distance"
|
#levels(df_lf_foldx$param_type)[levels(df_lf_foldx$param_type)=="ligand_distance"] <- "Ligand Distance"
|
||||||
#levels(df_lf_foldx$param_type)[levels(df_lf_foldx$param_type)=="asa"] <- "ASA"
|
#levels(df_lf_foldx$param_type)[levels(df_lf_foldx$param_type)=="asa"] <- "ASA"
|
||||||
#levels(df_lf_foldx$param_type)[levels(df_lf_foldx$param_type)=="rsa"] <- "RSA"
|
#levels(df_lf_foldx$param_type)[levels(df_lf_foldx$param_type)=="rsa"] <- "RSA"
|
||||||
|
|
|
@ -97,6 +97,8 @@ my_df_u_lig = my_df_u[my_df_u$ligand_distance <10,]
|
||||||
angstroms_symbol = "\u212b"
|
angstroms_symbol = "\u212b"
|
||||||
cat(paste0("There are ", nrow(my_df_u_lig), " sites lying within 10", angstroms_symbol, " of the ligand\n"))
|
cat(paste0("There are ", nrow(my_df_u_lig), " sites lying within 10", angstroms_symbol, " of the ligand\n"))
|
||||||
|
|
||||||
|
delta_symbol = "\u0394"; delta_symbol
|
||||||
|
|
||||||
########################################################################
|
########################################################################
|
||||||
# end of data extraction and cleaning for plots #
|
# end of data extraction and cleaning for plots #
|
||||||
########################################################################
|
########################################################################
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue