From 11b936f09b8a915f4c7c0f2d5e2edb0b982f7879 Mon Sep 17 00:00:00 2001 From: Tanushree Tunstall Date: Wed, 24 Aug 2022 20:04:29 +0100 Subject: [PATCH] added more scripts --- config/alr.R | 29 +++++++- config/rpob.R | 10 +++ .../alr/pe_sens_site_count_alr.R | 29 ++++---- .../alr/prominent_effects_alr.R | 22 +++--- .../gid/pe_sens_site_count_gid.R | 33 ++++----- .../katg/pe_sens_site_count_katg.R | 36 ++++------ .../rpob/basic_barplots_rpob.R | 5 +- .../rpob/pe_sens_site_count_rpob.R | 29 ++++---- .../rpob/prominent_effects_rpob.R | 72 ++++++++++--------- 9 files changed, 148 insertions(+), 117 deletions(-) diff --git a/config/alr.R b/config/alr.R index 8e14b05..b27ae4a 100644 --- a/config/alr.R +++ b/config/alr.R @@ -54,7 +54,8 @@ plp_pos_paper = sort(unique(c(66, 70, 112, 196, 227, 237, 252, 254, 255, 388))) aa_pos_plp = sort(unique(c(plp_pos_paper, 66, 70, 112, 237, 252, 254, 255, 196))) ####################################################################### - +# this is post inspection on chimera +remove_pos = c(295, 314, 342, 343, 344) #=============== # Active site aa #=============== @@ -63,31 +64,40 @@ active_aa_pos = sort(unique(c(aa_ligplus_dcs , aa_arpeg_dcs , aa_pos_paper , aa_pos_plp))) + +active_aa_pos = active_aa_pos[!active_aa_pos%in%remove_pos] #================= # Drug binding aa #================= aa_pos_dcs = sort(unique(c(aa_ligplus_dcs , aa_plip_dcs , aa_arpeg_dcs))) -aa_pos_drug = aa_pos_dcs +aa_pos_dcs = aa_pos_dcs[!aa_pos_dcs%in%remove_pos] +aa_pos_drug = aa_pos_dcs #=============== # Co-factor: PLP aa #=============== aa_pos_plp = aa_pos_plp +#aa_pos_plp = aa_pos_plp[!aa_pos_plp%in%remove_pos] + #=============== # Hbond aa #=============== aa_pos_dcs_hbond = sort(unique(c(aa_ligplus_dcs_hbond , aa_plip_dcs_hbond))) +aa_pos_dcs_hbond = aa_pos_dcs_hbond[!aa_pos_dcs_hbond%in%remove_pos] + #======================= # Other interactions aa #======================= aa_pos_dcs_other = active_aa_pos[!active_aa_pos%in%aa_pos_dcs_hbond] +aa_pos_dcs_other = aa_pos_dcs_other[!aa_pos_dcs_other%in%remove_pos] + c3 = length(aa_pos_dcs_other) == length(active_aa_pos) - length(aa_pos_dcs_hbond) ####################################################################### @@ -144,4 +154,17 @@ aa_pos_lig2 = NULL aa_pos_lig3 = NULL tile_map=data.frame(tile=c("ALR","PLP"), - tile_colour=c("green","navyblue")) #darkslategrey \ No newline at end of file + tile_colour=c("green","navyblue")) #darkslategrey + + +###### +chain_suffix = ".A" + +toString(paste0(aa_pos_drug, chain_suffix)) +toString(paste0(aa_pos_plp, chain_suffix)) +toString(paste0(active_aa_pos, chain_suffix)) + +common_pos = aa_pos_drug[aa_pos_drug%in%aa_pos_plp] +cat("\nCommon interacting partners:", length(common_pos)) +common_pos +toString(paste0(common_pos, chain_suffix)) diff --git a/config/rpob.R b/config/rpob.R index 252d2ff..fb2debe 100644 --- a/config/rpob.R +++ b/config/rpob.R @@ -28,9 +28,12 @@ aa_arpeg_rfp = c(170, 428, 429, 430, 431, 432 , 607, 674) ############################################################## +remove_pos = c(170, 674, 604) active_aa_pos = sort(unique(c(aa_plip_rfp , aa_plip_5uhc_rfp , aa_arpeg_rfp))) + +active_aa_pos = active_aa_pos[!active_aa_pos%in%remove_pos] ############################################################## cat("\nNo. of active site residues for gene" , gene, ":" @@ -42,11 +45,14 @@ aa_pos_rfp = sort(unique(c(aa_plip_rfp , aa_plip_5uhc_rfp , aa_arpeg_rfp))) +aa_pos_rfp = aa_pos_rfp[!aa_pos_rfp%in%remove_pos] aa_pos_drug = aa_pos_rfp aa_pos_rfp_hbond = sort(unique(c(aa_plip_rfp_hbond , aa_plip_5uhc_rfp_hbond))) +aa_pos_rfp_hbond = aa_pos_rfp_hbond[!aa_pos_rfp_hbond%in%remove_pos] + cat("\n===================================================" , "\nActive site residues for", gene, "comprise of..." , "\n===================================================" @@ -62,3 +68,7 @@ aa_pos_lig3 = NULL tile_map=data.frame(tile=c("RPO","DPA","CDL","Ca"), tile_colour=c("green","darkslategrey","navyblue","purple")) + +#### +chain_suffix = ".C" +print(toString(paste0(aa_pos_drug, chain_suffix))) diff --git a/scripts/plotting/plotting_thesis/alr/pe_sens_site_count_alr.R b/scripts/plotting/plotting_thesis/alr/pe_sens_site_count_alr.R index a1afd04..397848e 100644 --- a/scripts/plotting/plotting_thesis/alr/pe_sens_site_count_alr.R +++ b/scripts/plotting/plotting_thesis/alr/pe_sens_site_count_alr.R @@ -3,26 +3,25 @@ source("/home/tanu/git/LSHTM_analysis/scripts/plotting/plotting_thesis/alr/sensi ############################################################## # PE count -#lig-- na--ppi2--stab -# pe_colour_map = c("DD_lig" = "#ffd700" # gold -# , "SS_lig" = "#f0e68c" # khaki -# -# , "DD_nucleic_acid"= "#a0522d" # sienna -# , "SS_nucleic_acid"= "#d2b48c" # tan -# -# , "DD_ppi2" = "#da70d6" # orchid -# , "SS_ppi2" = "#ff1493" # deeppink -# -# , "DD_stability" = "#f8766d" # red -# , "SS_stability" = "#00BFC4") # blue +#pe_colour_map = c("DD_lig" = "#f0e68c" # khaki +# , "SS_lig" = "#ffd700" # gold + +# , "DD_nucleic_acid"= "#d2b48c" # sandybrown +# , "SS_nucleic_acid"= "#a0522d" # sienna + +# , "DD_ppi2" = "#da70d6" # orchid +# , "SS_ppi2" = "#ff1493" # deeppink + +# , "DD_stability" = "#f8766d" # red +# , "SS_stability" = "#00BFC4") # blue table(str_df_plot_cols$pe_effect_outcome) ############################################################## #=========== -#PE count +#PE count: lig, ppi2, stab #=========== rects <- data.frame(x=1:6, - colors = c("#ffd700" , - "#f0e68c" , + colors = c("#f0e68c" , + "#ffd700" , "#da70d6" , "#ff1493" , diff --git a/scripts/plotting/plotting_thesis/alr/prominent_effects_alr.R b/scripts/plotting/plotting_thesis/alr/prominent_effects_alr.R index 0bd5e92..555b833 100644 --- a/scripts/plotting/plotting_thesis/alr/prominent_effects_alr.R +++ b/scripts/plotting/plotting_thesis/alr/prominent_effects_alr.R @@ -261,6 +261,8 @@ if (nrow(dd_lig) == table(str_df_plot_cols$pe_effect_outcome)[['DD_lig']]){ dd_lig_pos = dd_lig[[pos_colname]] }else{ stop("Abort: DD affinity colour numbers mismtatch") + print(toString(paste0(dd_lig_pos, chain_suffix))) + } # +ve Lig Aff @@ -272,13 +274,9 @@ if (!empty(ss_lig)){ stop("Abort: SS affinity colour numbers mismtatch") } #put in chimera cmd - paste0(dd_lig_pos, chain_suffix) - paste0(ss_lig_pos, chain_suffix) + print(toString(paste0(ss_lig_pos, chain_suffix))) } - - - #=================================================== #------------------- # PPI2 Affinity @@ -289,6 +287,8 @@ if (nrow(dd_ppi2) == table(str_df_plot_cols$pe_effect_outcome)[['DD_ppi2']]){ dd_ppi2_pos = dd_ppi2[[pos_colname]] }else{ stop("Abort: DD PPI2 colour numbers mismtatch") + print(toString(paste0(dd_ppi2_pos,chain_suffix))) + } # +ve PPI2 @@ -297,11 +297,11 @@ if (nrow(ss_ppi2) == table(str_df_plot_cols$pe_effect_outcome)[['SS_ppi2']]){ ss_ppi2_pos = ss_ppi2[[pos_colname]] }else{ stop("Abort: SS PPI2 colour numbers mismtatch") + print(toString(paste0(ss_ppi2_pos,chain_suffix))) + } #put in chimera cmd -paste0(dd_ppi2_pos,chain_suffix) -paste0(ss_ppi2_pos,chain_suffix) #========================================================= #------------------------ @@ -323,9 +323,9 @@ if (nrow(ss_stability) == table(str_df_plot_cols$pe_effect_outcome)[['SS_stabil stop("Abort: SS Stability colour numbers mismtatch") } -#put in chimera cmd -# stabiliting first as it has less numbers -paste0(ss_stability_pos, chain_suffix) -paste0(dd_stability_pos, chain_suffix) +# put in chimera cmd +print(toString(paste0(dd_stability_pos, chain_suffix))) +print(toString(paste0(ss_stability_pos, chain_suffix))) + #################################################################### diff --git a/scripts/plotting/plotting_thesis/gid/pe_sens_site_count_gid.R b/scripts/plotting/plotting_thesis/gid/pe_sens_site_count_gid.R index c8ed1e4..35d3cb7 100644 --- a/scripts/plotting/plotting_thesis/gid/pe_sens_site_count_gid.R +++ b/scripts/plotting/plotting_thesis/gid/pe_sens_site_count_gid.R @@ -3,29 +3,30 @@ source("/home/tanu/git/LSHTM_analysis/scripts/plotting/plotting_thesis/gid/sensi ############################################################## # PE count -#lig-- na--ppi2--stab -# pe_colour_map = c("DD_lig" = "#ffd700" # gold -# , "SS_lig" = "#f0e68c" # khaki -# -# , "DD_nucleic_acid"= "#a0522d" # sienna -# , "SS_nucleic_acid"= "#d2b48c" # tan -# -# , "DD_ppi2" = "#da70d6" # orchid -# , "SS_ppi2" = "#ff1493" # deeppink -# -# , "DD_stability" = "#f8766d" # red -# , "SS_stability" = "#00BFC4") # blue +#pe_colour_map = c("DD_lig" = "#f0e68c" # khaki +# , "SS_lig" = "#ffd700" # gold + +# , "DD_nucleic_acid"= "#d2b48c" # sandybrown +# , "SS_nucleic_acid"= "#a0522d" # sienna + +# , "DD_ppi2" = "#da70d6" # orchid +# , "SS_ppi2" = "#ff1493" # deeppink + +# , "DD_stability" = "#f8766d" # red +# , "SS_stability" = "#00BFC4") # blue + table(str_df_plot_cols$pe_effect_outcome) ############################################################## #=========== -#PE count +#PE count: +# lig, na, stability #=========== rects <- data.frame(x=1:6, - colors = c("#ffd700" , - "#f0e68c" , + colors = c("#f0e68c" , + "#ffd700" , - "#a0522d" , "#d2b48c" , + "#a0522d" , "#f8766d" , "#00BFC4") diff --git a/scripts/plotting/plotting_thesis/katg/pe_sens_site_count_katg.R b/scripts/plotting/plotting_thesis/katg/pe_sens_site_count_katg.R index 5757108..d9391c7 100644 --- a/scripts/plotting/plotting_thesis/katg/pe_sens_site_count_katg.R +++ b/scripts/plotting/plotting_thesis/katg/pe_sens_site_count_katg.R @@ -3,29 +3,26 @@ source("/home/tanu/git/LSHTM_analysis/scripts/plotting/plotting_thesis/katg/sens ############################################################## # PE count -#lig-- na--ppi2--stab -# pe_colour_map = c("DD_lig" = "#ffd700" # gold -# , "SS_lig" = "#f0e68c" # khaki -# -# , "DD_nucleic_acid"= "#a0522d" # sienna -# , "SS_nucleic_acid"= "#d2b48c" # tan -# -# , "DD_ppi2" = "#da70d6" # orchid -# , "SS_ppi2" = "#ff1493" # deeppink -# -# , "DD_stability" = "#f8766d" # red -# , "SS_stability" = "#00BFC4") # blue +#pe_colour_map = c("DD_lig" = "#f0e68c" # khaki +# , "SS_lig" = "#ffd700" # gold + +# , "DD_nucleic_acid"= "#d2b48c" # sandybrown +# , "SS_nucleic_acid"= "#a0522d" # sienna + +# , "DD_ppi2" = "#da70d6" # orchid +# , "SS_ppi2" = "#ff1493" # deeppink + +# , "DD_stability" = "#f8766d" # red +# , "SS_stability" = "#00BFC4") # blue table(str_df_plot_cols$pe_effect_outcome) ############################################################## #=========== -#PE count +#PE count: +# lig, ppi2, stability #=========== rects <- data.frame(x=1:6, - colors = c("#ffd700" , - "#f0e68c" , - - #"#a0522d" , - #"#d2b48c" , + colors = c("#f0e68c" , + "#ffd700" , "#da70d6" , "#ff1493" , @@ -37,9 +34,6 @@ rects <- data.frame(x=1:6, rects$text = c("-ve Lig" , "+ve Lig" - #, "-ve\nNuc.Acid" - #, "+ve\nNuc.Acid" - , "-ve PPI2" , "+ve PPI2" diff --git a/scripts/plotting/plotting_thesis/rpob/basic_barplots_rpob.R b/scripts/plotting/plotting_thesis/rpob/basic_barplots_rpob.R index 42919bc..2903935 100644 --- a/scripts/plotting/plotting_thesis/rpob/basic_barplots_rpob.R +++ b/scripts/plotting/plotting_thesis/rpob/basic_barplots_rpob.R @@ -7,9 +7,8 @@ #============= # Data: Input #============== -#source("~/git/LSHTM_analysis/config/rpob.R") - -#source("~/git/LSHTM_analysis/scripts/plotting/get_plotting_dfs.R") +source("~/git/LSHTM_analysis/config/rpob.R") +source("~/git/LSHTM_analysis/scripts/plotting/get_plotting_dfs.R") #cat("\nSourced plotting cols as well:", length(plotting_cols)) diff --git a/scripts/plotting/plotting_thesis/rpob/pe_sens_site_count_rpob.R b/scripts/plotting/plotting_thesis/rpob/pe_sens_site_count_rpob.R index f2a6c32..03ed2ed 100644 --- a/scripts/plotting/plotting_thesis/rpob/pe_sens_site_count_rpob.R +++ b/scripts/plotting/plotting_thesis/rpob/pe_sens_site_count_rpob.R @@ -4,28 +4,29 @@ source("/home/tanu/git/LSHTM_analysis/scripts/plotting/plotting_thesis/rpob/sens ############################################################## # PE count #lig-- na--ppi2--stab -# pe_colour_map = c("DD_lig" = "#ffd700" # gold -# , "SS_lig" = "#f0e68c" # khaki -# -# , "DD_nucleic_acid"= "#a0522d" # sienna -# , "SS_nucleic_acid"= "#d2b48c" # tan -# -# , "DD_ppi2" = "#da70d6" # orchid -# , "SS_ppi2" = "#ff1493" # deeppink -# -# , "DD_stability" = "#f8766d" # red -# , "SS_stability" = "#00BFC4") # blue +pe_colour_map = c("DD_lig" = "#f0e68c" # khaki + , "SS_lig" = "#ffd700" # gold + + , "DD_nucleic_acid"= "#d2b48c" # sandybrown + , "SS_nucleic_acid"= "#a0522d" # sienna + + , "DD_ppi2" = "#da70d6" # orchid + , "SS_ppi2" = "#ff1493" # deeppink + + , "DD_stability" = "#f8766d" # red + , "SS_stability" = "#00BFC4") # blue + table(str_df_plot_cols$pe_effect_outcome) ############################################################## #=========== #PE count #=========== rects <- data.frame(x=1:8, - colors = c("#ffd700" , - "#f0e68c" , + colors = c("#f0e68c" , + "#ffd700" , - "#a0522d" , "#d2b48c" , + "#a0522d" , "#da70d6" , "#ff1493" , diff --git a/scripts/plotting/plotting_thesis/rpob/prominent_effects_rpob.R b/scripts/plotting/plotting_thesis/rpob/prominent_effects_rpob.R index 685a255..6293e6e 100644 --- a/scripts/plotting/plotting_thesis/rpob/prominent_effects_rpob.R +++ b/scripts/plotting/plotting_thesis/rpob/prominent_effects_rpob.R @@ -1,13 +1,11 @@ #!/usr/bin/env Rscript -#source("~/git/LSHTM_analysis/config/alr.R") -#source("~/git/LSHTM_analysis/config/embb.R") -#source("~/git/LSHTM_analysis/config/katg.R") -#source("~/git/LSHTM_analysis/config/gid.R") -#source("~/git/LSHTM_analysis/config/pnca.R") #source("~/git/LSHTM_analysis/config/rpob.R") - -# get plotting dfs #source("~/git/LSHTM_analysis/scripts/plotting/get_plotting_dfs.R") +#======= +# output +#======= +outdir_images = paste0("~/git/Writing/thesis/images/results/", tolower(gene), "/") +cat("plots will output to:", outdir_images) ######################################################## if (length(merged_df3$position) == length(merged_df3$X5uhc_position) ){ pos_colname = "X5uhc_position" @@ -240,26 +238,32 @@ head(str_df_plot_cols) # colour based on effect table(str_df_plot_cols$pe_effect_outcome) -# colors = c("#ffd700" #gold -# , "#f0e68c" #khaki -# , "#da70d6"# orchid -# , "#ff1493"# deeppink -# , "#a0522d" #sienna -# , "#d2b48c" # tan -# , "#00BFC4" #, "#007d85" #blue -# , "#F8766D" )# red +# oops SS should be brighter/darker +# pe_colour_map = c("DD_lig" = "#ffd700" # gold +# , "SS_lig" = "#f0e68c" # khaki +# +# , "DD_nucleic_acid"= "#a0522d" # sienna +# , "SS_nucleic_acid"= "#d2b48c" # sandybrown +# +# , "DD_ppi2" = "#da70d6" # orchid +# , "SS_ppi2" = "#ff1493" # deeppink +# +# , "DD_stability" = "#f8766d" # red +# , "SS_stability" = "#00BFC4") # blue -pe_colour_map = c("DD_lig" = "#ffd700" # gold - , "SS_lig" = "#f0e68c" # khaki - - , "DD_nucleic_acid"= "#a0522d" # sienna - , "SS_nucleic_acid"= "#d2b48c" # tan - - , "DD_ppi2" = "#da70d6" # orchid - , "SS_ppi2" = "#ff1493" # deeppink - , "DD_stability" = "#f8766d" # red - , "SS_stability" = "#00BFC4") # blue +pe_colour_map = c("DD_lig" = "#f0e68c" # khaki + , "SS_lig" = "#ffd700" # gold + + , "DD_nucleic_acid"= "#d2b48c" # sandybrown + , "SS_nucleic_acid"= "#a0522d" # sienna + + , "DD_ppi2" = "#da70d6" # orchid + , "SS_ppi2" = "#ff1493" # deeppink + + , "DD_stability" = "#f8766d" # red + , "SS_stability" = "#00BFC4") # blue + #unlist(d[c('a', 'a', 'c', 'b')], use.names=FALSE) @@ -320,8 +324,8 @@ if (nrow(ss_lig) == table(str_df_plot_cols$pe_effect_outcome)[['SS_lig']]){ } #put in chimera cmd -paste0(dd_lig_pos, ".C") -paste0(ss_lig_pos, ".C") +toString(paste0(dd_lig_pos, ".C")) +toString(paste0(ss_lig_pos, ".C")) #=================================================== #------------------------ @@ -344,8 +348,8 @@ if (nrow(ss_nca) == table(str_df_plot_cols$pe_effect_outcome)[['SS_nucleic_acid } #put in chimera cmd -paste0(dd_nca_pos, ".C") -paste0(ss_nca_pos, ".C") +toString(paste0(dd_nca_pos, ".C")) +toString(paste0(ss_nca_pos, ".C")) #=================================================== #------------------- # PPI2 Affinity @@ -367,8 +371,8 @@ if (nrow(ss_ppi2) == table(str_df_plot_cols$pe_effect_outcome)[['SS_ppi2']]){ } #put in chimera cmd -paste0(dd_ppi2_pos, ".C") -paste0(ss_ppi2_pos, ".C") +toString(paste0(dd_ppi2_pos, ".C")) +toString(paste0(ss_ppi2_pos, ".C")) #========================================================= #------------------------ @@ -391,8 +395,8 @@ if (nrow(ss_stability) == table(str_df_plot_cols$pe_effect_outcome)[['SS_stabil } #put in chimera cmd -# stabiliting first as it has less numbers -paste0(ss_stability_pos, ".C") -paste0(dd_stability_pos, ".C") +toString(paste0(dd_stability_pos, ".C")) +toString(paste0(ss_stability_pos, ".C")) + ####################################################################