diff --git a/src/main.py b/src/main.py index 7f1f38b3cae4579f16c1fc2f2c22e6158f4754c8..ac73acc32699157640baceb5f76d56f992ca2a3c 100644 --- a/src/main.py +++ b/src/main.py @@ -20,8 +20,9 @@ class Main(Nextflow_Building_Blocks): pos = {} for e in executors: code = e.get_code(get_OG = True) - if(code in seen): - 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') + #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 + 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] = '' pos[e] = e.get_position_in_main(e) #TODO add sort here @@ -54,12 +55,13 @@ class Main(Nextflow_Building_Blocks): for exe in sorted_executor_2_length: 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) if(new!=old): temp = code code = code.replace(old, new, 1) if(temp==code): + print(exe) print(code) print("- old", f'"{old}"') print("- new", f'"{new}"') diff --git a/src/operation.py b/src/operation.py index ea2188b2b052e64285b74798ee72a2431514c3bf..42ddcf3b236f18f8fa65bcc65e828cbf4e1419bf 100644 --- a/src/operation.py +++ b/src/operation.py @@ -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): + #exe.get_code(remove_emit_and_take = True, replace_calls = False) code = self.code.get_code() if(get_OG): if(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 if(clean_pipe):