From 14f8f5d6d4f3fc536a676feadd2374849e24c548 Mon Sep 17 00:00:00 2001 From: Tanushree Tunstall Date: Thu, 4 Aug 2022 19:48:09 +0100 Subject: [PATCH] generated lineage barplots and corr plots for conservation --- .../plotting_thesis/corr_plots_thesis.R | 42 ++++++++++++++++++- .../lineage_barplots_combined.R | 12 +++--- .../plotting/plotting_thesis/preformatting.R | 7 ++-- 3 files changed, 52 insertions(+), 9 deletions(-) diff --git a/scripts/plotting/plotting_thesis/corr_plots_thesis.R b/scripts/plotting/plotting_thesis/corr_plots_thesis.R index 9c02b4e..c282341 100644 --- a/scripts/plotting/plotting_thesis/corr_plots_thesis.R +++ b/scripts/plotting/plotting_thesis/corr_plots_thesis.R @@ -137,6 +137,46 @@ my_corr_pairs(corr_data_all = corr_df_ppi2 , corr_value_size = 1) dev.off() + +# FIXME: ADD distance #================== # mCSSM-NA affinity -#================== \ No newline at end of file +#================== + + + + +# FIXME: ADD PROVEAN +#################################################### +# CONSERVATION +#################################################### +corr_df_cons = corr_plotdf[, corr_conservation_cols] + +color_coln = which(colnames(corr_df_cons) == "dst_mode") +end = which(colnames(corr_df_cons) == drug) +ncol_omit = 2 +corr_end = end-ncol_omit + +#--------------------------- +# Output: Conservation corrP +#---------------------------- +corr_consP = paste0(outdir_images + ,tolower(gene) + ,"_corr_ppi2.svg" ) + +cat("Corr plot conservation coloured dots:", corr_consP) +svg(corr_consP, width = 10, height = 10) + +my_corr_pairs(corr_data_all = corr_df_cons + , corr_cols = colnames(corr_df_cons[1:corr_end]) + , corr_method = "spearman" # other options: "pearson" or "kendall" + , colour_categ_col = colnames(corr_df_cons[color_coln]) #"dst_mode" + , categ_colour = c("red", "blue") + , density_show = F + , hist_col = "coral4" + , dot_size = 2 + , ats = 1.5 + , corr_lab_size = 3 + , corr_value_size = 1) + +dev.off() diff --git a/scripts/plotting/plotting_thesis/lineage_barplots_combined.R b/scripts/plotting/plotting_thesis/lineage_barplots_combined.R index 01f6428..c9defaf 100644 --- a/scripts/plotting/plotting_thesis/lineage_barplots_combined.R +++ b/scripts/plotting/plotting_thesis/lineage_barplots_combined.R @@ -1,5 +1,6 @@ # get plotting_dfs() # using dfs [lf and wf] from lineage_dfL +# FIXME: add SNP diversity as the title #=============================== # lineage sample and SNP count #=============================== @@ -54,15 +55,16 @@ lin_diversityP = lin_count_bp_diversity(lf_data = lineage_dfL[['lin_wf']] #============================================= lineage_bp_CL = paste0(outdir_images ,tolower(gene) - ,"_lineage_bp_CL.svg") + ,"_lineage_bp_CL_Tall.svg") cat("Lineage barplots:", lineage_bp_CL) svg(lineage_bp_CL, width = 8, height = 15) cowplot::plot_grid(lin_countP, lin_diversityP - #, labels = c("(a)", "(b)", "(c)", "(d)") - , nrow = 2 - , labels = "AUTO" - , label_size = 25) + #, labels = c("(a)", "(b)", "(c)", "(d)") + , nrow = 2 + # , ncols = 2 + , labels = "AUTO" + , label_size = 25) dev.off() \ No newline at end of file diff --git a/scripts/plotting/plotting_thesis/preformatting.R b/scripts/plotting/plotting_thesis/preformatting.R index 74fbbf7..37e7cc0 100644 --- a/scripts/plotting/plotting_thesis/preformatting.R +++ b/scripts/plotting/plotting_thesis/preformatting.R @@ -235,11 +235,12 @@ corr_ppi2_colnames = c("mCSM-PPI2" , "dst_mode" , drug) - -corr_conservation = c("Consurf" +#FIXME: Add provean +corr_conservation_cols = c("Consurf" + , "SNAP2" , "MAF" , "Log (OR)" , "-Log (P)" - , "interface_dist" , "dst_mode" , drug) +