Commit 7ea6c9a6 authored by Marc's avatar Marc
Browse files

integrated "-l" and "-i" mode in the new nextflow workflow; nextflow config...

integrated "-l" and "-i" mode in the new nextflow workflow; nextflow config generation does not merge redudant process descriptions anymore due bugfixing
parent 0025df27
......@@ -67,10 +67,10 @@ convert_live_template = Template ('''
process convert_${id}_to_json {
input:
file result from ${id}_results
set file(result), file(headers) from ${id}_results
output:
file "$${result}.json" into ${id}_json, ${id}_json_live
set file("$${result}.json"), file(headers) into ${id}_restore_headers
script:
"""
......@@ -78,14 +78,31 @@ process convert_${id}_to_json {
"""
}
''')
restore_headers_json_live_template = Template('''
process ${id}_restore_headers_json {
input:
set file(result), file(headers) from ${id}_restore_headers
output:
file "$${result.baseName}_restored_headers.json" into ${id}_json, ${id}_json_live
script:
"""
${helpers_path}/restore_seq_id_from_enumeration.py -j $$result -e $$headers
"""
}
''')
convert_info_template = Template ('''
process convert_${id}_to_json {
input:
file result from ${id}_results
set file(result), file(headers) from ${id}_results
output:
file "$${result}.json" into ${id}_json_info
set file("$${result}.json"), file(headers) into ${id}_restore_headers
script:
"""
......@@ -93,6 +110,23 @@ process convert_${id}_to_json {
"""
}
''')
restore_headers_json_info_template = Template('''
process ${id}_restore_headers_json {
input:
set file(result), file(headers) from ${id}_restore_headers
output:
file "$${result.baseName}_restored_headers.json" into ${id}_json_info
script:
"""
${helpers_path}/restore_seq_id_from_enumeration.py -j $$result -e $$headers
"""
}
''')
convert_template = Template ('''
process convert_${id}_to_json {
......@@ -198,7 +232,7 @@ analysis_config_template = Template('''
'''
)
beforeScript_modul_config_template = Template('''
withName:${process_names}{
withName:${process_name}{
${beforeScript}
}
'''
......@@ -257,23 +291,25 @@ def generate_nextflow_script(execution):
for m in modules:
config = flatten(m)
config['output'] = execution['output']
config['helpers_path'] = execution['helpers_path']
fragments.append(analysis_template.substitute(config))
if execution['mode'] == 'live' and not execution['fetch_informations']:
fragments.append(convert_live_template.substitute(config))
fragments.append(restore_headers_json_live_template.substitute(config))
fragments.append(live_results_template.substitute(config))
elif execution['mode'] == 'live' and execution['fetch_informations']:
fragments.append(convert_info_template.substitute(config))
fragments.append(restore_headers_json_info_template.substitute(config))
fragments.append(retrieve_informations_live_template.substitute(config))
fragments.append(live_results_template.substitute(config))
elif execution['mode'] == 'complete' and execution['fetch_informations']:
fragments.append(convert_info_template.substitute(config))
fragments.append(restore_headers_json_info_template.substitute(config))
fragments.append(retrieve_informations_template.substitute(config))
else:
fragments.append(convert_template.substitute(config))
config['helpers_path'] = execution['helpers_path']
fragments.append(restore_headers_json_template.substitute(config))
fragments.append(restore_headers_json_template.substitute(config))
json_inputs = []
for m in modules:
......@@ -320,12 +356,14 @@ def generate_nextflow_config(execution):
config['beforeScript'] = "beforeScript = 'export PS1=; source " + execution['venv'] + "/bin/activate'"
if execution['fetch_informations']:
config['process_names'] = "'" + Template('convert_${id}_to_json|${id}_restore_headers_json|retrieve_informations_for_${id}').substitute(config) + "'"
process_names_list = Template('convert_${id}_to_json|${id}_restore_headers_json|retrieve_informations_for_${id}').substitute(config).split('|')
else:
config['process_names'] = "'" + Template('convert_${id}_to_json|${id}_restore_headers_json').substitute(config) + "'"
process_names_list = Template('convert_${id}_to_json|${id}_restore_headers_json').substitute(config).split('|')
fragments.append(analysis_config_template.substitute(config))
fragments.append(beforeScript_modul_config_template.substitute(config))
for process in process_names_list:
config['process_name'] = process
fragments.append(beforeScript_modul_config_template.substitute(config))
else:
config['beforeScript'] = ''
fragments.append(analysis_config_template.substitute(config))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment