updated Af and OR calcs script with argeparse and minor tidyup

This commit is contained in:
Tanushree Tunstall 2020-06-18 18:37:55 +01:00
parent 76ecb65a1a
commit fa2bcb5f05

View file

@ -23,7 +23,7 @@ drug = opt$drug
gene = opt$gene gene = opt$gene
if(is.null(drug)|is.null(gene)) { if(is.null(drug)|is.null(gene)) {
stop('--drug and --gene must both be specified (case-sensitive)') stop('Missing arguments: --drug and --gene must both be specified (case-sensitive)')
} }
#options(scipen = 999) #disabling scientific notation in R. #options(scipen = 999) #disabling scientific notation in R.
@ -59,8 +59,7 @@ cat(paste0('Reading infile2: gene associated metadata:', infile_metadata))
# outdir = 'git/Data/pyrazinamide/output' # outdir = 'git/Data/pyrazinamide/output'
outdir = paste0('~/git/Data', '/', drug, '/', 'output') outdir = paste0('~/git/Data', '/', drug, '/', 'output')
#out_filename = paste0(tolower(gene), '_meta_data_with_AF_OR.csv') #out_filename = paste0(tolower(gene), '_meta_data_with_AF_OR.csv')
#out_filename = paste0(tolower(gene), '_AF_OR.csv') out_filename = paste0(tolower(gene), '_AF_OR.csv')
out_filename = paste0(tolower(gene), '_XXXXX_AF_OR.csv')
outfile = paste0(outdir, '/', out_filename) outfile = paste0(outdir, '/', out_filename)
cat(paste0('Output file with full path:', outfile)) cat(paste0('Output file with full path:', outfile))
#%% end of variable assignment for input and output files #%% end of variable assignment for input and output files
@ -493,7 +492,7 @@ cat(paste0('Finished writing:'
, '\nNo. of rows: ', nrow(comb_AF_and_OR) , '\nNo. of rows: ', nrow(comb_AF_and_OR)
, '\nNo. of cols: ', ncol(comb_AF_and_OR))) , '\nNo. of cols: ', ncol(comb_AF_and_OR)))
#************************************************ #************************************************
cat('======================================================================') cat('\n======================================================================\n')
rm(out_filename) rm(out_filename)
cat('End of script: calculated AF, OR, pvalues and saved file') cat('End of script: calculated AF, OR, pvalues and saved file')