added submit_def.py with example to run batch of 50
This commit is contained in:
parent
91f214f014
commit
e67a716d82
2 changed files with 144 additions and 3 deletions
|
@ -44,7 +44,7 @@ out_url_file = dynamut_temp_dir + '/dynamut_result_url_batch_' + str(batch_no) +
|
|||
|
||||
|
||||
#%% request calculation (no def)
|
||||
with open("/home/tanu/git/Data/streptomycin/input/gid_complex.pdb", "rb") as pdb_file, open ("/home/tanu/git/LSHTM_analysis/dynamut/snp_test2.csv") as mutation_list:
|
||||
with open("/home/tanu/git/Data/streptomycin/input/gid_complex.pdb", "rb") as pdb_file, open ("/home/tanu/git/LSHTM_analysis/dynamut/snp_test2.csv", "rb") as mutation_list:
|
||||
files = {"wild": pdb_file
|
||||
, "mutation_list": mutation_list}
|
||||
body = {"chain": 'A'
|
||||
|
@ -57,6 +57,7 @@ with open("/home/tanu/git/Data/streptomycin/input/gid_complex.pdb", "rb") as pdb
|
|||
url_match = re.search('/dynamut/results_prediction/.+(?=")', response.text)
|
||||
url = host + url_match.group()
|
||||
print(url)
|
||||
|
||||
#===============
|
||||
# writing file: result urls
|
||||
#===============
|
||||
|
@ -90,7 +91,31 @@ def request_calculation(pdb_file, mutation_list
|
|||
@param prediction_url: dynamut url for prediction
|
||||
@type string
|
||||
|
||||
@return response object
|
||||
@type object
|
||||
@return txt file containing batch no. of snps processed
|
||||
@type string
|
||||
"""
|
||||
|
||||
with open(pdb_file, "rb") as pdb_file, open (mutation_list) as mutation_list:
|
||||
files = {"wild": pdb_file
|
||||
, "mutation_list": mutation_list}
|
||||
body = {"chain": 'A'
|
||||
, "email": 'tanushree.tunstall@lshtm.ac.uk'}
|
||||
|
||||
response = requests.post(prediction_url, files = files, data = body)
|
||||
print(response.status_code)
|
||||
if response.history:
|
||||
print('PASS: valid mutation submitted. Fetching result url')
|
||||
url_match = re.search('/dynamut/results_prediction/.+(?=")', response.text)
|
||||
url = host + url_match.group()
|
||||
print(url)
|
||||
|
||||
#===============
|
||||
# writing file: result urls
|
||||
#===============
|
||||
out_url_file = dynamut_temp_dir + '/dynamut_result_url_batch_' + str(batch_no) + '.txt'
|
||||
print('Writing output url file:', out_url_file)
|
||||
myfile = open(out_url_file, 'a')
|
||||
myfile.write(url)
|
||||
myfile.close()
|
||||
#====================
|
||||
# Submit first batch
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue