From 6ec7a47e8a20fffe41af9b30835e672ba8b96144 Mon Sep 17 00:00:00 2001
From: George Marchment <georgemarchment@yahoo.fr>
Date: Thu, 24 Apr 2025 10:16:54 +0200
Subject: [PATCH] small update to get the generation of the relevant processes
 to work + removed the creation of empty channels in the case of false
 condition for the call of the clusters

---
 src/workflow.py | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/src/workflow.py b/src/workflow.py
index 0cbfb61..b673fc2 100644
--- a/src/workflow.py
+++ b/src/workflow.py
@@ -527,6 +527,8 @@ George Marchment, Bryan Brancotte, Marie Schmit, Frédéric Lemoine, Sarah Cohen
                     for t in tools:
                         try:
                             val = tool_2_nb_usage[t]
+                            if(t in ['python', 'r', 'perl', 'julia']):#Cause in this case it is a custom script -> one should hope that it is important in this case
+                                val = 1
                         except:
                             val = 1
                         if(val<min_value):
@@ -1446,9 +1448,11 @@ George Marchment, Bryan Brancotte, Marie Schmit, Frédéric Lemoine, Sarah Cohen
                             #If the tools have been extracted they can be used to name the none relevant processes
                             if(extract_tools):
                                 for p in processes_added:
-                                    for t in p.get_code():
+                                    for t in p.get_tools():
                                         try:
                                             val = tool_2_nb_usage[t]
+                                            if(t in ['python', 'r', 'perl', 'julia']):#Cause in this case it is a custom script -> one should hope that it is important in this case
+                                                val = 1
                                         except:
                                             val = 1
                                         if(val<min_tool):
@@ -1560,7 +1564,10 @@ George Marchment, Bryan Brancotte, Marie Schmit, Frédéric Lemoine, Sarah Cohen
                     #If there was only one single condition in the subworkflow cluster -> then we add it when the call is done
                     if(len(conditions_in_subworkflow)==1):
                         #TODO -> i think the case "else" -> needs to be removed cause sometimes the the empty channel created may overwrite an existing one
-                        subworkfow_call = f"if({conditions_in_subworkflow[0].split('$$__$$')[0]}) {{\n{subworkfow_call_case_true}\n}} else {{\n{subworkfow_call_case_false}\n}}"
+                        #OG
+                        #subworkfow_call = f"if({conditions_in_subworkflow[0].split('$$__$$')[0]}) {{\n{subworkfow_call_case_true}\n}} else {{\n{subworkfow_call_case_false}\n}}"
+                        #New 
+                        subworkfow_call = f"if({conditions_in_subworkflow[0].split('$$__$$')[0]}) {{\n{subworkfow_call_case_true}\n}}"                    
                     else:
                         subworkfow_call = subworkfow_call_case_true
 
-- 
GitLab