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

Updated the identification of the scripts within a process + added a merge operator

parent df4699c7
No related branches found
No related tags found
No related merge requests found
Pipeline #14483 failed with stage
in 2 minutes and 49 seconds
...@@ -109,7 +109,7 @@ DOUBLE_DOT_TUPLE = r"\(\s*\w+\s*(,\s*\w+\s*)+\)\s*=\s*([^\?\n]+)\s*\?([^\n]+)" ...@@ -109,7 +109,7 @@ DOUBLE_DOT_TUPLE = r"\(\s*\w+\s*(,\s*\w+\s*)+\)\s*=\s*([^\?\n]+)\s*\?([^\n]+)"
END_OPERATOR = r' *(\(|{)' END_OPERATOR = r' *(\(|{)'
ILLEGAL_CHARCTER_BEFORE_POTENTIAL_CHANNELS = r"\w|\'|\"|\." ILLEGAL_CHARCTER_BEFORE_POTENTIAL_CHANNELS = r"\w|\'|\"|\."
ILLEGAL_CHARCTER_AFTER_POTENTIAL_CHANNELS = r"\w" ILLEGAL_CHARCTER_AFTER_POTENTIAL_CHANNELS = r"\w"
MERGE_OPERATIONS = r'\.\s*((merge|mix|concat|spread|join|phase|cross|combine|fromList|collect|fromPath|value|from|map)\s*(\(|\{))'#I've added map to this list cause channels can appear in map can concatenating channels -> it's a strange way of doing it MERGE_OPERATIONS = r'\.\s*((merge|mix|concat|spread|join|phase|cross|combine|fromList|collect|fromPath|value|from|map|fromFilePairs)\s*(\(|\{))'#I've added map to this list cause channels can appear in map can concatenating channels -> it's a strange way of doing it
OPERATOR_IN_PIPE = r"\w+ *{[^}]*}|\w+ *\([^\)]*\)|\w+" OPERATOR_IN_PIPE = r"\w+ *{[^}]*}|\w+ *\([^\)]*\)|\w+"
SET_OPERATORS = ["choice", "separate", "tap", "into", "set"] SET_OPERATORS = ["choice", "separate", "tap", "into", "set"]
TUPLE_EQUALS = r'\( *\w+( *, *\w+)+ *\) *=\s*(\w+)\s*\.' TUPLE_EQUALS = r'\( *\w+( *, *\w+)+ *\) *=\s*(\w+)\s*\.'
...@@ -131,7 +131,7 @@ INTO = r'into +([\w, ]+)' ...@@ -131,7 +131,7 @@ INTO = r'into +([\w, ]+)'
INTO_2 = r'into +\(?( *\w+ *(, *\w+)*) *\)?' INTO_2 = r'into +\(?( *\w+ *(, *\w+)*) *\)?'
OUTPUT = r"\n\s*output *:" OUTPUT = r"\n\s*output *:"
PROCESS_HEADER = r'process\s+(\w+|\'[\w ]+\'|\"[\w ]+\")\s*{' PROCESS_HEADER = r'process\s+(\w+|\'[\w ]+\'|\"[\w ]+\")\s*{'
SCRIPT = r"\n\s*script *:|shell *:|exec *:|\"\"\"|\'\'\'" SCRIPT = r"\n\s*script *:|shell *:|exec *:|\"\"\"\s|\'\'\'\s"
WHEN = r"\n\s*when *:" WHEN = r"\n\s*when *:"
......
...@@ -419,6 +419,8 @@ class Process(Nextflow_Building_Blocks): ...@@ -419,6 +419,8 @@ class Process(Nextflow_Building_Blocks):
self.name = match.group(1) self.name = match.group(1)
self.name = self.name.replace("'", "") self.name = self.name.replace("'", "")
self.name = self.name.replace('"', '') self.name = self.name.replace('"', '')
if(self.name=="process"):
raise Exception("Process is names 'process'")
if(self.alias==""): if(self.alias==""):
self.alias = self.name self.alias = self.name
self.printed_name = self.alias self.printed_name = self.alias
...@@ -512,9 +514,17 @@ class Process(Nextflow_Building_Blocks): ...@@ -512,9 +514,17 @@ class Process(Nextflow_Building_Blocks):
code = self.get_code() code = self.get_code()
call = [f"{self.get_name()}({self.get_parameters_call()})"] call = [f"{self.get_name()}({self.get_parameters_call()})"]
if(self.input_code!=""): if(self.input_code!=""):
temp = code
code = code.replace(self.input_code, self.convert_input_code_to_DSL2()) code = code.replace(self.input_code, self.convert_input_code_to_DSL2())
if(temp==code):
raise Exception("This souldn't happen")
if(self.output_code!=""): if(self.output_code!=""):
temp = code
code = code.replace(self.output_code, self.convert_output_code_to_DSL2()) code = code.replace(self.output_code, self.convert_output_code_to_DSL2())
if(temp==code):
print(f'"{self.output_code}"')
print(f'"{self.convert_output_code_to_DSL2()}"')
raise Exception("This souldn't happen")
channels_to_flatten = self.get_channels_to_flatten() channels_to_flatten = self.get_channels_to_flatten()
......
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