Skip to content
Snippets Groups Projects
Commit 49beb200 authored by Hottlet Valentin's avatar Hottlet Valentin
Browse files

Refactor peptide handling and add digestion configuration support

parent f08c03fe
No related branches found
No related tags found
1 merge request!8Tests docker
......@@ -21,7 +21,7 @@ def extract_request(form):
#Options et methodes:
taxonomy = ["fillin", "homology"]
pconfig = ["fillin", "allpeptides", "selection", "deamidation"]
pconfig = ["fillin", "allpeptides"]
spectre = ["allpeptides", "selection"]
error_found = False
......@@ -53,6 +53,12 @@ def extract_request(form):
elif method == "fillin":
extract_files_from_list([common.FILLIN_PEPTIDE], resdir)
req["peptides_path"] = resdir + '/' + "fillin_peptides.tsv"
elif method == "selection":
extract_files_from_list([common.SELECTION_PEPTIDE], resdir)
req["peptides_path"] = resdir + '/' + "selection_peptides.tsv"
elif method == "deamidation":
extract_files_from_list([common.DEAMIDATION_PEPTIDE], resdir)
req["peptides_path"] = resdir + '/' + "deamidation_peptides.tsv"
elif 'peptides_file' in form and form['peptides_file'].filename != "":
f = form['peptides_file'].filename
fn = os.path.basename(f)
......@@ -126,7 +132,10 @@ def extract_request(form):
extract_error_margin(form, log, req, error_messages)
if method in spectre:
if 'spectra_files' in form:
if 'craft-example' in form and method == "selection":
extract_files_from_list([common.SELECTION_SPECTRA], abs_spectra_dir)
req['spectra_dir'] = abs_spectra_dir
elif 'spectra_files' in form:
# spectres utilisateurs
fileitems = form['spectra_files']
if not isinstance(fileitems, list):
......@@ -153,13 +162,18 @@ def extract_request(form):
extract_taxonomy_selection(form, log, req, error_messages, resdir)
if method in pconfig:
if form["digestion"].value != "" and form["digestion"].value != "Trypsin":
if form["digestion"].value != "" and form["digestion"].value != "trypsin":
digestion = form["digestion"].value
else:
digestion = None
if digestion:
req["config"] = digestion
with open(f'{common.CONFIG_FILE}', 'r') as f:
data = json.load(f)
data['enzyme'] = digestion
json.dump(data, open(f'{resdir}/config.json', 'w'))
log.write(f"Digestion set to {digestion}\n")
req['config_file'] = resdir + '/config.json'
log.write("Recap downloads :\n")
for fn in req['files_uploaded']:
......@@ -199,6 +213,9 @@ def launch_software(run_id, req):
if 'taxo_file' in req:
taxo_file_arg = req["taxo_file"]
command += " -t " + taxo_file_arg
if 'config_file' in req:
config_file_arg = req["config_file"]
command += " -c " + config_file_arg
command += " --web"
open("acommand.txt", "w").write(f"{command}") # log
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment