Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
BioFlow-Insight
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
shareFAIR
BioFlow-Insight
Commits
53d89ea2
Commit
53d89ea2
authored
2 months ago
by
George Marchment
Browse files
Options
Downloads
Patches
Plain Diff
Updated the representation of the conditions in the workflow -> the condition now flow:))
parent
d9069e9c
No related branches found
No related tags found
No related merge requests found
Pipeline
#14665
failed with stage
Stage:
in 3 minutes and 3 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/graph.py
+73
-19
73 additions, 19 deletions
src/graph.py
with
73 additions
and
19 deletions
src/graph.py
+
73
−
19
View file @
53d89ea2
...
@@ -7,6 +7,9 @@ import re
...
@@ -7,6 +7,9 @@ import re
import
ctypes
import
ctypes
from
.outils_graph
import
*
from
.outils_graph
import
*
from
.bioflowinsighterror
import
BioFlowInsightError
from
.
import
constant
def
get_object
(
address
):
def
get_object
(
address
):
address
=
int
(
re
.
findall
(
r
"
\dx\w+
"
,
address
)[
0
],
base
=
16
)
address
=
int
(
re
.
findall
(
r
"
\dx\w+
"
,
address
)[
0
],
base
=
16
)
...
@@ -177,38 +180,67 @@ class Graph():
...
@@ -177,38 +180,67 @@ class Graph():
#This is a dictionnary which links every node to it's connected process
#This is a dictionnary which links every node to it's connected process
node_2_processes
=
copy
.
deepcopy
(
self
.
link_dico
)
node_2_processes
=
copy
.
deepcopy
(
self
.
link_dico
)
already_searched
=
{}
already_searched
=
{}
for
node
in
node_2_processes
:
for
node
A
in
node_2_processes
:
already_searched
[
node
]
=
[
node
]
already_searched
[
node
A
]
=
[
node
A
]
changed
=
True
changed
=
True
while
(
changed
):
while
(
changed
):
changed
=
False
changed
=
False
for
node
in
node_2_processes
:
for
node
A
in
node_2_processes
:
temp
=
node_2_processes
[
node
].
copy
()
temp
=
node_2_processes
[
node
A
].
copy
()
for
give
in
node_2_processes
[
node
]:
for
give
in
node_2_processes
[
node
A
]:
if
(
is_operation
(
give
)):
if
(
is_operation
(
give
)):
temp
.
remove
(
give
)
temp
.
remove
(
give
)
if
(
node
!=
give
and
give
not
in
already_searched
[
node
]):
if
(
node
A
!=
give
and
give
not
in
already_searched
[
node
A
]):
already_searched
[
node
]
+=
give
already_searched
[
node
A
]
+=
give
temp_temp
=
node_2_processes
[
give
]
temp_temp
=
node_2_processes
[
give
]
for
node_temp
in
already_searched
[
node
]:
for
node_temp
in
already_searched
[
node
A
]:
try
:
try
:
temp_temp
.
remove
(
node_temp
)
temp_temp
.
remove
(
node_temp
)
except
:
except
:
None
None
temp
+=
temp_temp
temp
+=
temp_temp
changed
=
True
changed
=
True
node_2_processes
[
node
]
=
list
(
set
(
temp
))
node_2_processes
[
nodeA
]
=
list
(
set
(
temp
))
#Getting the dico of paths in the workflow
path_from_process_to_other_processes
=
{}
searching
=
True
timeout
=
0
flat_dico
=
get_flatten_dico
(
dico
.
copy
())
process_ids
=
[]
for
node
in
flat_dico
[
"
nodes
"
]:
process_ids
.
append
(
node
[
'
id
'
])
while
(
searching
and
timeout
<
constant
.
WHILE_UPPER_BOUND
):
searching
=
False
for
nodeA
in
process_ids
:
try
:
tmp
=
path_from_process_to_other_processes
[
nodeA
]
except
:
path_from_process_to_other_processes
[
nodeA
]
=
node_2_processes
[
nodeA
].
copy
()
searching
=
True
for
connectedA
in
path_from_process_to_other_processes
[
nodeA
]:
for
nodeB
in
path_from_process_to_other_processes
:
if
(
connectedA
==
nodeB
):
for
connectedB
in
path_from_process_to_other_processes
[
nodeB
]:
if
(
connectedB
not
in
path_from_process_to_other_processes
[
nodeA
]):
path_from_process_to_other_processes
[
nodeA
].
append
(
connectedB
)
searching
=
True
timeout
+=
1
if
(
timeout
>=
constant
.
WHILE_UPPER_BOUND
):
raise
BioFlowInsightError
(
f
"
The WHILE_UPPER_BOUND was exceeded. BioFlow-Insight was unable to create the dico of paths.
"
,
type
=
"
Unable to create the dico of paths
"
)
#%2x%2x%2x
#%2x%2x%2x
colours
=
[
"
#ffbe00
"
,
"
#0055c8
"
,
"
#6e6e00
"
,
"
#a0006e
"
,
"
#ff5a00
"
,
"
#82dc73
"
,
"
#ff82b4
"
,
"
#d282be
"
,
"
#d2d200
"
,
"
#dc9600
"
,
"
#6e491e
"
,
"
#00643c
"
,
"
#82c8e6
"
,
"
#640082
"
]
colours
=
[
"
#ffbe00
"
,
"
#0055c8
"
,
"
#6e6e00
"
,
"
#a0006e
"
,
"
#ff5a00
"
,
"
#82dc73
"
,
"
#ff82b4
"
,
"
#d282be
"
,
"
#d2d200
"
,
"
#dc9600
"
,
"
#6e491e
"
,
"
#00643c
"
,
"
#82c8e6
"
,
"
#640082
"
]
links_added
,
links_added__with_conditions
=
[],
[]
links_added
,
links_added__with_conditions
,
links_added_with_index_OG
=
[],
[],
[]
def
add_edges
(
dico
,
condition
,
checking_conditions
,
index
=
0
):
def
add_edges
(
dico
,
condition
,
checking_conditions
,
index
=
0
,
added_in_condition
=
{}
):
for
node
in
dico
[
'
nodes
'
]:
for
node
in
dico
[
'
nodes
'
]:
edges
=
node_2_processes
[
node
[
'
id
'
]]
edges
=
node_2_processes
[
node
[
'
id
'
]]
for
B
in
edges
:
for
B
in
edges
:
link
=
f
"
{
node
[
'
id
'
]
}
->
{
B
}
"
link
=
f
"
{
node
[
'
id
'
]
}
->
{
B
}
"
link_with_condition
=
f
"
{
node
[
'
id
'
]
}
->
{
B
}
(
{
condition
}
)
"
link_with_condition
=
f
"
{
node
[
'
id
'
]
}
->
{
B
}
(
{
condition
}
)
"
link_with_index
=
f
"
{
node
[
'
id
'
]
}
->
{
B
}
(
{
index
}
)
"
if
(
link_with_condition
not
in
links_added__with_conditions
):
if
(
link_with_condition
not
in
links_added__with_conditions
):
if
(
checking_conditions
):
if
(
checking_conditions
):
p1
,
p2
=
get_object
(
node
[
'
id
'
]),
get_object
(
B
)
p1
,
p2
=
get_object
(
node
[
'
id
'
]),
get_object
(
B
)
...
@@ -220,32 +252,54 @@ class Graph():
...
@@ -220,32 +252,54 @@ class Graph():
# if(c2.get_value()==condition):
# if(c2.get_value()==condition):
if
(
link
not
in
links_added
):
if
(
link
not
in
links_added
):
dico
[
'
edges
'
].
append
({
'
A
'
:
node
[
'
id
'
],
'
B
'
:
B
,
'
label
'
:
''
,
"
colour
"
:
colours
[
index
],
"
condition
"
:
condition
})
dico
[
'
edges
'
].
append
({
'
A
'
:
node
[
'
id
'
],
'
B
'
:
B
,
'
label
'
:
''
,
"
colour
"
:
colours
[
index
],
"
condition
"
:
condition
})
added_in_condition
[
node
[
'
id
'
]]
=
''
links_added
.
append
(
link
)
links_added
.
append
(
link
)
links_added
.
append
(
link_with_condition
)
links_added__with_conditions
.
append
(
link_with_condition
)
links_added_with_index_OG
.
append
(
link_with_index
)
else
:
else
:
checking_conditions
=
False
checking_conditions
=
False
else
:
else
:
if
(
link
not
in
links_added
):
if
(
link
not
in
links_added
):
dico
[
'
edges
'
].
append
({
'
A
'
:
node
[
'
id
'
],
'
B
'
:
B
,
'
label
'
:
''
})
dico
[
'
edges
'
].
append
({
'
A
'
:
node
[
'
id
'
],
'
B
'
:
B
,
'
label
'
:
''
})
links_added
.
append
(
link
)
links_added
.
append
(
link
)
for
sub
in
dico
[
'
subworkflows
'
]:
for
sub
in
dico
[
'
subworkflows
'
]:
add_edges
(
dico
[
"
subworkflows
"
][
sub
],
condition
,
checking_conditions
,
index
=
index
)
add_edges
(
dico
[
"
subworkflows
"
][
sub
],
condition
,
checking_conditions
,
index
=
index
,
added_in_condition
=
added_in_condition
)
return
checking_conditions
return
checking_conditions
links_added_with_index
=
[]
def
add_edges_flow_edges
(
dico
,
added_in_condition
):
for
index
in
added_in_condition
:
nodes_with_condition
=
added_in_condition
[
index
]
for
node
in
dico
[
'
nodes
'
]:
edges
=
node_2_processes
[
node
[
'
id
'
]]
for
B
in
edges
:
link_with_index
=
f
"
{
node
[
'
id
'
]
}
->
{
B
}
(
{
index
}
)
"
for
node_with_condition
in
nodes_with_condition
:
if
(
link_with_index
not
in
links_added_with_index
and
link_with_index
not
in
links_added_with_index_OG
):
if
(
node
[
'
id
'
]
in
path_from_process_to_other_processes
[
node_with_condition
]
and
B
in
path_from_process_to_other_processes
[
node_with_condition
]):
dico
[
'
edges
'
].
append
({
'
A
'
:
node
[
'
id
'
],
'
B
'
:
B
,
'
label
'
:
''
,
"
colour
"
:
colours
[
index
]})
links_added_with_index
.
append
(
link_with_index
)
for
sub
in
dico
[
'
subworkflows
'
]:
add_edges_flow_edges
(
dico
[
"
subworkflows
"
][
sub
],
added_in_condition
)
#
if(self.workflow.get_duplicate_status()):
if
(
self
.
workflow
.
get_duplicate_status
()):
if
(
False
):
#Right now not generating the colored edges
#
if(False):#Right now not generating the colored edges
checking_conditions
=
True
checking_conditions
=
True
most_influential_conditions
=
self
.
workflow
.
get_most_influential_conditions
()
most_influential_conditions
=
self
.
workflow
.
get_most_influential_conditions
()
list_most_influential_conditions
=
list
(
most_influential_conditions
.
keys
())
list_most_influential_conditions
=
list
(
most_influential_conditions
.
keys
())
index
=
0
index
=
0
added_in_condition
=
{}
while
(
checking_conditions
and
\
while
(
checking_conditions
and
\
index
<
len
(
list_most_influential_conditions
)
and
\
index
<
len
(
list_most_influential_conditions
)
and
index
<
5
):
index
<
5
):
added_in_condition
[
index
]
=
{}
condition
=
list_most_influential_conditions
[
index
]
condition
=
list_most_influential_conditions
[
index
]
checking_conditions
=
add_edges
(
dico
,
condition
,
checking_conditions
,
index
=
index
)
checking_conditions
=
add_edges
(
dico
,
condition
,
checking_conditions
,
index
=
index
,
added_in_condition
=
added_in_condition
[
index
]
)
index
+=
1
index
+=
1
add_edges
(
dico
,
condition
=
""
,
checking_conditions
=
False
)
add_edges
(
dico
,
condition
=
""
,
checking_conditions
=
False
)
add_edges_flow_edges
(
dico
,
added_in_condition
)
else
:
else
:
add_edges
(
dico
,
condition
=
""
,
checking_conditions
=
False
)
add_edges
(
dico
,
condition
=
""
,
checking_conditions
=
False
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment