Skip to content
Snippets Groups Projects
Commit 53f588fd authored by George Marchment's avatar George Marchment
Browse files

Fixed: placing the call of a subworkflow outside of conditions

parent fec4dbd5
No related branches found
No related tags found
No related merge requests found
Pipeline #14389 failed with stage
in 2 minutes and 30 seconds
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
from .nextflow_file import Nextflow_File from .nextflow_file import Nextflow_File
from .ro_crate import RO_Crate from .ro_crate import RO_Crate
from . import constant from . import constant
from .outils import is_git_directory, format_with_tabs, replace_thing_by_call, replace_group1, group_together_ifs, extract_curly, remove_extra_jumps, get_channels_to_add_in_false_conditions from .outils import is_git_directory, format_with_tabs, replace_thing_by_call, replace_group1, group_together_ifs, extract_curly, remove_extra_jumps, get_channels_to_add_in_false_conditions, extract_conditions
from .outils_graph import flatten_dico, initia_link_dico_rec, get_number_cycles from .outils_graph import flatten_dico, initia_link_dico_rec, get_number_cycles
from .outils_annotate import get_tools_commands_from_user_for_process from .outils_annotate import get_tools_commands_from_user_for_process
from .bioflowinsighterror import BioFlowInsightError from .bioflowinsighterror import BioFlowInsightError
...@@ -978,9 +978,25 @@ George Marchment, Bryan Brancotte, Marie Schmit, Frédéric Lemoine, Sarah Cohen ...@@ -978,9 +978,25 @@ George Marchment, Bryan Brancotte, Marie Schmit, Frédéric Lemoine, Sarah Cohen
#Replace the ankers by the calls of the subworkflows #Replace the ankers by the calls of the subworkflows
for i in range(len(subworkflow_clusters_to_add)): for i in range(len(subworkflow_clusters_to_add)):
code = code.replace(f"//Anker_cluster{i}", subworkflow_cluster_calls_to_add[i]) #Extracting the conditions in the code
conditions_in_code = extract_conditions(code)
anker = f"//Anker_cluster{i}"
pos_anker = code.find(anker)
#For each anker get the condition in which it is called
#Cause we do not want the call of the subworkflows to be done in a condition
#So around the call we place ""}} call if(){if(){"" -> so it's executed ouside of a condition
conditions_for_anker = []
for c in conditions_in_code:
if(conditions_in_code[c][0]<pos_anker and pos_anker <conditions_in_code[c][1]):
conditions_for_anker.append(c.split("$$__$$")[0])
#Placing the extract curlies around it
subworkflow_call = subworkflow_cluster_calls_to_add[i]
for c in conditions_for_anker:
subworkflow_call = f"\n}}\n{subworkflow_call}\nif({c}){{\n"
code = code.replace(anker, subworkflow_call)
for old, new in channels_to_replace_outside_of_cluster: for old, new in channels_to_replace_outside_of_cluster:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment