diff --git a/src/process.py b/src/process.py index a90467469e230efa31a814e8f4d910d5a559a0b3..83b0ef4e84185a759bbfbf6c19a1aa9246450a5c 100644 --- a/src/process.py +++ b/src/process.py @@ -602,13 +602,20 @@ class Process(Nextflow_Building_Blocks): for match in re.finditer(r"(\w+) mode flatten", code): channels.append(match.group(1)) return channels + + #This method cleans the raw_input_names to use when rewriting DSL1 workflows + def clean_raw_input_names(self, raw_input_names): + for i in range(len(raw_input_names)): + if(bool(re.fullmatch(r"\w+\.val", raw_input_names[i]))): + raw_input_names[i] = raw_input_names[i].split('.')[0] + return raw_input_names def convert_to_DSL2(self): if(self.get_DSL()=="DSL2"): print("Workflow is already written in DSL2") else: code = self.get_code() - call = [f"{self.get_name()}({', '.join(self.raw_input_names)})"] + call = [f"{self.get_name()}({', '.join(self.clean_raw_input_names(self.raw_input_names))})"] code = code.replace(self.input_code, self.convert_input_code_to_DSL2()) code = code.replace(self.output_code, self.convert_output_code_to_DSL2()) channels_to_flatten = self.get_channels_to_flatten()