270 lines
7.3 KiB
R
270 lines
7.3 KiB
R
duetP
|
|
foldxP
|
|
deepddgP
|
|
dynamut2P
|
|
proveanP
|
|
snap2P
|
|
|
|
mLigP
|
|
mmLigP
|
|
posC_lig
|
|
ppi2P
|
|
posC_ppi2
|
|
sensP
|
|
peP
|
|
|
|
#========================
|
|
# Common title settings
|
|
#=========================
|
|
theme_georgia <- function(...) {
|
|
theme_gray(base_family = "sans", ...) +
|
|
theme(plot.title = element_text(face = "bold"))
|
|
}
|
|
title_theme <- calc_element("plot.title", theme_georgia())
|
|
|
|
###############################################################
|
|
common_bp_title = paste0("Sites <", DistCutOff, angstroms_symbol)
|
|
|
|
# extract common legends
|
|
# lig affinity
|
|
common_legend_outcome = get_legend(mLigP +
|
|
guides(color = guide_legend(nrow = 1)) +
|
|
theme(legend.position = "top"))
|
|
|
|
# stability
|
|
common_legend_outcome = get_legend(duetP +
|
|
guides(color = guide_legend(nrow = 1)) +
|
|
theme(legend.position = "top"))
|
|
# conservation
|
|
cons_common_legend_outcome = get_legend(snap2P +
|
|
guides(color = guide_legend(nrow = 1)) +
|
|
theme(legend.position = "top"))
|
|
###################################################################
|
|
#==================================
|
|
# Stability+Consevation: COMBINE
|
|
#==================================
|
|
tt_size = 10
|
|
#----------------------------
|
|
# stability and consv title
|
|
#----------------------------
|
|
tt_size = 10
|
|
tt_stab = ggdraw() +
|
|
draw_label(
|
|
paste0("Stability outcome"),
|
|
fontfamily = title_theme$family,
|
|
fontface = title_theme$face,
|
|
#size = title_theme$size
|
|
size = tt_size
|
|
)
|
|
|
|
tt_cons = ggdraw() +
|
|
draw_label(
|
|
paste0("Conservation outcome"),
|
|
fontfamily = title_theme$family,
|
|
fontface = title_theme$face,
|
|
size = tt_size
|
|
)
|
|
|
|
#----------------------
|
|
# Output plot
|
|
#-----------------------
|
|
stab_cons_CLP = paste0(outdir_images
|
|
,tolower(gene)
|
|
,"_stab_cons_BP_CLP.png")
|
|
|
|
print(paste0("plot filename:", stab_cons_CLP))
|
|
png(stab_cons_CLP, units = "in", width = 10, height = 5, res = 300 )
|
|
|
|
cowplot::plot_grid(
|
|
cowplot::plot_grid(
|
|
cowplot::plot_grid(
|
|
tt_stab,
|
|
common_legend_outcome,
|
|
nrow = 2
|
|
),
|
|
cowplot::plot_grid(
|
|
duetP,
|
|
foldxP,
|
|
deepddgP,
|
|
dynamut2P,
|
|
nrow = 1,
|
|
labels = c("A", "B", "C", "D"),
|
|
label_size = 12),
|
|
nrow = 2,
|
|
rel_heights=c(1,10)
|
|
),
|
|
NULL,
|
|
cowplot::plot_grid(
|
|
cowplot::plot_grid(
|
|
cowplot::plot_grid(
|
|
tt_cons,
|
|
cons_common_legend_outcome,
|
|
nrow = 2
|
|
),
|
|
cowplot::plot_grid(
|
|
proveanP,
|
|
snap2P,
|
|
nrow=1,
|
|
labels = c("E", "F"),
|
|
align = "hv"),
|
|
nrow = 2,
|
|
rel_heights = c(1, 10),
|
|
label_size = 12),
|
|
nrow=1
|
|
),
|
|
rel_widths = c(2,0.15,1),
|
|
nrow=1
|
|
)
|
|
|
|
dev.off()
|
|
|
|
#################################################################
|
|
#=======================================
|
|
# Affinity barplots: COMBINE ALL three
|
|
#========================================
|
|
|
|
ligT = paste0(common_bp_title, " ligand")
|
|
lig_affT = ggdraw() +
|
|
draw_label(
|
|
ligT,
|
|
fontfamily = title_theme$family,
|
|
fontface = title_theme$face,
|
|
#size = title_theme$size
|
|
size = 8
|
|
)
|
|
|
|
p1 = cowplot::plot_grid(cowplot::plot_grid(lig_affT
|
|
, common_legend_outcome
|
|
, nrow=2),
|
|
cowplot::plot_grid(mLigP, mmLigP, posC_lig
|
|
, nrow = 1
|
|
, rel_widths = c(1,1,1.8)
|
|
, align = "h"),
|
|
nrow = 2,
|
|
rel_heights = c(1,8)
|
|
|
|
)
|
|
#p1
|
|
###########################################################
|
|
ppi2T = paste0(common_bp_title, " PP-interface")
|
|
ppi2_affT = ggdraw() +
|
|
draw_label(
|
|
ppi2T,
|
|
fontfamily = title_theme$family,
|
|
fontface = title_theme$face,
|
|
#size = title_theme$size
|
|
size = 8
|
|
)
|
|
###########################################################
|
|
p2 = cowplot::plot_grid(cowplot::plot_grid(ppi2_affT, common_legend_outcome, nrow=2),
|
|
cowplot::plot_grid(ppi2P, posC_ppi2
|
|
, nrow = 1
|
|
, rel_widths = c(1.2,1.8)
|
|
, align = "h"),
|
|
nrow = 2,
|
|
rel_heights = c(1,8)
|
|
)
|
|
#p2
|
|
###########################################################
|
|
# PE + All position count
|
|
peT_allT = ggdraw() +
|
|
draw_label(
|
|
paste0("All mutation sites"),
|
|
fontfamily = title_theme$family,
|
|
fontface = title_theme$face,
|
|
#size = title_theme$size
|
|
size = 8
|
|
)
|
|
|
|
p3 = cowplot::plot_grid(cowplot::plot_grid(peT_allT, nrow = 2
|
|
, rel_widths = c(1,3),axis = "lr"),
|
|
cowplot::plot_grid(
|
|
peP2, posC_all,
|
|
nrow = 2,
|
|
rel_widths = c(1,1),
|
|
align = "v",
|
|
axis = "lr",
|
|
rel_heights = c(1,8)
|
|
),
|
|
rel_heights = c(1,18),
|
|
nrow = 2,axis = "lr")
|
|
p3
|
|
#===============
|
|
# Final combine
|
|
#===============
|
|
w = 11.79
|
|
h = 3.5
|
|
mut_impact_CLP = paste0(outdir_images
|
|
,tolower(gene)
|
|
,"_mut_impactCLP.png")
|
|
|
|
#svg(affP, width = 20, height = 5.5)
|
|
print(paste0("plot filename:", mut_impact_CLP))
|
|
png(mut_impact_CLP, units = "in", width = w, height = h, res = 300 )
|
|
|
|
cowplot::plot_grid(p1, p2, p3
|
|
, nrow = 1
|
|
, labels = "AUTO"
|
|
, label_size = 12
|
|
, rel_widths = c(3,2,2)
|
|
#, rel_heights = c(1)
|
|
)
|
|
|
|
dev.off()
|
|
##################################################
|
|
sensP
|
|
consurfP
|
|
#=================
|
|
# Combine sensitivity + ConSurf
|
|
# or ConSurf
|
|
#=================
|
|
w = 3
|
|
h = 3
|
|
# sens_conP = paste0(outdir_images
|
|
# ,tolower(gene)
|
|
# ,"_sens_cons_CLP.png")
|
|
#
|
|
# print(paste0("plot filename:", sens_conP))
|
|
# png(sens_conP, units = "in", width = w, height = h, res = 300 )
|
|
#
|
|
# cowplot::plot_grid(sensP, consurfP,
|
|
# nrow = 2,
|
|
# rel_heights = c(1, 1.5)
|
|
# )
|
|
#
|
|
# dev.off()
|
|
|
|
conCLP = paste0(outdir_images
|
|
,tolower(gene)
|
|
,"_consurf_BP.png")
|
|
|
|
print(paste0("plot filename:", conCLP))
|
|
png(conCLP, units = "in", width = w, height = h, res = 300 )
|
|
consurfP
|
|
|
|
dev.off()
|
|
#================================
|
|
# Sensitivity mutation numbers: geom_tile
|
|
#================================
|
|
sensCLP = paste0(outdir_images
|
|
,tolower(gene)
|
|
,"_sensN_tile.png")
|
|
|
|
print(paste0("plot filename:", sensCLP))
|
|
png(sensCLP, units = "in", width = 1, height = 1, res = 300 )
|
|
sensP
|
|
dev.off()
|
|
#================================
|
|
# Sensitivity SITE numbers: geom_tile
|
|
#================================
|
|
sens_siteCLP = paste0(outdir_images
|
|
,tolower(gene)
|
|
,"_sens_siteC_tile.png")
|
|
|
|
print(paste0("plot filename:", sens_siteCLP))
|
|
png(sens_siteCLP, units = "in", width = 1, height = 1, res = 300 )
|
|
sens_siteP
|
|
dev.off()
|
|
|
|
###########################################################
|
|
|