diff --git a/config/katg.R b/config/katg.R index 753584b..999ccab 100644 --- a/config/katg.R +++ b/config/katg.R @@ -106,7 +106,7 @@ cat("\n===================================================" aa_pos_lig1 = aa_pos_hem aa_pos_lig2 = NULL aa_pos_lig3 = NULL -tile_map=data.frame(tile=c("INH","HAEM"), +tile_map=data.frame(tile=c("INH","HEME"), tile_colour=c("green","darkslategrey")) diff --git a/scripts/mut_electrostatic_changes.py b/scripts/mut_electrostatic_changes.py index 5e74b7c..2edb283 100755 --- a/scripts/mut_electrostatic_changes.py +++ b/scripts/mut_electrostatic_changes.py @@ -71,8 +71,8 @@ if not outdir: # input #======= #in_filename = 'merged_df3.csv' -#in_filename = gene.lower() + '_complex_mcsm_norm.csv' -in_filename = gene.lower() + '_complex_mcsm_norm_SRY.csv' # gid +in_filename = gene.lower() + '_complex_mcsm_norm.csv' +#in_filename = gene.lower() + '_complex_mcsm_norm_SRY.csv' # gid infile_merged_df3 = outdir + '/' + in_filename print('Input file: ', infile_merged_df3 , '\n============================================================') @@ -217,4 +217,4 @@ print('Total no. of mutations: ', total_muts , '\nTotal no. of unchanged muts: ', no_change_muts.mut_count.sum() , '\n=======================================================') #%% end of script -#======================================================================= \ No newline at end of file +#======================================================================= diff --git a/scripts/plotting/plotting_thesis/alr/alr_appendix_tables.R b/scripts/plotting/plotting_thesis/alr/alr_appendix_tables.R index 948ab78..9b781e8 100644 --- a/scripts/plotting/plotting_thesis/alr/alr_appendix_tables.R +++ b/scripts/plotting/plotting_thesis/alr/alr_appendix_tables.R @@ -15,7 +15,6 @@ geneL_na_v2 = c("gid") geneL_ppi2 = c("alr", "embb", "katg", "rpob") geneL_both = c("rpob") - if (tolower(gene)%in%geneL_na_v2) { gene_colnames = c("mcsm_na_affinity", "mcsm_na_outcome") } @@ -200,6 +199,7 @@ colsNames_to_output_nca = c("position" #, paste0("NA-Dist (", angstroms_symbol, ")") #, paste0("mCSM-NA (", delta_symbol,delta_symbol,"G)") #, "mCSM-NA outcome" + , paste0("PPI-Dist (", angstroms_symbol, ")") , paste0("mCSM-PPI (", delta_symbol,delta_symbol,"G)") , "mCSM-PPI outcome" @@ -226,7 +226,7 @@ table(Out_df_ncaS$plp_site) #---------------------- Out_ncaT = paste0(outdir_stats , tolower(gene) - , "_na_muts.csv") + , "_ppi2_muts.csv") cat("Output of NA muts:", Out_ncaT ) write.csv(Out_df_ncaS, Out_ncaT, row.names = FALSE) diff --git a/scripts/plotting/plotting_thesis/dm_om_plots.R b/scripts/plotting/plotting_thesis/dm_om_plots.R index 962c9ff..2149616 100644 --- a/scripts/plotting/plotting_thesis/dm_om_plots.R +++ b/scripts/plotting/plotting_thesis/dm_om_plots.R @@ -32,6 +32,7 @@ table(genomics_dataP$param_type) genomicsP = lf_bp2(genomics_dataP #, p_title = "" + , dot_transparency = 0.1 #0.3 default , violin_quantiles = c(0.5), monochrome = F) genomicsP diff --git a/scripts/plotting/plotting_thesis/gid/gid_appendix_tables.R b/scripts/plotting/plotting_thesis/gid/gid_appendix_tables.R index 4868c8d..fb89a4e 100644 --- a/scripts/plotting/plotting_thesis/gid/gid_appendix_tables.R +++ b/scripts/plotting/plotting_thesis/gid/gid_appendix_tables.R @@ -349,7 +349,7 @@ if (tolower(gene)%in%geneL_ppi2 ){ # add cols mut_h_ppi2_dd$mutational_effect = "Most Destabilising for PPI affinity" - mut_h_ppi2_dd$mutational_effect = "Most Stabilising for PPI affinity" + mut_h_ppi2_ss$mutational_effect = "Most Stabilising for PPI affinity" if (identical(colnames(mut_h_ppi2_dd), colnames(mut_h_ppi2_ss)) ){ cat("\nPass 1: ppi2") diff --git a/scripts/plotting/plotting_thesis/katg/dm_om_plots_layout_katg.R b/scripts/plotting/plotting_thesis/katg/dm_om_plots_layout_katg.R deleted file mode 100644 index b8994bd..0000000 --- a/scripts/plotting/plotting_thesis/katg/dm_om_plots_layout_katg.R +++ /dev/null @@ -1,176 +0,0 @@ -# source dm_om_plots.R -source("/home/tanu/git/LSHTM_analysis/scripts/plotting/plotting_thesis/dm_om_plots.R") - -##### plots to combine #### -duetP -foldxP -deepddgP -dynamut2P -genomicsP -consurfP -proveanP -snap2P -mcsmligP -mcsmlig2P -mcsmppi2P - -# Plot labels -tit1 = "Stability changes" -tit2 = "Genomic measure" -tit3 = "Distance to partners" -tit4 = "Evolutionary Conservation" -tit5 = "Affinity changes" -pt_size = 30 - -theme_georgia <- function(...) { - theme_gray(base_family = "sans", ...) + - theme(plot.title = element_text(face = "bold")) -} - - -title_theme <- calc_element("plot.title", theme_georgia()) - -pt1 = ggdraw() + - draw_label( - tit1, - fontfamily = title_theme$family, - fontface = title_theme$face, - #size = title_theme$size - size = pt_size - ) - -pt2 = ggdraw() + - draw_label( - tit2, - fontfamily = title_theme$family, - fontface = title_theme$face, - size = pt_size - ) - -pt3 = ggdraw() + - draw_label( - tit3, - fontfamily = title_theme$family, - fontface = title_theme$face, - size = pt_size - ) - -pt4 = ggdraw() + - draw_label( - tit4, - fontfamily = title_theme$family, - fontface = title_theme$face, - size = pt_size - ) - - -pt5 = ggdraw() + - draw_label( - tit5, - fontfamily = title_theme$family, - fontface = title_theme$face, - size = pt_size - ) - -#====================== -# Output plot function -#====================== -OutPlot_dm_om = function(x){ - - # dist b/w plot title and plot - relH_tp = c(0.08, 0.92) - - my_label_size = 25 - #---------------- - # Top panel - #---------------- - top_panel = cowplot::plot_grid( - cowplot::plot_grid(pt1, - cowplot::plot_grid(duetP, foldxP, deepddgP, dynamut2P - , nrow = 1 - , labels = c("A", "B", "C", "D") - , label_size = my_label_size) - , ncol = 1 - , rel_heights = relH_tp - ), - NULL, - cowplot::plot_grid(pt2, - cowplot::plot_grid(genomicsP - , nrow = 1 - , labels = c("E") - , label_size = my_label_size) - , ncol = 1 - , rel_heights = relH_tp - ), - NULL, - cowplot::plot_grid(pt3, - cowplot::plot_grid( #distanceP - distanceP_lig - , distanceP_ppi2 - , nrow = 1 - , labels = c("F", "G") - , label_size = my_label_size) - , ncol = 1 - , rel_heights = relH_tp - ), - nrow = 1, - rel_widths = c(2/7, 0.1/7, 0.5/7, 0.1/7, 1/7) - ) - - #---------------- - # Bottom panel - #---------------- - bottom_panel = cowplot::plot_grid( - cowplot::plot_grid(pt4, - cowplot::plot_grid(consurfP, proveanP, snap2P - , nrow = 1 - , labels = c("H", "I", "J") - , label_size = my_label_size) - , ncol = 1 - , rel_heights =relH_tp - ),NULL, - cowplot::plot_grid(pt5, - cowplot::plot_grid(mcsmligP - , mcsmlig2P - , mcsmppi2P - , nrow = 1 - , labels = c("K", "L", "M") - , label_size = my_label_size) - , ncol = 1 - , rel_heights = relH_tp - ),NULL, - nrow = 1, - rel_widths = c(3/6,0.1/6,3/6, 0.1/6 ) - ) - - #------------------------------- - # combine: Top and Bottom panel - #------------------------------- - cowplot::plot_grid (top_panel, bottom_panel - , nrow =2 - , rel_widths = c(1, 1) - , align = "hv") -} - -#===================== -# OutPlot: svg and png -#====================== -dm_om_combinedP = paste0(outdir_images - ,tolower(gene) - ,"_dm_om_all.svg") - -cat("DM OM plots with stats:", dm_om_combinedP) -svg(dm_om_combinedP, width = 32, height = 18) - -OutPlot_dm_om() -dev.off() - - -dm_om_combinedP_png = paste0(outdir_images - ,tolower(gene) - ,"_dm_om_all.png") -cat("DM OM plots with stats:", dm_om_combinedP_png) -png(dm_om_combinedP_png, width = 32, height = 18, units = "in", res = 300) - -OutPlot_dm_om() -dev.off() diff --git a/scripts/plotting/plotting_thesis/katg/gg_pairs_all_katg.R b/scripts/plotting/plotting_thesis/katg/gg_pairs_all_katg.R index b855756..ea2ba19 100644 --- a/scripts/plotting/plotting_thesis/katg/gg_pairs_all_katg.R +++ b/scripts/plotting/plotting_thesis/katg/gg_pairs_all_katg.R @@ -1,4 +1,4 @@ -#source("~/git/LSHTM_analysis/config/embb.R") +#source("~/git/LSHTM_analysis/config/katg.R") #source("~/git/LSHTM_analysis/scripts/plotting/plotting_colnames.R") #source("~/git/LSHTM_analysis/scripts/plotting/get_plotting_dfs.R") @@ -53,7 +53,7 @@ corr_plotdf = corr_data_extract(merged_df3 aff_dist_cols = colnames(corr_plotdf)[grep("Dist", colnames(corr_plotdf))] static_cols = c("Log10(MAF)" - , "Log10(OR)" + #, "Log10(OR)" ) ############################################################ #============================================= diff --git a/scripts/plotting/plotting_thesis/lineage_bp_dist_layout.R b/scripts/plotting/plotting_thesis/lineage_bp_dist_layout.R index 1f229df..464ec43 100644 --- a/scripts/plotting/plotting_thesis/lineage_bp_dist_layout.R +++ b/scripts/plotting/plotting_thesis/lineage_bp_dist_layout.R @@ -1,5 +1,11 @@ #!/usr/bin/env Rscript -source("/home/tanu/git/LSHTM_analysis/scripts/plotting/plotting_thesis/linage_bp_dist.R") +source("/home/tanu/git/LSHTM_analysis/scripts/plotting/plotting_thesis/lineage_bp_dist.R") + +#======= +# output +#======= +outdir_images = paste0("~/git/Writing/thesis/images/results/", tolower(gene), "/") +cat("plots will output to:", outdir_images) ########################################### # TASK: generate plots for lineage # Individual plots in @@ -38,19 +44,19 @@ linPlots_combined = paste0(outdir_images cat("\nOutput plot:", linPlots_combined) png(linPlots_combined, width = 9, height = 6, units = "in" ,res = 300) - cowplot::plot_grid( - cowplot::plot_grid(lin_countP, lin_diversityP -# , nrow = 2 -# , rel_heights = c(1.2,1) -# , labels = "AUTO" -# , label_size = my_label_size), -# NULL, -# linP_dm_om, -# nrow = 1, -# labels = c("", "", "C"), -# label_size = my_label_size, -# rel_widths = c(35, 3, 52) -# ) -# dev.off() +cowplot::plot_grid( + cowplot::plot_grid(lin_countP, lin_diversityP, + nrow = 2, + rel_heights = c(1.2,1), + labels = "AUTO", + label_size = my_label_size), + NULL, + linP_dm_om, + nrow = 1, + labels = c("", "", "C"), + label_size = my_label_size, + rel_widths = c(35, 3, 52) +) +dev.off()