diff --git a/src/call.py b/src/call.py index 44077b4cc7f0040c3c1d8adf742d12ca4347e7c7..079cb9e67054c0f652e830e0d909e9755fc75188 100644 --- a/src/call.py +++ b/src/call.py @@ -1,5 +1,6 @@ import re import json +import copy from .code_ import Code @@ -376,11 +377,17 @@ class Call(Executor): subworkflow = self.get_subworkflow_from_name(tab_call[0]) fun = self.get_function_from_name(tab_call[0]) if(process!=None and subworkflow==None and fun==None): - #temp = process - ##If the lements need to duplicated -> then we need to duplicate it - #if(self.get_duplicate_status()): - self.first_element_called = process - #print(process.get_name(), process.call) + #If the lements need to duplicated -> then we need to duplicate it + temp = process + if(self.get_duplicate_status()): + print(process.get_number_times_called()) + if(process.get_number_times_called()>0): + print("here") + temp = copy.deepcopy(process) + temp.set_alias(f"{process.get_name()}_{process.get_number_times_called()}") + self.first_element_called = temp + temp.incremente_number_times_called() + print(process.get_name(), process.call) if(process==None and subworkflow!=None and fun==None): self.first_element_called = subworkflow if(process==None and subworkflow==None and fun!=None): diff --git a/src/process.py b/src/process.py index 3d7a1c899c8de80df9bf33352c44dfb947efb740..44c2ad818f65a5893ff2b2600568910cbeb20f90 100644 --- a/src/process.py +++ b/src/process.py @@ -30,11 +30,18 @@ class Process(Nextflow_Building_Blocks): self.initialise() self.initialised = True self.call = [] + self.number_times_called = 0 ##It's important this is last #self.condition = Condition(self) def set_alias(self, alias): self.alias = alias + + def get_number_times_called(self): + return self.number_times_called + + def incremente_number_times_called(self): + self.number_times_called+=1 def set_call(self, call): self.call.append(call)