added ggcorr all plot figure for supp

This commit is contained in:
Tanushree Tunstall 2020-09-18 12:46:12 +01:00
parent 369c906a33
commit 093ae0d832

View file

@ -10,13 +10,14 @@ getwd()
setwd("~/git/LSHTM_analysis/scripts/plotting/") setwd("~/git/LSHTM_analysis/scripts/plotting/")
getwd() getwd()
source("Header_TT.R") source("Header_TT.R")
require(cowplot) require(cowplot)
source("combining_dfs_plotting.R") source("combining_dfs_plotting.R")
source("my_pairs_panel.R") #source("my_pairs_panel.R")
# should return the following dfs, directories and variables # should return the following dfs, directories and variables
# FIXME: Can't output from here
# PS combined: # PS combined:
# 1) merged_df2 # 1) merged_df2
# 2) merged_df2_comp # 2) merged_df2_comp
@ -56,15 +57,17 @@ cat(paste0("Variables imported:"
#plot_corr_plot_combined = paste0(plotdir,"/", corr_plot_combined) #plot_corr_plot_combined = paste0(plotdir,"/", corr_plot_combined)
# PS # PS
ggcorr_all_ps = "ggcorr_all_PS.svg" #ggcorr_all_ps = "ggcorr_all_PS.svg"
ggcorr_all_ps = "ggcorr_all_PS.png"
plot_ggcorr_all_ps = paste0(plotdir,"/", ggcorr_all_ps) plot_ggcorr_all_ps = paste0(plotdir,"/", ggcorr_all_ps)
# LIG # LIG
ggcorr_all_lig = "ggcorr_all_LIG.svg" #ggcorr_all_lig = "ggcorr_all_LIG.svg"
ggcorr_all_lig = "ggcorr_all_LIG.png"
plot_ggcorr_all_lig = paste0(plotdir,"/", ggcorr_all_lig ) plot_ggcorr_all_lig = paste0(plotdir,"/", ggcorr_all_lig )
# combined # combined
ggcorr_all_combined_labelled = "ggcorr_all_combined_labelled.svg" ggcorr_all_combined_labelled = "ggcorr_all_combined_labelled.png"
plot_ggcorr_all_combined_labelled = paste0(plotdir,"/", ggcorr_all_combined_labelled) plot_ggcorr_all_combined_labelled = paste0(plotdir,"/", ggcorr_all_combined_labelled)
#################################################################### ####################################################################
@ -237,15 +240,14 @@ pmat1==pmat2
# Generate ggcorr PS plot # Generate ggcorr PS plot
#------------------------ #------------------------
cat("ggCorr plot PS:", plot_ggcorr_all_ps) cat("ggCorr plot PS:", plot_ggcorr_all_ps)
svg(plot_ggcorr_all_ps, width = 15, height = 15) #png(filename = plot_ggcorr_all_ps, width = 1024, height = 768, units = "px", pointsize = 20)
ggcorr_ps = ggcorrplot(corr1 ggcorr_ps = ggcorrplot(corr1
, p.mat = pmat1 , p.mat = pmat1
, hc.order = TRUE , hc.order = TRUE
, outline.col = "black" , outline.col = "black"
, ggtheme = ggplot2::theme_gray , ggtheme = ggplot2::theme_gray
, colors = c("#6D9EC1", "white", "#E46726") , colors = c("#6D9EC1", "white", "#E46726")
, title = "Spearman correlations with DUET and Foldx stability") , title = "DUET and Foldx stability")
ggcorr_ps ggcorr_ps
@ -356,7 +358,8 @@ pmat1_lig == pmat2_lig
# Generate ggcorr LIG plot # Generate ggcorr LIG plot
#------------------------ #------------------------
cat("ggCorr LIG plot:", plot_ggcorr_all_lig) cat("ggCorr LIG plot:", plot_ggcorr_all_lig)
svg(plot_ggcorr_all_lig, width = 15, height = 15) #svg(plot_ggcorr_all_lig, width = 15, height = 15)
#png(plot_ggcorr_all_lig, width = 1024, height = 768, units = "px", pointsize = 20)
ggcorr_lig = ggcorrplot(corr1_lig ggcorr_lig = ggcorrplot(corr1_lig
, p.mat = pmat1_lig , p.mat = pmat1_lig
@ -365,7 +368,7 @@ ggcorr_lig = ggcorrplot(corr1_lig
, ggtheme = ggplot2::theme_gray , ggtheme = ggplot2::theme_gray
, colors = c("#6D9EC1", "white", "#E46726") , colors = c("#6D9EC1", "white", "#E46726")
, title = "Spearman correlations with ligand affinty") , title = "Ligand affinty")
ggcorr_lig ggcorr_lig
@ -375,15 +378,4 @@ ggcorr_lig
#============================= #=============================
# combine plots for output # combine plots for output
#============================= #=============================
cat("Output plot:", plot_ggcorr_all_combined_labelled) +
svg(plot_ggcorr_all_combined_labelled , width = 30, height = 10)
ggcorr_combined = cowplot::plot_grid(ggcorr_ps, ggcorr_lig
, nrow = 1
, align = "h"
, labels = c("(a)","(b)")
#, rel_heights = c(1, 1)
#, rel_widths = c(0.85, 1, 1)
, label_size = 25)
dev.off()