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

fixed bug

parent fe5ce40f
No related branches found
No related tags found
No related merge requests found
Pipeline #14384 failed with stage
in 2 minutes and 36 seconds
......@@ -88,7 +88,7 @@ class Block(Root):
#############
# CHANNELS
#############
def get_channels_above_level_rec(self, dico = {}):
def get_channels_above_level_rec(self, dico):
for c in self.channels:
dico[c] = ''
self.origin.get_channels_above_level_rec(dico)
......@@ -107,6 +107,9 @@ class Block(Root):
tab+=block.get_channels_same_level()
tab+=block.get_channels_inside_level()
return tab
def get_channels_from_name_all_channels(self, name):
return self.origin.get_channels_from_name_all_channels(name)
#def check_in_channels(self, channel):
# for c in self.get_channels():
......
......@@ -157,7 +157,7 @@ class Call(Executor):
#Case it's a channel
if(re.fullmatch(constant.WORD, param) and not analysed_param):
#if(re.fullmatch(constant.WORD, param) and not analysed_param or param in ['[]'] or param[:7]=="params."):
#TODO this needs to be updated to proper formalise how you search for channels
channels = self.origin.get_channels_from_name_same_level(param)
if(channels==[]):
channels = self.origin.get_channels_from_name_inside_level(param)
......@@ -165,6 +165,8 @@ class Call(Executor):
channels = self.origin.get_channels_from_name_above_level(param)
if(channels==[]):
channels = self.origin.get_channels_from_name_other_blocks_on_same_level(param)
if(channels==[]):
channels = self.origin.get_channels_from_name_all_channels(param)
if(channels==[]):
from .channel import Channel
channel = Channel(name=param, origin=self.origin)
......
......@@ -78,6 +78,10 @@ class Executor(Nextflow_Building_Blocks):
def get_channels_from_name_above_level(self, name):
return self.origin.get_channels_from_name_above_level(name)
def get_channels_from_name_all_channels(self, name):
return self.origin.get_channels_from_name_all_channels(name)
def get_channels_from_name_other_blocks_on_same_level(self, name):
return self.origin.get_channels_from_name_other_blocks_on_same_level(name)
......
......@@ -107,6 +107,14 @@ class Root(Nextflow_Building_Blocks):
if(c.get_name()==name):
tab.append(c)
return tab
def get_channels_from_name_all_channels(self, name):
channels = self.get_channels_same_level()+self.get_channels_inside_level()
tab = []
for c in channels:
if(c.get_name()==name):
tab.append(c)
return tab
......
......@@ -382,10 +382,13 @@ George Marchment, Bryan Brancotte, Marie Schmit, Frédéric Lemoine, Sarah Cohen
raise BioFlowInsightError("alpha is not in the interval [0; 1]")
processes_called = []
for c in self.get_workflow_main().get_all_calls_in_workflow():
p = c.get_first_element_called()
if(p.get_type()=="Process"):
processes_called.append(p)
if(self.get_DSL()=="DSL2"):
for c in self.get_workflow_main().get_all_calls_in_workflow():
p = c.get_first_element_called()
if(p.get_type()=="Process"):
processes_called.append(p)
else:
processes_called = self.get_first_file().get_processes()
nb_2_select = int(alpha*len(processes_called))
sampled = random.sample(set(processes_called), nb_2_select)
name_select = []
......@@ -636,6 +639,10 @@ George Marchment, Bryan Brancotte, Marie Schmit, Frédéric Lemoine, Sarah Cohen
#Method which rewrites the workflow follwong the user view
#Conert workflow to user_view only makes sense when the option duplicate is activated -> otherwise is doesn't make sense + it makes the analysis way more complicated
def convert_workflow_2_user_view(self, relevant_processes = []):
if(self.get_DSL()=="DSL1"):
code = self.convert_to_DSL2()
self.rewrite_and_initialise(code)
if(self.duplicate):
code = self.simplify_workflow_code()
self.rewrite_and_initialise(code)
......@@ -709,8 +716,7 @@ George Marchment, Bryan Brancotte, Marie Schmit, Frédéric Lemoine, Sarah Cohen
#Get the clusters and the code
self.generate_user_view(relevant_processes = relevant_processes, processes_2_remove = [])
clusters = self.graph.get_clusters_from_user_view()
#Get the clsuters with the corresponding operations inside
#for i in range(len(clusters)):
# c = clusters[i]
......@@ -935,7 +941,7 @@ George Marchment, Bryan Brancotte, Marie Schmit, Frédéric Lemoine, Sarah Cohen
#Add anker
subworkflow_section = f"//ANKER 4 SUBWORKFLOW DEF"
to_replace = ""
for match in re.finditer(r"workflow\s+\w*\s*\{", code):
for match in re.finditer(r"workflow\s*\w*\s*\{", code):
to_replace = match.group(0)
break
if(to_replace==""):
......
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