From 27db03f0553af431cb1726f2fc9d1be4e1f62288 Mon Sep 17 00:00:00 2001
From: George Marchment <georgemarchment@yahoo.fr>
Date: Thu, 13 Mar 2025 12:02:39 +0100
Subject: [PATCH] Update bug with the pipe opaerator -> it wasn't the OG code
 for calls

---
 src/call.py      |  3 ++-
 src/executor.py  |  4 +++-
 src/operation.py | 10 +++++-----
 3 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/src/call.py b/src/call.py
index 1fdeae7..adbf2ca 100644
--- a/src/call.py
+++ b/src/call.py
@@ -58,7 +58,8 @@ class Call(Executor):
                 return self.code.get_code()
             return self.OG_code
         if(clean_pipe):
-            return self.clean_pipe_operator(self.code.get_code())
+            code, _ = self.clean_pipe_operator(self.code.get_code())
+            return code
         else:
             return self.code.get_code()
     
diff --git a/src/executor.py b/src/executor.py
index 0f7c6a7..d276bc0 100644
--- a/src/executor.py
+++ b/src/executor.py
@@ -152,6 +152,7 @@ class Executor(Nextflow_Building_Blocks):
             to_call.append(m.get_alias())
         searching = True
         to_replace = []
+        OG_pipe = pipe.strip()
         while(searching):
             if(pipe.find('|')==-1):
                 searching=False
@@ -207,7 +208,8 @@ class Executor(Nextflow_Building_Blocks):
             pipe = pipe.replace(tag, '|')
         for tag in to_replace_double_pipe:
             pipe = pipe.replace(tag, '||')
-        return (head+pipe).replace(str(self), '|', 1)
+        new_pipe = (pipe).replace(str(self), '|', 1).strip()
+        return (head+pipe).replace(str(self), '|', 1), {new_pipe: OG_pipe}
     
     
     #This method analyses if the executor if an operation or a call, and returns
diff --git a/src/operation.py b/src/operation.py
index ce7fd7d..624a630 100644
--- a/src/operation.py
+++ b/src/operation.py
@@ -674,7 +674,7 @@ class Operation(Executor):
         
 
         if(clean_pipe):
-            code = self.clean_pipe_operator(code)
+            code, self.dico_OG_call_2_new_call = self.clean_pipe_operator(code)
   
         if(replace_calls):
             for call in self.calls:
@@ -713,11 +713,10 @@ class Operation(Executor):
         for m in self.get_modules_defined():
             to_call.append(m.get_alias())
         pattern_call = constant.BEGINNING_CALL
-        searching = True
+        searching = True        
+        text = " "+self.get_code(clean_pipe = clean_pipe)
         while(searching):
             searching= False
-            text = " "+self.get_code(clean_pipe = clean_pipe)
-            
             for c in self.calls:
                 text = text.replace(self.calls[c].get_code(), "")
             for match in re.finditer(pattern_call, text):
@@ -726,7 +725,8 @@ class Operation(Executor):
                     #We do this cause the first caracter is a " "
                     start+=1
                     searching=True
-                    call = Call(code =get_end_call(text, start, end), origin =self)
+                    call_code = get_end_call(text, start, end)
+                    call = Call(code =call_code, origin =self, OG_code=self.dico_OG_call_2_new_call[call_code])
                     call.initialise()
                     self.calls[str(call)] = call
                     break
-- 
GitLab