From a560b381bef30685841fb29f6cd965fca59b092c Mon Sep 17 00:00:00 2001
From: George Marchment <georgemarchment@yahoo.fr>
Date: Mon, 13 Jan 2025 14:36:06 +0100
Subject: [PATCH] Fix : remove the channel.val when using channels -> example
 in "isugifNF/blast"

---
 src/process.py | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/process.py b/src/process.py
index a904674..83b0ef4 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()
-- 
GitLab