added katg tables

This commit is contained in:
Tanushree Tunstall 2022-08-28 22:31:12 +01:00
parent d5da923a74
commit 6441be21ab
8 changed files with 31 additions and 200 deletions

View file

@ -106,7 +106,7 @@ cat("\n==================================================="
aa_pos_lig1 = aa_pos_hem aa_pos_lig1 = aa_pos_hem
aa_pos_lig2 = NULL aa_pos_lig2 = NULL
aa_pos_lig3 = 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")) tile_colour=c("green","darkslategrey"))

View file

@ -71,8 +71,8 @@ if not outdir:
# input # input
#======= #=======
#in_filename = 'merged_df3.csv' #in_filename = 'merged_df3.csv'
#in_filename = gene.lower() + '_complex_mcsm_norm.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_SRY.csv' # gid
infile_merged_df3 = outdir + '/' + in_filename infile_merged_df3 = outdir + '/' + in_filename
print('Input file: ', infile_merged_df3 print('Input file: ', infile_merged_df3
, '\n============================================================') , '\n============================================================')
@ -217,4 +217,4 @@ print('Total no. of mutations: ', total_muts
, '\nTotal no. of unchanged muts: ', no_change_muts.mut_count.sum() , '\nTotal no. of unchanged muts: ', no_change_muts.mut_count.sum()
, '\n=======================================================') , '\n=======================================================')
#%% end of script #%% end of script
#======================================================================= #=======================================================================

View file

@ -15,7 +15,6 @@ geneL_na_v2 = c("gid")
geneL_ppi2 = c("alr", "embb", "katg", "rpob") geneL_ppi2 = c("alr", "embb", "katg", "rpob")
geneL_both = c("rpob") geneL_both = c("rpob")
if (tolower(gene)%in%geneL_na_v2) { if (tolower(gene)%in%geneL_na_v2) {
gene_colnames = c("mcsm_na_affinity", "mcsm_na_outcome") 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("NA-Dist (", angstroms_symbol, ")")
#, paste0("mCSM-NA (", delta_symbol,delta_symbol,"G)") #, paste0("mCSM-NA (", delta_symbol,delta_symbol,"G)")
#, "mCSM-NA outcome" #, "mCSM-NA outcome"
, paste0("PPI-Dist (", angstroms_symbol, ")") , paste0("PPI-Dist (", angstroms_symbol, ")")
, paste0("mCSM-PPI (", delta_symbol,delta_symbol,"G)") , paste0("mCSM-PPI (", delta_symbol,delta_symbol,"G)")
, "mCSM-PPI outcome" , "mCSM-PPI outcome"
@ -226,7 +226,7 @@ table(Out_df_ncaS$plp_site)
#---------------------- #----------------------
Out_ncaT = paste0(outdir_stats Out_ncaT = paste0(outdir_stats
, tolower(gene) , tolower(gene)
, "_na_muts.csv") , "_ppi2_muts.csv")
cat("Output of NA muts:", Out_ncaT ) cat("Output of NA muts:", Out_ncaT )
write.csv(Out_df_ncaS, Out_ncaT, row.names = FALSE) write.csv(Out_df_ncaS, Out_ncaT, row.names = FALSE)

View file

@ -32,6 +32,7 @@ table(genomics_dataP$param_type)
genomicsP = lf_bp2(genomics_dataP genomicsP = lf_bp2(genomics_dataP
#, p_title = "" #, p_title = ""
, dot_transparency = 0.1 #0.3 default
, violin_quantiles = c(0.5), monochrome = F) , violin_quantiles = c(0.5), monochrome = F)
genomicsP genomicsP

View file

@ -349,7 +349,7 @@ if (tolower(gene)%in%geneL_ppi2 ){
# add cols # add cols
mut_h_ppi2_dd$mutational_effect = "Most Destabilising for PPI affinity" 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)) ){ if (identical(colnames(mut_h_ppi2_dd), colnames(mut_h_ppi2_ss)) ){
cat("\nPass 1: ppi2") cat("\nPass 1: ppi2")

View file

@ -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()

View file

@ -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/plotting_colnames.R")
#source("~/git/LSHTM_analysis/scripts/plotting/get_plotting_dfs.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))] aff_dist_cols = colnames(corr_plotdf)[grep("Dist", colnames(corr_plotdf))]
static_cols = c("Log10(MAF)" static_cols = c("Log10(MAF)"
, "Log10(OR)" #, "Log10(OR)"
) )
############################################################ ############################################################
#============================================= #=============================================

View file

@ -1,5 +1,11 @@
#!/usr/bin/env Rscript #!/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 # TASK: generate plots for lineage
# Individual plots in # Individual plots in
@ -38,19 +44,19 @@ linPlots_combined = paste0(outdir_images
cat("\nOutput plot:", linPlots_combined) cat("\nOutput plot:", linPlots_combined)
png(linPlots_combined, width = 9, height = 6, units = "in" ,res = 300) png(linPlots_combined, width = 9, height = 6, units = "in" ,res = 300)
cowplot::plot_grid( cowplot::plot_grid(
cowplot::plot_grid(lin_countP, lin_diversityP cowplot::plot_grid(lin_countP, lin_diversityP,
# , nrow = 2 nrow = 2,
# , rel_heights = c(1.2,1) rel_heights = c(1.2,1),
# , labels = "AUTO" labels = "AUTO",
# , label_size = my_label_size), label_size = my_label_size),
# NULL, NULL,
# linP_dm_om, linP_dm_om,
# nrow = 1, nrow = 1,
# labels = c("", "", "C"), labels = c("", "", "C"),
# label_size = my_label_size, label_size = my_label_size,
# rel_widths = c(35, 3, 52) rel_widths = c(35, 3, 52)
# ) )
# dev.off() dev.off()