diff --git a/scripts/plotting/get_plotting_dfs.R b/scripts/plotting/get_plotting_dfs.R index 91adf2b..4c1af95 100644 --- a/scripts/plotting/get_plotting_dfs.R +++ b/scripts/plotting/get_plotting_dfs.R @@ -224,8 +224,8 @@ cat(s3) # 1 # s3 = c("\nSuccessfully sourced lineage_data.R") # cat(s3) - merged_df3 = as.data.frame(merged_df3) -# +merged_df3 = as.data.frame(merged_df3) + corr_df_m3_f = corr_data_extract(merged_df3 , gene = gene , drug = drug diff --git a/scripts/plotting/plotting_thesis/gid/gg_pairs_all_gid.R b/scripts/plotting/plotting_thesis/gid/gg_pairs_all_gid.R index b855756..439e03a 100644 --- a/scripts/plotting/plotting_thesis/gid/gg_pairs_all_gid.R +++ b/scripts/plotting/plotting_thesis/gid/gg_pairs_all_gid.R @@ -1,7 +1,15 @@ -#source("~/git/LSHTM_analysis/config/embb.R") -#source("~/git/LSHTM_analysis/scripts/plotting/plotting_colnames.R") -#source("~/git/LSHTM_analysis/scripts/plotting/get_plotting_dfs.R") +#======= +# Input +#======= +source("~/git/LSHTM_analysis/config/gid.R") +source("~/git/LSHTM_analysis/scripts/plotting/get_plotting_dfs.R") +#======= +# output +#======= +outdir_images = paste0("~/git/Writing/thesis/images/results/", tolower(gene), "/") +cat("\nOutput dir for plots:", outdir_images) +#### corr plot function: ggpairs #### my_gg_pairs=function(plot_df, plot_title , tt_args_size = 2.5 , gp_args_size = 2.5){ @@ -38,8 +46,10 @@ my_gg_pairs=function(plot_df, plot_title # face="bold")) } + +#### Data for ggpairs #### DistCutOff = 10 -########################################################################### + geneL_normal = c("pnca") geneL_na = c("gid", "rpob") geneL_ppi2 = c("alr", "embb", "katg", "rpob") @@ -53,7 +63,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)" ) ############################################################ #============================================= @@ -148,7 +158,7 @@ plot_corr_df_aff = my_gg_pairs(corr_df_aff #, gp_args_size = 4 ) -#### Combine plots ##### +#### Combine plots (OLD, AB + C) ##### # #png("/home/tanu/tmp/gg_pairs_all.png", height = 6, width=11.75, unit="in",res=300) # png(paste0(outdir_images # ,tolower(gene) diff --git a/scripts/plotting/plotting_thesis/gid/gid_ORandSNP_results.R b/scripts/plotting/plotting_thesis/gid/gid_ORandSNP_results.R index 972def0..2c072a2 100644 --- a/scripts/plotting/plotting_thesis/gid/gid_ORandSNP_results.R +++ b/scripts/plotting/plotting_thesis/gid/gid_ORandSNP_results.R @@ -136,8 +136,6 @@ bar = bar[, c("mutationinformation" table(bar$sensitivity) -table(bar$or_mychisq>1&bar$signif_fdr) # sen and res ~ OR - str(bar) sen = bar[bar$or_mychisq<1,] sen = na.omit(sen) @@ -162,7 +160,9 @@ if (nrow(bar_or) == nrow(sen1) + nrow(res1) ){ # percent for OR muts pc_orR = nrow(res1)/(nrow(sen1) + nrow(res1)); pc_orR -cat("\nPercentage of muts with OR>1 i.e resistant:" + +cat("Number of R muts with OR>1:", nrow(res1) + , "\nPercentage of muts with OR>1 i.e resistant:" , pc_orR *100 ) # muts with highest OR @@ -171,22 +171,23 @@ head(bar_or$mutationinformation, 10) # sort df bar_or = bar_or[order(bar_or$or_mychisq , bar_or$ligand_distance - , bar_or$interface_dist + , bar_or$nca_dist + #, bar_or$interface_dist , decreasing = T), ] +nrow(bar_or) bar_or$drug_site = ifelse(bar_or$position%in%aa_pos_drug, "drug", "no") table(bar_or$drug_site) -bar_or$dsl_site = ifelse(bar_or$position%in%aa_pos_dsl, "dsl", "no") +bar_or$rna_site = ifelse(bar_or$position%in%aa_pos_rna, "rna", "no") table(bar_or$dsl_site) -bar_or$ca_site = ifelse(bar_or$position%in%aa_pos_ca, "ca", "no") +bar_or$sam_site = ifelse(bar_or$position%in%aa_pos_sam, "sam", "no") table(bar_or$ca_site) -bar_or$cdl_site = ifelse(bar_or$position%in%aa_pos_cdl, "cdl", "no") +bar_or$amp_site = ifelse(bar_or$position%in%aa_pos_amp, "amp", "no") table(bar_or$cdl_site) - top10_or = bar_or[1:10,] # are these active sites diff --git a/scripts/plotting/plotting_thesis/gid/gid_appendix_tables.R b/scripts/plotting/plotting_thesis/gid/gid_appendix_tables.R index eb37c9f..4868c8d 100644 --- a/scripts/plotting/plotting_thesis/gid/gid_appendix_tables.R +++ b/scripts/plotting/plotting_thesis/gid/gid_appendix_tables.R @@ -285,6 +285,7 @@ if (identical(colnames(mut_h_avs_dd), colnames(mut_h_avs_ss)) ){ #------------------- # Filtered columns # most DD/SS: ligand +# FIXME DUBIOUS as min and max can be both negative #------------------- df3_effects_lig = df3_effects[df3_effects[[LigDist_colname]]