going through functions and script for interactive plots
This commit is contained in:
parent
1f266c4cb8
commit
3f7bc908ec
7 changed files with 83 additions and 95 deletions
|
@ -12,20 +12,24 @@ source("/home/tanu/git/LSHTM_analysis/scripts/plotting/Header_TT.R")
|
|||
# in from other scripts
|
||||
# to call this
|
||||
#********************
|
||||
# set drug and gene name
|
||||
|
||||
#====================
|
||||
# variables for lig
|
||||
#====================
|
||||
#==========================================
|
||||
# variables for lig:
|
||||
# comes from functions/plotting_globals.R
|
||||
#==========================================
|
||||
|
||||
#LigDist_colname = "ligand_distance"
|
||||
#LigDist_cutoff = 10
|
||||
cat("\nGlobal variables for Ligand:"
|
||||
, "\nligand distance colname:", LigDist_colname
|
||||
, "\nligand distance cut off:", LigDist_cutoff)
|
||||
|
||||
#===========
|
||||
# input
|
||||
#===========
|
||||
#---------------------
|
||||
#--------------------------------------------
|
||||
# call: import_dirs()
|
||||
#---------------------
|
||||
# comes from functions/plotting_globals.R
|
||||
#--------------------------------------------
|
||||
import_dirs(drug, gene)
|
||||
|
||||
#---------------------------
|
||||
|
@ -72,6 +76,8 @@ gene_metadata <- read.csv(infile_metadata
|
|||
, stringsAsFactors = F
|
||||
, header = T)
|
||||
|
||||
cat("\nDim of meta data file: ", dim(gene_metadata))
|
||||
|
||||
all_plot_dfs = combining_dfs_plotting(my_df_u
|
||||
, gene_metadata
|
||||
, lig_dist_colname = LigDist_colname
|
||||
|
@ -82,34 +88,6 @@ merged_df3 = all_plot_dfs[[2]]
|
|||
merged_df2_comp = all_plot_dfs[[3]]
|
||||
merged_df3_comp = all_plot_dfs[[4]]
|
||||
#======================================================================
|
||||
#TODO: Think! MOVE TO COMBINE or singular file for deepddg
|
||||
|
||||
#============================
|
||||
# adding deepddg scaled values
|
||||
# scale data b/w -1 and 1
|
||||
#============================
|
||||
# n = which(colnames(merged_df3) == "deepddg"); n
|
||||
#
|
||||
# my_min = min(merged_df3[,n]); my_min
|
||||
# my_max = max(merged_df3[,n]); my_max
|
||||
#
|
||||
# merged_df3$deepddg_scaled = ifelse(merged_df3[,n] < 0
|
||||
# , merged_df3[,n]/abs(my_min)
|
||||
# , merged_df3[,n]/my_max)
|
||||
# # sanity check
|
||||
# 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("\nPASS: DeepDDG successfully scaled b/w -1 and 1"
|
||||
# #, "\nProceeding with assigning deep outcome category")
|
||||
# , "\n")
|
||||
# }else{
|
||||
# cat("\nFAIL: could not scale DeepDDG ddg values"
|
||||
# , "Aborting!")
|
||||
# }
|
||||
#
|
||||
|
||||
####################################################################
|
||||
# Data for combining other dfs
|
||||
####################################################################
|
||||
|
@ -131,7 +109,7 @@ merged_df3_comp = all_plot_dfs[[4]]
|
|||
# Data for logoplots
|
||||
####################################################################
|
||||
|
||||
source("logo_data.R")
|
||||
source(paste0(plot_script_path, "logo_data.R"))
|
||||
|
||||
s1 = c("\nSuccessfully sourced logo_data.R")
|
||||
cat(s1)
|
||||
|
@ -142,7 +120,7 @@ cat(s1)
|
|||
|
||||
#source("other_plots_data.R")
|
||||
|
||||
source("dm_om_data.R")
|
||||
source(paste0(plot_script_path, "dm_om_data.R"))
|
||||
|
||||
s2 = c("\nSuccessfully sourced other_plots_data.R")
|
||||
cat(s2)
|
||||
|
@ -151,7 +129,7 @@ cat(s2)
|
|||
# Data for Lineage barplots: WF and LF dfs
|
||||
####################################################################
|
||||
|
||||
source("lineage_data.R")
|
||||
source(paste0(plot_script_path, "lineage_data.R"))
|
||||
|
||||
s3 = c("\nSuccessfully sourced lineage_data.R")
|
||||
cat(s3)
|
||||
|
@ -160,7 +138,7 @@ cat(s3)
|
|||
# Data for corr plots:
|
||||
####################################################################
|
||||
# make sure the above script works because merged_df2_combined is needed
|
||||
source("corr_data.R")
|
||||
source(paste0(plot_script_path, "corr_data.R"))
|
||||
|
||||
s4 = c("\nSuccessfully sourced corr_data.R")
|
||||
cat(s4)
|
||||
|
@ -168,7 +146,7 @@ cat(s4)
|
|||
########################################################################
|
||||
# End of script
|
||||
########################################################################
|
||||
if ( all( length(s1), length(s2), length(s3), length(s4) ) >0 ){
|
||||
if ( all( length(s1), length(s2), length(s3), length(s4) ) > 0 ){
|
||||
cat(
|
||||
"\n##################################################"
|
||||
, "\nSuccessful: get_plotting_dfs.R worked!"
|
||||
|
@ -181,45 +159,18 @@ if ( all( length(s1), length(s2), length(s3), length(s4) ) >0 ){
|
|||
}
|
||||
|
||||
########################################################################
|
||||
# clear excess variables
|
||||
rm(c1, c2, c3, c4, check1
|
||||
, curr_count, curr_total
|
||||
, cols_check
|
||||
, cols_to_select
|
||||
, cols_to_select_deepddg
|
||||
, cols_to_select_duet
|
||||
, cols_to_select_dynamut
|
||||
, cols_to_select_dynamut2
|
||||
, cols_to_select_encomddg
|
||||
, cols_to_select_encomdds
|
||||
, cols_to_select_mcsm
|
||||
, cols_to_select_mcsm_na
|
||||
, cols_to_select_sdm
|
||||
# clear excess variables: from the global enviornment
|
||||
|
||||
vars0 = ls(envir = .GlobalEnv)[grepl("curr_*", ls(envir = .GlobalEnv))]
|
||||
vars1 = ls(envir = .GlobalEnv)[grepl("^cols_to*", ls(envir = .GlobalEnv))]
|
||||
vars2 = ls(envir = .GlobalEnv)[grepl("pivot_cols_*", ls(envir = .GlobalEnv))]
|
||||
vars3 = ls(envir = .GlobalEnv)[grepl("expected_*", ls(envir = .GlobalEnv))]
|
||||
|
||||
rm(c1
|
||||
, fact_cols
|
||||
, infile_metadata
|
||||
, infile_params
|
||||
#, infilename_dynamut
|
||||
#, infilename_dynamut2
|
||||
#, infilename_mcsm_f_snps
|
||||
#, infilename_mcsm_na
|
||||
)
|
||||
|
||||
rm(pivot_cols
|
||||
, pivot_cols_deepddg
|
||||
, pivot_cols_duet
|
||||
, pivot_cols_dynamut
|
||||
, pivot_cols_dynamut2
|
||||
, pivot_cols_encomddg
|
||||
, pivot_cols_encomdds
|
||||
, pivot_cols_foldx
|
||||
, pivot_cols_mcsm
|
||||
, pivot_cols_mcsm_na
|
||||
, pivot_cols_n
|
||||
, pivot_cols_sdm)
|
||||
|
||||
rm(expected_cols
|
||||
, expected_ncols
|
||||
, expected_rows
|
||||
, expected_rows_lf
|
||||
, fact_cols)
|
||||
|
||||
|
||||
, vars0
|
||||
, vars1
|
||||
, vars2
|
||||
, vars3)
|
Loading…
Add table
Add a link
Reference in a new issue