From 5f10ad807526ce1bb5b9e146f94542710b2fc321 Mon Sep 17 00:00:00 2001 From: Tanushree Tunstall Date: Wed, 23 Sep 2020 11:20:22 +0100 Subject: [PATCH] added fold and duet agreement to extreme_muts.R --- scripts/plotting/extreme_muts.R | 23 +++++++++++++++++++++-- scripts/plotting/plotting_data.R | 8 ++++---- 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/scripts/plotting/extreme_muts.R b/scripts/plotting/extreme_muts.R index 65943aa..053fde9 100644 --- a/scripts/plotting/extreme_muts.R +++ b/scripts/plotting/extreme_muts.R @@ -10,6 +10,7 @@ setwd("~/git/LSHTM_analysis/scripts/plotting") getwd() #source("Header_TT.R") +library(tidyverse) library(ggplot2) library(data.table) library(dplyr) @@ -19,7 +20,6 @@ library(dplyr) #========= #source("combining_dfs_plotting.R") -# FIXME: add a separate script to add foldx values and others source("output_tables.R") rm(df, merged_df3_short, df_output) @@ -146,4 +146,23 @@ n_mult_muts_sites = sum(table(foo$n)) - (table(foo$n)[[1]] - table(foo$n)[[2]]) cat("No of budding hotspots (sites with 2 mutations):", n_budding_sites , "\nNo. of sites with mutiple (>2) mutations:", n_mult_muts_sites) -#========================================================================== \ No newline at end of file +#========================================================================== + +#============================== +# agreement of foldx and DUET +#============================== +mcsm_foldx = merged_df3[which(merged_df3$duet_outcome != merged_df3$foldx_outcome),] + +mcsm_foldx$sign_comp = ifelse(sign(mcsm_foldx$duet_scaled)==sign(mcsm_foldx$ddg), "PASS", "FAIL") +table(mcsm_foldx$sign_comp) + +# another way of checking +merged_df3$sign_comp = ifelse(sign(merged_df3$duet_scaled)==sign(merged_df3$ddg), "PASS", "FAIL") +table(merged_df3$sign_comp) + +disagreement = table(merged_df3$sign_comp)[2]/nrow(merged_df3)*100 +agreement = 100 - disagreement + +cat("There is", agreement, "% between mcsm and foldx predictions") + +############################################################################## diff --git a/scripts/plotting/plotting_data.R b/scripts/plotting/plotting_data.R index 0c15a78..2df3ef4 100755 --- a/scripts/plotting/plotting_data.R +++ b/scripts/plotting/plotting_data.R @@ -88,10 +88,10 @@ my_min = min(my_df$foldx_scaled); my_min my_max = max(my_df$foldx_scaled); my_max if (my_min == -1 && my_max == 1){ - cat("PASS: foldx ddg successfully scaled b/w -1 and 1" + cat("\nPASS: foldx ddg successfully scaled b/w -1 and 1" , "\nProceeding with assigning foldx outcome category") }else{ - cat("FAIL: could not scale foldx ddg values" + cat("\nFAIL: could not scale foldx ddg values" , "Aborting!") } @@ -104,9 +104,9 @@ my_df$foldx_outcome = ifelse(my_df$ddg < 0, "Stabilising", "Destabilising") c2 = table(my_df$ddg < 0) if ( all(c1 == c2) ){ - cat("PASS: foldx outcome successfully created") + cat("\nPASS: foldx outcome successfully created") }else{ - cat("FAIL: foldx outcome could not be created. Aborting!") + cat("\nFAIL: foldx outcome could not be created. Aborting!") exit() }