diff --git a/src/workflow.py b/src/workflow.py index 36e6c96df0bdf7c531369dd081cef53837afb450..ace12feb9bab0e7c5f6d07fd469ab764892cbeea 100644 --- a/src/workflow.py +++ b/src/workflow.py @@ -444,9 +444,17 @@ George Marchment, Bryan Brancotte, Marie Schmit, Frédéric Lemoine, Sarah Cohen to_replace = [] for match in re.finditer(constant.FULL_INLCUDE_2, code): to_replace.append(match.group(0)) - for r in to_replace: - code = code.replace(r, ankers) - ankers = "" + + if(to_replace==[]): + pos_start = 0 + start_code_pattern = r"\#\!\s*\/usr\/bin\/env\s+nextflow" + for match in re.finditer(start_code_pattern, code): + pos_start = match.span(0)[1]+1 + code = code[:pos_start]+ankers+code[pos_start:] + else: + for r in to_replace: + code = code.replace(r, ankers) + ankers = "" processes, subworkflows, functions = [], [], []