From fe5ce40f710e797ee262fe638127d3372bf14e15 Mon Sep 17 00:00:00 2001 From: George Marchment <georgemarchment@yahoo.fr> Date: Tue, 18 Feb 2025 09:52:13 +0100 Subject: [PATCH] Fixed some errors --- src/outils.py | 2 ++ src/subworkflow.py | 6 ++---- src/workflow.py | 34 ++-------------------------------- 3 files changed, 6 insertions(+), 36 deletions(-) diff --git a/src/outils.py b/src/outils.py index f1bb04f..4337c1a 100644 --- a/src/outils.py +++ b/src/outils.py @@ -1318,6 +1318,7 @@ def get_channels_to_add_in_false_conditions(body, emitted_channels): to_remove = [] for condition in tab: #If the condition and it's neagtion are in the tab -> then we remove the condition and it's negation form the list + condition = condition.split("$$__$$")[0] negation = f"!({condition})" if(negation in tab): to_remove.append(condition) @@ -1328,6 +1329,7 @@ def get_channels_to_add_in_false_conditions(body, emitted_channels): #For the remaining condition in the list -> need to create an empty channel in the case of the negation for condition in channels_2_conditions[channel]: + condition = condition.split("$$__$$")[0] body += f"\nif(!({condition})) {{\n{channel} = Channel.empty()\n}}" return body diff --git a/src/subworkflow.py b/src/subworkflow.py index ee80322..c132338 100644 --- a/src/subworkflow.py +++ b/src/subworkflow.py @@ -64,12 +64,10 @@ class Subworkflow(Main): for c in call.get_all_calls(): if(c.first_element_called.get_alias()==name): tab.append(c) - - #Here it is important that BioFlow-Insight is not a Nextflow verificator #Here i'm checking the call inside the block - if(len(tab)!=0): - for c in self.root.get_calls_inside_level(): + if(len(tab)==0): + for call in self.root.get_calls_inside_level(): #call.initialise() for c in call.get_all_calls(): if(c.first_element_called.get_alias()==name): diff --git a/src/workflow.py b/src/workflow.py index fe2baf4..24b72fc 100644 --- a/src/workflow.py +++ b/src/workflow.py @@ -544,39 +544,9 @@ George Marchment, Bryan Brancotte, Marie Schmit, Frédéric Lemoine, Sarah Cohen param = parameters[i] takes = subworkflow_takes[i].get_gives()[0] #Here we're checking that the input inside and outside the subworkflow are the same - #If they are we're going to remove everything to avoid the case - - """ - param_1 = fastq - sub(param_1) - - AND in the subworkflow - - sub{ - take: - fastq - } - ---------- - This would mean when removing the subworkflow def -> we would get this: - - param_1 = fastq - fastq = param_1 - """ - #Obviously we want to avoid this case - input_val = "" - try: - input_val = param.origins[0].get_source()[0].get_origins()[0].get_name() - except: - input_val = param.get_code(get_OG = True) - if(takes.get_code()!=input_val): + if(takes.get_code()!=param.get_code(get_OG = True)): new_header+=f"{takes.get_code()} = {param.get_code(get_OG = True)}" - else: - #In the case they are the same -> we remove the remaining operation (which doesn't serve a purpose) - #The "param_1 = fastq" operation - operation_code = param.origins[0].get_source()[0].get_code() - code = code.replace(operation_code, "", 1) - - + code = code.replace(OG_call.get_code(get_OG = True), f"{new_header}\n\n{OG_body}", 1) #REPLACE THE EMITS -- GitLab