adding options to specify files by user

This commit is contained in:
Tanushree Tunstall 2020-11-27 13:02:15 +00:00
parent 50744f046f
commit a7d7bceb00
2 changed files with 43 additions and 15 deletions

View file

@ -17,12 +17,24 @@ arg_parser.add_argument('-U', '--url', help='mCSM Server URL', default = 'ht
arg_parser.add_argument('-c', '--chain', help='Chain ID as per PDB, Case sensitive', default = 'A')
arg_parser.add_argument('-l','--ligand', help='Ligand ID as per PDB, Case sensitive. REQUIRED only in "submit" stage', default = None)
arg_parser.add_argument('-a','--affinity', help='Affinity in nM. REQUIRED only in "submit" stage', default = 0.99)
arg_parser.add_argument('-pdb','--pdb_file', help = 'PDB File')
arg_parser.add_argument('-m','--mutation_file', help = 'Mutation File, mcsm style')
arg_parser.add_argument('--datadir', help = 'Data Directory. By default, it assmumes homedir + git/Data')
arg_parser.add_argument('-i', '--input_dir', help = 'Input dir containing pdb files. By default, it assmumes homedir + <drug> + input')
arg_parser.add_argument('-o', '--output_dir', help = 'Output dir for results. By default, it assmes homedir + <drug> + output')
# stage: submit, output url file
arg_parser.add_argument('--url_file', help = 'Output results url file. The result of stage "submit". By default, it creates a output result url file in the output dir: "output_dir + gene.lower() + _result_urls.txt")
# stage: get, intermediate mcsm output file
arg_parser.add_argument('--outfile_scraped', help = 'Output mcsm results scraped. The result of stage "get". By default, it creates an interim output file in the output dir: "output_dir + gene.lower() +_mcsm_output.csv")
# stage: format, formatted output with scaled values, etc
# FIXME: Don't call this stage until you have ALL the interim results for your snps as the normalisation will be affected!
arg_parser.add_argument('--outfile_formatted', help = 'Output mcsm results formatted. The result of stage "format". By default, it creates a formatted output file in the output dir: "output_dir + gene.lower() + _complex_mcsm_norm.csv")
arg_parser.add_argument('--debug', action='store_true', help = 'Debug Mode')
args = arg_parser.parse_args()
@ -41,6 +53,11 @@ chain = args.chain
ligand = args.ligand
affinity = args.affinity
pdb_filename = args.pdb_file
mutation_filename = args.mutation_file
result_urls = args.url_file
mcsm_output = args.outfile_scraped
outfile_format = args.outfile_formatted
datadir = args.datadir
indir = args.input_dir
@ -80,29 +97,39 @@ else:
infile_pdb = indir + '/' + in_filename_pdb
in_filename_snps = gene.lower() + '_mcsm_snps.csv' #(outfile_mcsm_snps, from data_extraction.py)
#in_filename_snps = gene.lower() + '_mcsm_snps.csv' #(outfile_mcsm_snps, from data_extraction.py)
#infile_snps = outdir + '/' + in_filename_snps
if mutation_filename:
in_filename_snps = mutation_filename
else:
in_filename_snps = gene.lower() + '_mcsm_snps.csv'
infile_snps = outdir + '/' + in_filename_snps
#=======
# output
#=======
# mcsm_results globals
result_urls_filename = gene.lower() + '_result_urls.txt'
result_urls = outdir + '/' + result_urls_filename
if DEBUG:
print('DEBUG: Result URLs:', result_urls)
if not result_url:
result_urls_filename = gene.lower() + '_result_urls.txt'
result_urls = outdir + '/' + result_urls_filename
if DEBUG:
print('DEBUG: Result URLs:', result_urls)
mcsm_output_filename = gene.lower() + '_mcsm_output.csv'
mcsm_output = outdir + '/' + mcsm_output_filename
if DEBUG:
print('DEBUG: mCSM output CSV file:', mcsm_output)
if not mcsm_output:
mcsm_output_filename = gene.lower() + '_mcsm_output.csv'
mcsm_output = outdir + '/' + mcsm_output_filename
if DEBUG:
print('DEBUG: mCSM output CSV file:', mcsm_output)
# format_results globals
#out_filename_format = gene.lower() + '_mcsm_processed.csv'
out_filename_format = gene.lower() + '_complex_mcsm_norm.csv'
outfile_format = outdir + '/' + out_filename_format
if DEBUG:
print('DEBUG: formatted CSV output:', outfile_format)
if not outfile_format:
out_filename_format = gene.lower() + '_complex_mcsm_norm.csv'
outfile_format = outdir + '/' + out_filename_format
if DEBUG:
print('DEBUG: formatted CSV output:', outfile_format)
#%%=====================================================================
def submit_mcsm():
# Example:

View file

@ -39,7 +39,7 @@ arg_parser.add_argument('--datadir', help = 'Data Directory. By default, it assm
arg_parser.add_argument('-i', '--input_dir', help = 'Input dir containing pdb files. By default, it assmumes homedir + <drug> + input')
arg_parser.add_argument('-o', '--output_dir', help = 'Output dir for results. By default, it assmes homedir + <drug> + output')
arg_parser.add_argument('--debug', action ='store_true', help = 'Debug Mode')
arg_parser.add_argument('--debug', action ='store_true', help = 'Debug Mode') # not used atm
args = arg_parser.parse_args()
#%% variable assignment: input and output
@ -68,7 +68,8 @@ if not outdir:
#=======
# input
#=======
in_filename = 'merged_df3.csv'
#in_filename = 'merged_df3.csv'
in_filename = gene.lower() + '_complex_mcsm_norm.csv'
infile_merged_df3 = outdir + '/' + in_filename
print('Input file: ', infile_merged_df3
, '\n============================================================')