Skip to content
Snippets Groups Projects
Commit 2ca08574 authored by George Marchment's avatar George Marchment
Browse files

Added functions to DSL2

parent 78b85f99
No related branches found
No related tags found
No related merge requests found
Pipeline #14239 failed with stage
in 2 minutes and 14 seconds
......@@ -626,10 +626,11 @@ George Marchment, Bryan Brancotte, Marie Schmit, Frédéric Lemoine, Sarah Cohen
include_section = f"//INCLUDE_SECTION_{tag}"
params_section = f"//PARAMS_SECTION_{tag}"
function_section = f"//FUNCTION_SECTION_{tag}"
process_section = f"//PROCESS_SECTION_{tag}"
code = code.replace(code_to_replace, f"""{start_code}\n\n{include_section}\n\n{params_section}\n\n{process_section}\n\nworkflow{{\n\n{body}\n}}\n\n""")
code = code.replace(code_to_replace, f"""{start_code}\n\n\n{include_section}\n\n\n{params_section}\n\n\n{function_section}\n\n\n{process_section}\n\n\nworkflow{{\n\n{body}\n}}\n\n""")
params_list = []
for match in re.finditer(r"params.\w+ *\= *[^\n=]([^\n])*", code):
......@@ -638,8 +639,21 @@ George Marchment, Bryan Brancotte, Marie Schmit, Frédéric Lemoine, Sarah Cohen
code = code.replace(params, "")
params_code = "\n".join(params_list)
code = code.replace(params_section, params_code)
#Moving Functions
functions = []
for f in self.nextflow_file.functions:
function = f.get_code()
functions.append(function)
for r in functions:
code = code.replace(r, "")
code = code.replace(function_section, "\n\n".join(functions))
#Moving Processes
processes = []
to_replace = []
for p in self.nextflow_file.get_processes():
......@@ -659,6 +673,7 @@ George Marchment, Bryan Brancotte, Marie Schmit, Frédéric Lemoine, Sarah Cohen
else:
raise Exception(f"Executor of type '{o.get_type()}' was extracted in a DSL1 workflow! This shoudn't happen! The code is '{o.get_code()}'")
#print(code)
return code
#print(code)
#
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment