wrapper script basic_barplots_PS.R now takes cmd and calls functions to generate plots.Tested and verfiied.
This commit is contained in:
parent
b25511a239
commit
ce8abafdfe
2 changed files with 32 additions and 37 deletions
|
@ -6,13 +6,12 @@
|
|||
library(data.table)
|
||||
library(dplyr)
|
||||
#########################################################
|
||||
# FIXME (not urgent!): Dirty function return nothing, but creates global dfs
|
||||
|
||||
# plotting_data(): formatting data for plots
|
||||
# input args:
|
||||
## input csv file
|
||||
## lig cut off dist, default = 10 Ang
|
||||
# output: None
|
||||
# Side effects: global dfs (formatted and added columns)
|
||||
# output: list of 4 dfs, that need to be decompressed
|
||||
## my_df
|
||||
## my_df_u
|
||||
## my_df_u_lig
|
||||
|
@ -24,18 +23,7 @@ my_df_u = data.frame()
|
|||
my_df_u_lig = data.frame()
|
||||
dup_muts = data.frame()
|
||||
|
||||
cat(paste0("Input file 1:", infile_params, '\n') )
|
||||
|
||||
# These globals are created by import_dirs()
|
||||
#cat('columns based on variables:\n'
|
||||
# , drug
|
||||
# , '\n'
|
||||
# , dr_muts_col
|
||||
# , '\n'
|
||||
# , other_muts_col
|
||||
# , "\n"
|
||||
# , resistance_col
|
||||
# , '\n===============================================================')
|
||||
cat(paste0("\nInput file to prepare for plotting:", infile_params, "\n") )
|
||||
|
||||
#===========================
|
||||
# Read file: struct params
|
||||
|
@ -73,7 +61,7 @@ if (my_min == -1 && my_max == 1){
|
|||
, "\nProceeding with assigning foldx outcome category")
|
||||
}else{
|
||||
cat("\nFAIL: could not scale foldx ddg values"
|
||||
, "Aborting!")
|
||||
, "Aborting!\n")
|
||||
}
|
||||
|
||||
#------------------------------
|
||||
|
@ -87,7 +75,7 @@ c2 = table(my_df$ddg < 0)
|
|||
if ( all(c1 == c2) ){
|
||||
cat("\nPASS: foldx outcome successfully created")
|
||||
}else{
|
||||
cat("\nFAIL: foldx outcome could not be created. Aborting!")
|
||||
cat("\nFAIL: foldx outcome could not be created. Aborting!\n")
|
||||
exit()
|
||||
}
|
||||
|
||||
|
@ -98,21 +86,21 @@ if ( all(c1 == c2) ){
|
|||
# check for duplicate mutations
|
||||
if ( length(unique(my_df$mutationinformation)) != length(my_df$mutationinformation)){
|
||||
cat(paste0("\nCAUTION:", " Duplicate mutations identified"
|
||||
, "\nExtracting these..."))
|
||||
, "\nExtracting these...\n"))
|
||||
#cat(my_df[duplicated(my_df$mutationinformation),])
|
||||
dup_muts = my_df[duplicated(my_df$mutationinformation),]
|
||||
dup_muts_nu = length(unique(dup_muts$mutationinformation))
|
||||
cat(paste0("\nDim of duplicate mutation df:", nrow(dup_muts)
|
||||
, "\nNo. of unique duplicate mutations:", dup_muts_nu
|
||||
, "\n\nExtracting df with unique mutations only"))
|
||||
, "\n\nExtracting df with unique mutations only\n"))
|
||||
my_df_u = my_df[!duplicated(my_df$mutationinformation),]
|
||||
}else{
|
||||
cat(paste0("\nNo duplicate mutations detected"))
|
||||
cat(paste0("\nNo duplicate mutations detected\n"))
|
||||
my_df_u = my_df
|
||||
}
|
||||
|
||||
upos = unique(my_df_u$position)
|
||||
cat("\nDim of clean df:"); cat(dim(my_df_u))
|
||||
cat("\nDim of clean df:"); cat(dim(my_df_u), "\n")
|
||||
cat("\nNo. of unique mutational positions:"); cat(length(upos), "\n")
|
||||
|
||||
#===============================================
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue