diff --git a/src/call.py b/src/call.py index ea7f06154c9c6c8f4e82d3edd416a278c5f52123..abdd3ba96047409224e5ad09047c3105d224862e 100644 --- a/src/call.py +++ b/src/call.py @@ -388,14 +388,18 @@ class Call(Executor): if(process!=None and subworkflow==None and fun==None): #If the elements need to duplicated -> then we need to duplicate it if(self.get_duplicate_status()): + temp = process process = process.copy() + process.set_alias(temp.get_alias()) process.initialise() self.first_element_called = process self.origin.add_element_to_elements_being_called(process) #temp.incremente_number_times_called() if(process==None and subworkflow!=None and fun==None): if(self.get_duplicate_status()): + temp = subworkflow subworkflow = subworkflow.copy() + subworkflow.set_alias(subworkflow.get_alias()) subworkflow.initialise() self.first_element_called = subworkflow self.origin.add_element_to_elements_being_called(subworkflow) diff --git a/src/include.py b/src/include.py index 4a92090fb58d491d31fcb69535c2e0b13ae82722..5e419033b4aa2f0f0d5c1491d92ec8b9ad271291 100644 --- a/src/include.py +++ b/src/include.py @@ -29,6 +29,11 @@ class Include(Nextflow_Building_Blocks): self.defines = {} #self.initialise() + def get_string_line(self, bit_of_code): + return self.nextflow_file_origin.get_string_line(bit_of_code) + + def get_file_address(self): + return self.nextflow_file_origin.get_file_address() def get_duplicate_status(self): return self.nextflow_file_origin.get_duplicate_status() @@ -111,12 +116,12 @@ class Include(Nextflow_Building_Blocks): pattern_as = constant.INCLUDE_AS for match in re.finditer(pattern_as, include): found = True - if(self.get_duplicate_status()): - thing_as = self.nextflow_file.get_element_from_name(match.group(1)).copy() - thing_as.set_alias(match.group(3)) - self.defines[match.group(3)] = thing_as - else: - self.defines[match.group(3)] = self.nextflow_file.get_element_from_name(match.group(1)) + #if(self.get_duplicate_status()): + thing_as = self.nextflow_file.get_element_from_name(match.group(1)).copy() + thing_as.set_alias(match.group(3)) + self.defines[match.group(3)] = thing_as + #else: + # self.defines[match.group(3)] = self.nextflow_file.get_element_from_name(match.group(1)) if(not found): raise Exception(f"I was not able to import '{include}' from {self.nextflow_file.get_file_address()}") diff --git a/src/main.py b/src/main.py index 522bde77c2048d390b8bcd83a775a9cfea9e606f..f108590141bf8b9b722c426bdadd2c90b8c78188 100644 --- a/src/main.py +++ b/src/main.py @@ -17,6 +17,9 @@ class Main(Nextflow_Building_Blocks): def get_string_line(self, bit_of_code): return self.nextflow_file.get_string_line(bit_of_code) + + #def check_in_channels(self, channel): + # return self.root.check_in_channels(channel) def get_modules_defined(self): return self.nextflow_file.get_modules_defined() diff --git a/src/operation.py b/src/operation.py index 0cbb3a54c0e961ad1ec1f40a9881b99897494b68..b5add767c455b1d9abb70e2687d485072d7db7ac 100644 --- a/src/operation.py +++ b/src/operation.py @@ -195,7 +195,9 @@ class Operation(Executor): raise Exception("This shoudn't happen! -> a call is taking a value") else: + print("here") channel = Channel(name=name, origin=self.origin) + print(self.get_code(), name, self.get_file_address()) if(not self.origin.check_in_channels(channel)): self.origin.add_channel(channel) else: diff --git a/src/process.py b/src/process.py index 6372e462dd25cb8fddb9467aed8ffd286387a6f9..d65edfa0a149d08937534047f0695f8ff837d5e8 100644 --- a/src/process.py +++ b/src/process.py @@ -366,7 +366,8 @@ class Process(Nextflow_Building_Blocks): self.name = match.group(1) self.name = self.name.replace("'", "") self.name = self.name.replace('"', '') - self.alias = self.name + if(self.alias==""): + self.alias = self.name self.printed_name = self.name def get_name_to_print(self): diff --git a/src/workflow.py b/src/workflow.py index 0070f2ba93177b674914e575986078bcbf7cb7aa..5faf0d689b269f54f3cb582c707c0ddf8e86852f 100644 --- a/src/workflow.py +++ b/src/workflow.py @@ -49,7 +49,15 @@ class Workflow: with open(file, 'r') as f: txt= f.read() except: - raise BioFlowInsightError("No 'main.nf' file found at the root of the prohject") + None + #raise BioFlowInsightError("No 'main.nf' file found at the root of the prohject") + if(len(nextflow_files)==1): + file = nextflow_files[0] + with open(file, 'r') as f: + txt= f.read() + else: + raise BioFlowInsightError("Multiple Nextflow files found at the root with no 'main.nf' file: I don't know which want to select") + self.duplicate = duplicate