wrapper script basic_barplots_PS.R now takes cmd and calls functions to generate plots.Tested and verfiied.

This commit is contained in:
Tanushree Tunstall 2021-06-08 16:48:19 +01:00
parent 1505a3c707
commit 3f691281bc
2 changed files with 32 additions and 37 deletions

View file

@ -25,16 +25,24 @@ source("plotting_globals.R")
source("plotting_data.R")
#########################################################
# command line args
#********************
# !!!FUTURE TODO!!!
# Can pass additional params of output/plot dir by user.
# Not strictly required for my workflow since it is optimised
# to have a streamlined input/output flow without filename worries.
#********************
spec = matrix(c(
"drug" , "d", 1, "character",
"gene" , "g", 1, "character"
"drug" ,"d", 1, "character",
"gene" ,"g", 1, "character",
"data" ,"f", 2, "character"
), byrow = TRUE, ncol = 4)
opt = getopt(spec)
#FIXME: detect if script running from cmd, then set these
drug = opt$drug
gene = opt$gene
drug = opt$drug
gene = opt$gene
infile = opt$data
# hardcoding when not using cmd
#drug = "streptomycin"
@ -45,14 +53,16 @@ if(is.null(drug)|is.null(gene)) {
}
#########################################################
# call functions with relevant args
drug = "streptomycin"
gene = "gid"
#drug = "streptomycin"
#gene = "gid"
import_dirs(drug, gene)
if (!exists("infile") && exists("gene")){
#in_filename_params = paste0(tolower(gene), "_all_params.csv")
#if (!exists("infile") && exists("gene")){
if (!is.character(infile) && exists("gene")){
#in_filename_params = paste0(tolower(gene), "_all_params.csv")
in_filename_params = paste0(tolower(gene), "_comb_stab_struc_params.csv") # part combined for gid
infile = paste0(outdir, "/", in_filename_params)
cat("\nInput file not specified, assuming filename: ", infile, "\n")
}
#infile = "/home/tanu/git/Data/streptomycin/output/gid_comb_stab_struc_params.csv"
@ -64,6 +74,7 @@ my_df = pd_df[[1]]
my_df_u = pd_df[[2]]
my_df_u_lig = pd_df[[3]]
dup_muts = pd_df[[4]]
#########################################################
# This script: should return the following dfs, directories and variables
# my_df
@ -79,15 +90,11 @@ cat(paste0("Directories imported:"
cat(paste0("Variables imported:"
, "\ndrug:", drug
, "\ngene:", gene
, "\ngene:", gene))
#, "\ngene_match:", gene_match
, "\nLength of upos:", length(upos)
, "\nAngstrom symbol:", angstroms_symbol))
# clear excess variable
rm(my_df, upos, dup_muts, my_df_u_lig)
#=======================================================================
#, "\nLength of upos:", length(upos)
#, "\nAngstrom symbol:", angstroms_symbol))
#=======================================================================
#=======
# output
#=======