From 2acea43bcf2a5d41eb252337f8b4e0caabecba75 Mon Sep 17 00:00:00 2001 From: Tanushree Tunstall Date: Sun, 14 Aug 2022 12:18:12 +0100 Subject: [PATCH] added maf column in appendix_tables --- .../plotting_thesis/appendix_tables.R | 112 +++++++++---- scripts/plotting/plotting_thesis/colnames.csv | 156 ------------------ .../plotting_thesis/colnames_short.csv | 99 ----------- 3 files changed, 84 insertions(+), 283 deletions(-) delete mode 100644 scripts/plotting/plotting_thesis/colnames.csv delete mode 100644 scripts/plotting/plotting_thesis/colnames_short.csv diff --git a/scripts/plotting/plotting_thesis/appendix_tables.R b/scripts/plotting/plotting_thesis/appendix_tables.R index 0ffe158..0452e5c 100644 --- a/scripts/plotting/plotting_thesis/appendix_tables.R +++ b/scripts/plotting/plotting_thesis/appendix_tables.R @@ -23,31 +23,82 @@ geneL_normal = c("pnca") geneL_na = c("gid", "rpob") geneL_ppi2 = c("alr", "embb", "katg", "rpob") -# LigDist_colname # from globals used -# ppi2Dist_colname #from globals used -# naDist_colname #from globals used +#from plotting_globals() +LigDist_colname +ppi2Dist_colname +naDist_colname + +delta_symbol #delta_symbol = "\u0394"; delta_symbol +angstroms_symbol + +#=========== +# Data used +#=========== df3 = merged_df3 -# Add adjusted P-values -df3$p_adj_fdr = p.adjust(df3$pval_fisher, method = "fdr") -df3$signif_fdr = df3$p_adj_fdr -df3 = dplyr::mutate(df3 +cols_to_output = c("mutationinformation" + , "position" + , affinity_dist_colnames[1] + , "ligand_affinity_change" + , "ligand_outcome" + , "mmcsm_lig" + , "mmcsm_lig_outcome" + , affinity_dist_colnames[2] + , "mcsm_ppi2_affinity" + , "mcsm_ppi2_outcome" + , "maf" + , "or_mychisq" + , "pval_fisher") + +cols_to_output +df3_output = df3[, cols_to_output] +colnames(df3_output) + +#=============================================== +# Add COLS and rounding: adjusted P-values + MAF +#============================================== +#----------------------------- +# adjusted P-values +#----------------------------- +# add cols: p_adj_fdr and signif_fdr +df3_output$p_adj_fdr = p.adjust(df3_output$pval_fisher, method = "fdr") +df3_output$signif_fdr = df3_output$p_adj_fdr +df3_output = dplyr::mutate(df3_output , signif_fdr = case_when(signif_fdr == 0.05 ~ "." , signif_fdr <=0.0001 ~ '****' , signif_fdr <=0.001 ~ '***' , signif_fdr <=0.01 ~ '**' , signif_fdr <0.05 ~ '*' , TRUE ~ 'ns')) +# rounding +df3_output$or_mychisq = round(df3_output$or_mychisq,2) +df3_output$p_adj_fdr = round(df3_output$p_adj_fdr,2) +head(df3_output) + +#---------- +# MAF (%) +#---------- +# add col maf_percent +df3_output$maf_percent = df3_output$maf*100 + +# rounding +df3_output$maf_percent = round(df3_output$maf_percent,2) +head(df3_output$af); head(df3_output$maf);head(df3_output$maf_percent) + +#---------- +# P-value +#---------- +df3_output$pval_fisher = round(df3_output$pval_fisher,2) - +class(df3_output) +head(df3_output) #################################### # Appendix: ligand affinity #################################### -df_lig = df3[df3[[LigDist_colname]]