generated ggpairs plots finally

This commit is contained in:
Tanushree Tunstall 2022-08-15 19:05:22 +01:00
parent b68841b337
commit a3e5283a9b
11 changed files with 657 additions and 939 deletions

View file

@ -4,7 +4,6 @@ posC_lig
ppi2P
posC_ppi2
peP
pe_allCL
theme_georgia <- function(...) {
@ -22,12 +21,127 @@ common_legend_outcome = get_legend(mLigP +
guides(color = guide_legend(nrow = 1)) +
theme(legend.position = "top"))
###############################################################
# ###############################################################
# #================================
# # Lig Affinity: outcome + site
# #================================
# 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
# )
# #-------------
# # Outplot
# #-------------
# ligaffP = paste0(outdir_images
# ,tolower(gene)
# ,"_lig_oc.png")
#
# #svg(affP, width = 20, height = 5.5)
# print(paste0("plot filename:", ligaffP))
# png(ligaffP, units = "in", width = 6, height = 4, res = 300 )
# cowplot::plot_grid(cowplot::plot_grid(lig_affT,common_legend_outcome,
# nrow = 2,
# rel_heights = c(1,1)
# ),
# cowplot::plot_grid(mLigP, mmLigP, posC_lig
# , nrow = 1
# #, labels = c("A", "B", "C","D")
# , rel_widths = c(1,1,1.8)
# , align = "h"),
# nrow = 2,
# labels = c("A", ""),
# label_size = 12,
# rel_heights = c(1,8))
# dev.off()
# #############################################################
# #================================
# # PPI2 Affinity: outcome + site
# #================================
# 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
# )
#
#
# #-------------
# # Outplot: PPI2
# #-------------
# ppiaffP = paste0(outdir_images
# ,tolower(gene)
# ,"_ppi2_oc.png")
#
# #svg(affP, width = 20, height = 5.5)
# print(paste0("plot filename:", ppiaffP))
# png(ppiaffP, units = "in", width = 6, height = 4, res = 300 )
#
#
# cowplot::plot_grid(cowplot::plot_grid(ppi2_affT, common_legend_outcome,
# nrow = 2,
# rel_heights = c(1,1)),
# cowplot::plot_grid(ppi2P, posC_ppi2
# , nrow = 1
# , rel_widths = c(1.2,1.8)
# , align = "h"
# , label_size = my_label_size),
# nrow = 2,
# labels = c("B", ""),
# label_size = 12,
# rel_heights = c(1,8)
# )
#
# dev.off()
# #############################################################
#peP # pe counts
#================================
# Lig Affinity: outcome + site
# 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
# )
# #------------------------
# # Outplot: lig+ppi2+pe
# #------------------------
# pe_allCL = paste0(outdir_images
# ,tolower(gene)
# ,"_pe_oc.png")
#
# #svg(affP, width = 20, height = 5.5)
# print(paste0("plot filename:", pe_allCL))
# png(pe_allCL, units = "in", width = 6, height = 4, res = 300 )
#
#
# cowplot::plot_grid(peT_allT,
# cowplot::plot_grid(peP, posC_all
# , nrow = 1
# , rel_widths = c(1, 2)
# , align = "h"),
# nrow = 2,
# labels = c("C", "", ""),
# label_size = 12,
# rel_heights = c(1,8))
#
# dev.off()
#===========================================
# COMBINE ALL three
#==========================================
ligT = paste0(common_bp_title, " ligand")
lig_affT = ggdraw() +
lig_affT = ggdraw() +
draw_label(
ligT,
fontfamily = title_theme$family,
@ -36,113 +150,6 @@ lig_affT = ggdraw() +
size = 8
)
#-------------
# Outplot
#-------------
ligaffP = paste0(outdir_images
,tolower(gene)
,"_lig_oc.png")
#svg(affP, width = 20, height = 5.5)
print(paste0("plot filename:", ligaffP))
png(ligaffP, units = "in", width = 6, height = 4, res = 300 )
cowplot::plot_grid(cowplot::plot_grid(lig_affT,common_legend_outcome,
nrow = 2,
rel_heights = c(1,1)
),
cowplot::plot_grid(mLigP, mmLigP, posC_lig
, nrow = 1
#, labels = c("A", "B", "C","D")
, rel_widths = c(1,1,1.8)
, align = "h"),
nrow = 2,
labels = c("A", ""),
label_size = 12,
rel_heights = c(1,8))
dev.off()
#############################################################
#================================
# PPI2 Affinity: outcome + site
#================================
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
)
#-------------
# Outplot: PPI2
#-------------
ppiaffP = paste0(outdir_images
,tolower(gene)
,"_ppi2_oc.png")
#svg(affP, width = 20, height = 5.5)
print(paste0("plot filename:", ppiaffP))
png(ppiaffP, units = "in", width = 6, height = 4, res = 300 )
cowplot::plot_grid(cowplot::plot_grid(ppi2_affT, common_legend_outcome,
nrow = 2,
rel_heights = c(1,1)),
cowplot::plot_grid(ppi2P, posC_ppi2
, nrow = 1
, rel_widths = c(1.2,1.8)
, align = "h"
, label_size = my_label_size),
nrow = 2,
labels = c("B", ""),
label_size = 12,
rel_heights = c(1,8)
)
dev.off()
#############################################################
peP # pe counts
#================================
# 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
)
#-------------
# Outplot: PPI2
#-------------
pe_allCL = paste0(outdir_images
,tolower(gene)
,"_pe_oc.png")
#svg(affP, width = 20, height = 5.5)
print(paste0("plot filename:", pe_allCL))
png(pe_allCL, units = "in", width = 6, height = 4, res = 300 )
cowplot::plot_grid(peT_allT,
cowplot::plot_grid(peP, posC_all
, nrow = 1
, rel_widths = c(1, 2)
, align = "h"),
nrow = 2,
labels = c("C", "", ""),
label_size = 12,
rel_heights = c(1,8))
dev.off()
#===========================================
# COMBINE ALL three
#==========================================
p1 = cowplot::plot_grid(cowplot::plot_grid(lig_affT,common_legend_outcome, nrow=2),
cowplot::plot_grid(mLigP, mmLigP, posC_lig
, nrow = 1
@ -152,8 +159,18 @@ p1 = cowplot::plot_grid(cowplot::plot_grid(lig_affT,common_legend_outcome, nrow=
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
@ -162,7 +179,17 @@ p2 = cowplot::plot_grid(cowplot::plot_grid(ppi2_affT, common_legend_outcome, nro
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"),
@ -174,16 +201,14 @@ p3 = cowplot::plot_grid(cowplot::plot_grid(peT_allT, nrow = 2
axis = "lr",
rel_heights = c(1,8)
),
rel_heights = c(1,10),
rel_heights = c(1,18),
nrow = 2,axis = "lr")
p3
#===============
# Final combine
#===============
w = 11.75
h = 3.7
w = 11.79
h = 3.5
mut_impact_CLP = paste0(outdir_images
,tolower(gene)
,"_mut_impactCLP.png")
@ -229,9 +254,21 @@ conCLP = paste0(outdir_images
,tolower(gene)
,"_consurf_BP.png")
print(paste0("plot filename:", sens_conP))
png(sens_conP, units = "in", width = w, height = h, res = 300 )
print(paste0("plot filename:", conCLP))
png(conCLP, units = "in", width = w, height = h, res = 300 )
consurfP
dev.off()
#================================
# Sensitivity 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()