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

Update the "get_code" fnction for operations -> when the option 'get_OG' is...

Update the "get_code" fnction for operations ->  when the option 'get_OG' is true -> it remove the added "e:" or "t:" + updated the detection of the duplicates to only consider operations (since calls are renamed anyway)
parent 55d474f5
No related branches found
No related tags found
No related merge requests found
Pipeline #14523 failed with stage
in 2 minutes and 12 seconds
...@@ -20,8 +20,9 @@ class Main(Nextflow_Building_Blocks): ...@@ -20,8 +20,9 @@ class Main(Nextflow_Building_Blocks):
pos = {} pos = {}
for e in executors: for e in executors:
code = e.get_code(get_OG = True) code = e.get_code(get_OG = True)
if(code in seen): #We don't have to check the calls -> since there are renamed with their ids when we rewrite the code -> so it solve the issue
raise BioFlowInsightError(f'Executor "{code}" appears twice in the workflow in the exact same way. BioFlow-Insight cannot rewrite the workflow then, try slighly changing how one of the executors is defined') if(code in seen and e.get_type()=="Operation"):
raise BioFlowInsightError(f'Operation "{code}" appears twice in the workflow in the exact same way. BioFlow-Insight cannot rewrite the workflow then, try slighly changing how one of the executors is defined')
seen[code] = '' seen[code] = ''
pos[e] = e.get_position_in_main(e) pos[e] = e.get_position_in_main(e)
#TODO add sort here #TODO add sort here
...@@ -54,12 +55,13 @@ class Main(Nextflow_Building_Blocks): ...@@ -54,12 +55,13 @@ class Main(Nextflow_Building_Blocks):
for exe in sorted_executor_2_length: for exe in sorted_executor_2_length:
if(exe.get_type()=="Call" or exe.get_type()=="Operation"): if(exe.get_type()=="Call" or exe.get_type()=="Operation"):
old = exe.get_code(remove_emit_and_take = True, replace_calls = False) old = exe.get_code(get_OG = True, remove_emit_and_take = True, replace_calls = False)
new = exe.simplify_code(return_tab = False) new = exe.simplify_code(return_tab = False)
if(new!=old): if(new!=old):
temp = code temp = code
code = code.replace(old, new, 1) code = code.replace(old, new, 1)
if(temp==code): if(temp==code):
print(exe)
print(code) print(code)
print("- old", f'"{old}"') print("- old", f'"{old}"')
print("- new", f'"{new}"') print("- new", f'"{new}"')
......
...@@ -698,10 +698,15 @@ class Operation(Executor): ...@@ -698,10 +698,15 @@ class Operation(Executor):
def get_code(self, replace_calls = True, clean_pipe = False, get_OG=False, remove_emit_and_take = False): def get_code(self, replace_calls = True, clean_pipe = False, get_OG=False, remove_emit_and_take = False):
#exe.get_code(remove_emit_and_take = True, replace_calls = False)
code = self.code.get_code() code = self.code.get_code()
if(get_OG): if(get_OG):
if(self.OG_code!=""): if(self.OG_code!=""):
code = self.OG_code code = self.OG_code
if(code[:3] in ["e: ", "t: "] and self.get_artificial_status()):
#print("-", code)
code = code[3:]
code = code.strip()
return code return code
if(clean_pipe): if(clean_pipe):
......
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