From dc3e33c080edc3e08293b862f4e85eeb5f1ba2b2 Mon Sep 17 00:00:00 2001
From: George Marchment <georgemarchment@yahoo.fr>
Date: Thu, 17 Apr 2025 15:27:55 +0200
Subject: [PATCH] Adding filter no processes + adding pipe support for
 rewritting maps

---
 src/code_.py    | 2 +-
 src/workflow.py | 4 +++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/code_.py b/src/code_.py
index ce88418..0213fc4 100644
--- a/src/code_.py
+++ b/src/code_.py
@@ -137,7 +137,7 @@ class Code:
             #TODO -> do the same with flatMap -> 668
             for word in ["map", "flatMap"]:
                 for end_char in ['{', '\(']:
-                    pattern = fr"\.\s*"+word+r"\s*"+end_char
+                    pattern = fr"(\.|\|)\s*"+word+r"\s*"+end_char
                     for match in re.finditer(pattern, code):
                         start_map, end = match.span(0)
                         if(end_char=="{"):
diff --git a/src/workflow.py b/src/workflow.py
index 976170d..724d5a1 100644
--- a/src/workflow.py
+++ b/src/workflow.py
@@ -1079,7 +1079,9 @@ George Marchment, Bryan Brancotte, Marie Schmit, Frédéric Lemoine, Sarah Cohen
                 code = self.simplify_workflow_code()
                 self.rewrite_and_initialise(code, self.processes_2_remove, render_graphs=render_graphs)
                     
-            
+            if(len(self.get_processes_called())==0):
+                raise BioFlowInsightError("There are no process calls in the workflow. BioFlow-Insight cannot rewrite the workflow in this case.", type="Rewrite Error")
+
             #DETERMING WHICH SUBWORKFLOWS ARE BROKEN WITH THE CLUSTER
             def get_clusters_with_calls(clusters):
                 #Creating the clusters with calls instead of processes or subworkflows
-- 
GitLab