moved plotting_func to functions and replaced 3 basic_barplots scripts with 1

This commit is contained in:
Tanushree Tunstall 2021-06-10 16:09:58 +01:00
parent 5c018e23be
commit dccdfe9742
9 changed files with 287 additions and 237 deletions

View file

@ -54,26 +54,23 @@ if(is.null(drug)|is.null(gene)) {
}
#########################################################
# call functions with relevant args
#------------------------------------------
# import_dirs()
# should return the follwoing variables:
# datadir
# indir
# outdir
# plotdir
# dr_muts_col
# other_muts_col
# resistance_col
# import_dirs(); returns
# datadir
# indir
# outdir
# plotdir
# dr_muts_col
# other_muts_col
# resistance_col
#--------------------------------------------
import_dirs(drug, gene)
#---------------------------------------------
# plotting_data()
# should return the following dfs:
# my_df
# my_df_u
# my_df_u_lig
# dup_muts
# plotting_data(): returns
# my_df
# my_df_u
# my_df_u_lig
# dup_muts
#----------------------------------------------
#infile = "/home/tanu/git/Data/streptomycin/output/gid_comb_stab_struc_params.csv"
#infile = ""
@ -107,32 +104,20 @@ cat(paste0("Directories imported:"
#, "\ngene_match:", gene_match
#, "\nLength of upos:", length(upos)
#, "\nAngstrom symbol:", angstroms_symbol))
#======================================================================
#=======
# output
# output filenames
#=======
# plot 1
basic_bp_foldx = paste0(tolower(gene), "_basic_barplot_foldx.svg")
plot_basic_bp_foldx = paste0(plotdir,"/", basic_bp_foldx)
#=======================================================================
#================
# Data for plots
#================
# REASSIGNMENT as necessary
df = my_df_u
# sanity checks
str(df)
#=======================================================================
#****************
# Plot 1: Count of stabilising and destabilsing muts
#****************
svg(plot_basic_bp_foldx)
print(paste0("plot1 filename:", plot_basic_bp_foldx))
#--------------
# start plot 1: call function
#--------------
stability_count_bp(plotdf = my_df_u
, df_colname = "foldx_outcome"
, leg_title = "FoldX outcome")