source("~/git/LSHTM_analysis/config/embb.R") source("~/git/LSHTM_analysis/scripts/plotting/plotting_colnames.R") source("~/git/LSHTM_analysis/scripts/plotting/get_plotting_dfs.R") my_gg_pairs=function(plot_df){ ggpairs(plot_df, columns = 1:(ncol(plot_df)-1), upper = list( continuous = wrap('cor', method = "spearman", title="ρ", digits=2, justify_labels = "left", title_args=c(colour="black") ) ), lower = list( continuous = wrap("points", alpha = 0.7, size=0.5), combo = wrap("dot", alpha = 0.7, size=0.5) ), aes(colour = factor(ifelse(plot_df$dst_mode==0, "S", "R") ), alpha = 0.5), title="Stability") + scale_colour_manual(values = c("red", "blue")) + scale_fill_manual(values = c("red", "blue")) + theme(text = element_text(size=12, face="bold") ) } DistCutOff = 10 merged_df3 = as.data.frame(merged_df3) corr_plotdf = corr_data_extract(merged_df3 , gene = gene , drug = drug , extract_scaled_cols = F) aff_dist_cols = colnames(corr_plotdf)[grep("Dist", colnames(corr_plotdf))] static_cols = c("Log10(MAF)" , "Log10(OR)") corr_ps_colnames = c(static_cols , "DUET" , "FoldX" , "DeepDDG" , "Dynamut2" , aff_dist_cols , "dst_mode") corr_df_ps = corr_plotdf[, corr_ps_colnames] complete_obs_ps = nrow(corr_df_ps) - sum(is.na(corr_df_ps$`Log(OR)`)) color_coln = which(colnames(corr_df_ps) == "dst_mode") corr_end = color_coln-1 # Plot #1 plot_corr_df_ps = my_gg_pairs(corr_df_ps) corr_conservation_cols = c( static_cols , "ConSurf" , "SNAP2" , "PROVEAN" , aff_dist_cols , "dst_mode" ) corr_df_cons = corr_plotdf[, corr_conservation_cols] complete_obs_cons = nrow(corr_df_cons) - sum(is.na(corr_df_cons$`Log(OR)`)) color_coln = which(colnames(corr_df_cons) == "dst_mode") corr_end = color_coln-1 # Plot #2 #my_gg_pairs(corr_df_cons) plot_corr_df_cons = my_gg_pairs(corr_df_cons) corr_df_lig = corr_plotdf[corr_plotdf["Lig-Dist"]