modified bp with option for adding stats and boxplplots. Moved old one to redundant
This commit is contained in:
parent
c8e21b928c
commit
2c65bb25d8
8 changed files with 443 additions and 102 deletions
|
@ -3,10 +3,9 @@
|
|||
# TASK: producing boxplots for dr and other muts
|
||||
|
||||
#########################################################
|
||||
#=======================================================================
|
||||
# working dir and loading libraries
|
||||
# getwd()
|
||||
setwd("~/git/LSHTM_analysis/scripts/plotting")
|
||||
# setwd("~/git/LSHTM_analysis/scripts/plotting")
|
||||
# getwd()
|
||||
|
||||
# make cmd
|
||||
|
@ -14,21 +13,21 @@ setwd("~/git/LSHTM_analysis/scripts/plotting")
|
|||
# drug = "streptomycin"
|
||||
# gene = "gid"
|
||||
|
||||
source("get_plotting_dfs.R")
|
||||
# source("get_plotting_dfs.R")
|
||||
#=======================================================================
|
||||
# MOVE TO COMBINE or singular file for deepddg
|
||||
#
|
||||
# cols_to_select = c("mutation", "mutationinformation"
|
||||
# , "wild_type", "position", "mutant_type"
|
||||
# , "mutation_info")
|
||||
#
|
||||
# merged_df3_short = merged_df3[, cols_to_select]
|
||||
|
||||
cols_to_select = c("mutation", "mutationinformation"
|
||||
, "wild_type", "position", "mutant_type"
|
||||
, "mutation_info")
|
||||
|
||||
merged_df3_short = merged_df3[, cols_to_select]
|
||||
|
||||
infilename_mcsm_f_snps <- paste0("~/git/Data/", drug, "/output/", gene
|
||||
, "_mcsm_formatted_snps.csv")
|
||||
|
||||
mcsm_f_snps<- read.csv(infilename_mcsm_f_snps, header = F)
|
||||
names(mcsm_f_snps) <- "mutationinformation"
|
||||
# infilename_mcsm_f_snps <- paste0("~/git/Data/", drug, "/output/", gene
|
||||
# , "_mcsm_formatted_snps.csv")
|
||||
#
|
||||
# mcsm_f_snps<- read.csv(infilename_mcsm_f_snps, header = F)
|
||||
# names(mcsm_f_snps) <- "mutationinformation"
|
||||
|
||||
# write merged_df3 to generate structural figure on chimera
|
||||
#write.csv(merged_df3_short, "merged_df3_short.csv")
|
||||
|
@ -52,11 +51,11 @@ my_min = min(merged_df3$deepddg_scaled); my_min
|
|||
my_max = max(merged_df3$deepddg_scaled); my_max
|
||||
|
||||
if (my_min == -1 && my_max == 1){
|
||||
cat("PASS: DeepDDG successfully scaled b/w -1 and 1"
|
||||
cat("\nPASS: DeepDDG successfully scaled b/w -1 and 1"
|
||||
#, "\nProceeding with assigning deep outcome category")
|
||||
, "\n")
|
||||
}else{
|
||||
cat("FAIL: could not scale DeepDDG ddg values"
|
||||
cat("\nFAIL: could not scale DeepDDG ddg values"
|
||||
, "Aborting!")
|
||||
}
|
||||
|
||||
|
@ -100,7 +99,7 @@ if (merging_cols == "mutationinformation") {
|
|||
cols_check <- c(c1, c2, c3, c4)
|
||||
expected_cols = n_comb_cols - ( length(cols_check) - 1)
|
||||
if (all(cols_check)){
|
||||
cat("\nStage 2:Proceeding with merging dfs:\n")
|
||||
cat("\nStage 2: Proceeding with merging dfs:\n")
|
||||
comb_df <- Reduce(inner_join, list(cols_mcsm_df
|
||||
, cols_mcsm_na_df
|
||||
, dynamut_df
|
||||
|
@ -115,12 +114,13 @@ if (merging_cols == "mutationinformation") {
|
|||
|
||||
}
|
||||
}
|
||||
names(comb_df_s)
|
||||
#names(comb_df_s)
|
||||
cat("\n!!!IT GOT TO HERE!!!!")
|
||||
#=======================================================================
|
||||
fact_cols = colnames(comb_df_s)[grepl( "_outcome|_info", colnames(comb_df_s) )]
|
||||
fact_cols
|
||||
lapply(comb_df_s[, fact_cols], class)
|
||||
comb_df_s[,fact_cols] <- lapply(comb_df_s[,cols],as.factor)
|
||||
comb_df_s[, fact_cols] <- lapply(comb_df_s[, fact_cols], as.factor)
|
||||
|
||||
if (any(lapply(comb_df_s[, fact_cols], class) == "character")){
|
||||
cat("\nChanging cols to factor")
|
||||
|
@ -512,7 +512,6 @@ rm(all_plot_dfs
|
|||
, my_data_snp
|
||||
, my_df
|
||||
, my_df_u
|
||||
, ols_mcsm_df
|
||||
, other_muts
|
||||
, pd_df
|
||||
, subcols_df_ps
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue