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

first commit

parent 8c901194
No related branches found
No related tags found
No related merge requests found
Pipeline #14107 passed with stage
in 2 minutes and 22 seconds
...@@ -54,6 +54,7 @@ class BioFlowInsightError(Exception): ...@@ -54,6 +54,7 @@ class BioFlowInsightError(Exception):
#* [9] -> Tuple with call (ch1, ch2) = wf() #* [9] -> Tuple with call (ch1, ch2) = wf()
#* [11] -> Failed to extract the operation or call at the line x. Try rewriting it in a simplified version. #* [11] -> Failed to extract the operation or call at the line x. Try rewriting it in a simplified version.
#* [13] -> Multiple scripts with the same name were defined in the source code -> don't know which one to extract then when calling 'get_external_scripts_code' #* [13] -> Multiple scripts with the same name were defined in the source code -> don't know which one to extract then when calling 'get_external_scripts_code'
#* [15] -> Failed to extract the call at the line x. Try rewriting it in a simplified version.
......
...@@ -382,8 +382,7 @@ class Call(Executor): ...@@ -382,8 +382,7 @@ class Call(Executor):
raise Exception("No first call found!!") raise Exception("No first call found!!")
self.called.append(self.first_element_called) self.called.append(self.first_element_called)
else: else:
print(self.get_file_address()) raise BioFlowInsightError(f"Failed to extract the call{self.get_string_line(self.get_code())}. Try rewriting it in a simplified version.", num = 15, origin=self)
raise Exception(f"Call didn't match pattern '{call}'")
def get_called(self): def get_called(self):
......
...@@ -17,10 +17,22 @@ def is_operation(node_id): ...@@ -17,10 +17,22 @@ def is_operation(node_id):
def fill_dot(dot, dico, label_node = True, label_edge = True): def fill_dot(dot, dico, label_node = True, label_edge = True):
for n in dico["nodes"]: for n in dico["nodes"]:
try:
color = n["color"]
except:
color = ""
try:
xlabel = n["xlabel"]
except:
xlabel = ""
try:
fillcolor = n["fillcolor"]
except:
fillcolor = ""
if(label_node): if(label_node):
dot.node(n["id"], n["name"], shape=n["shape"], xlabel= n["xlabel"], fillcolor=n["fillcolor"]) dot.node(n["id"], n["name"], shape=n["shape"], xlabel= xlabel, fillcolor=fillcolor, color = color, style="filled")
else: else:
dot.node(n["id"], n["name"], shape=n["shape"], fillcolor=n["fillcolor"]) dot.node(n["id"], n["name"], shape=n["shape"], fillcolor=fillcolor, color=color, style="filled")
for e in dico["edges"]: for e in dico["edges"]:
if(label_edge): if(label_edge):
dot.edge(e['A'], e['B'], label= e['label']) dot.edge(e['A'], e['B'], label= e['label'])
...@@ -534,6 +546,17 @@ def get_name_new_node(new_nodes, relevant_modules): ...@@ -534,6 +546,17 @@ def get_name_new_node(new_nodes, relevant_modules):
def check_same_elements(list1, list2): def check_same_elements(list1, list2):
return set(list1)==set(list2) return set(list1)==set(list2)
def rgb_to_hex(r, g, b):
return '#{:02x}{:02x}{:02x}'.format(r, g, b)
def get_color_node(node, new_nodes):
max = len(new_nodes[0])
for n in new_nodes:
if(len(n)>max):
max = len(n)
prop = 256- int(127*len(node)/max)
return rgb_to_hex(prop, prop, prop)
def relev_user_view_builder(dico, relevant_modules): def relev_user_view_builder(dico, relevant_modules):
R = [] R = []
for r in relevant_modules: for r in relevant_modules:
...@@ -639,11 +662,15 @@ def relev_user_view_builder(dico, relevant_modules): ...@@ -639,11 +662,15 @@ def relev_user_view_builder(dico, relevant_modules):
new_dico["subworkflows"] = [] new_dico["subworkflows"] = []
for i in range(len(new_nodes)): for i in range(len(new_nodes)):
new_nodes[i].sort() new_nodes[i].sort()
new_name = get_name_new_node(get_names_tab(dico, new_nodes[i]), relevant_modules)
node = {"id": ''.join(new_nodes[i]).replace('<', '').replace('>', ''), node = {"id": ''.join(new_nodes[i]).replace('<', '').replace('>', ''),
"name": get_name_new_node(get_names_tab(dico, new_nodes[i]), relevant_modules), "name": new_name,
"shape": "ellipse", "shape": "ellipse",
"xlabel": "", "xlabel": f"{len(new_nodes[i])}",
"fillcolor": ""} "fillcolor": get_color_node(new_nodes[i], new_nodes)}
#If relevant module -> color it differently
if(new_name in relevant_modules):
node["color"] = "yellow"
new_dico["nodes"].append(node) new_dico["nodes"].append(node)
added_edges = [] added_edges = []
for edge in dico["edges"]: for edge in dico["edges"]:
...@@ -662,6 +689,14 @@ def relev_user_view_builder(dico, relevant_modules): ...@@ -662,6 +689,14 @@ def relev_user_view_builder(dico, relevant_modules):
"label": "" "label": ""
}) })
added_edges.append(edge_string) added_edges.append(edge_string)
outputs = get_output_nodes(new_dico)
inputs = get_input_nodes(new_dico)
new_dico["nodes"].append({"id": "input","name": "i","shape": "triangle", "fillcolor":"#ffffff"})
new_dico["nodes"].append({"id": "output","name": "o","shape": "triangle", "fillcolor":"#ffffff"})
for out in outputs:
new_dico["edges"].append({'A':out, 'B':'output', "label": ""})
for input in inputs:
new_dico["edges"].append({'A':"input", 'B':input, "label": ""})
return new_dico return new_dico
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