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
91b15e8f
Commit
91b15e8f
authored
7 months ago
by
George Marchment
Browse files
Options
Downloads
Patches
Plain Diff
user view correctly implmented
parent
1118ddbf
No related branches found
No related tags found
No related merge requests found
Pipeline
#14043
passed with stage
Stage:
in 2 minutes and 18 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/graph.py
+4
-3
4 additions, 3 deletions
src/graph.py
src/outils_graph.py
+52
-13
52 additions, 13 deletions
src/outils_graph.py
with
56 additions
and
16 deletions
src/graph.py
+
4
−
3
View file @
91b15e8f
...
...
@@ -294,9 +294,10 @@ class Graph():
self
.
initialise_flattened_dico
(
self
.
dico_process_dependency_graph
)
dico
=
self
.
dico_flattened
relev_user_view_builder
(
dico
,
relevant_modules
=
relevant_processes
)
#generate_graph(self.get_output_dir()/'graphs'/"temp", dico, label_edge=True, label_node=True, render_graphs = render_graphs)
user_view
=
relev_user_view_builder
(
dico
,
relevant_modules
=
relevant_processes
)
with
open
(
self
.
get_output_dir
()
/
"
graphs/user_view.json
"
,
'
w
'
)
as
output_file
:
json
.
dump
(
user_view
,
output_file
,
indent
=
4
)
generate_graph
(
self
.
get_output_dir
()
/
'
graphs
'
/
"
user_view
"
,
user_view
,
label_edge
=
True
,
label_node
=
True
,
render_graphs
=
render_graphs
)
...
...
This diff is collapsed.
Click to expand it.
src/outils_graph.py
+
52
−
13
View file @
91b15e8f
...
...
@@ -515,6 +515,20 @@ def get_names_tab(dico, tab):
final
.
append
(
names
)
return
final
def
get_name_new_node
(
new_nodes
,
relevant_modules
):
for
r
in
relevant_modules
:
if
([
r
]
in
new_nodes
):
return
r
#Arbitrary choice of choosing the name with the longest name
longest_name
=
new_nodes
[
0
][
0
]
for
name
in
new_nodes
:
if
(
len
(
longest_name
)
<
len
(
name
[
0
])):
longest_name
=
name
[
0
]
return
longest_name
def
check_same_elements
(
list1
,
list2
):
return
set
(
list1
)
==
set
(
list2
)
def
relev_user_view_builder
(
dico
,
relevant_modules
):
R
=
[]
for
r
in
relevant_modules
:
...
...
@@ -526,7 +540,7 @@ def relev_user_view_builder(dico, relevant_modules):
for
out
in
outputs
:
dico
[
"
edges
"
].
append
({
'
A
'
:
out
,
'
B
'
:
'
output
'
})
#TODO remove this -> it's to replicate the one in the algortihm demo
dico
[
"
edges
"
].
append
({
'
A
'
:
get_id_from_name
(
dico
,
"
M5
"
)[
0
],
'
B
'
:
'
output
'
})
#
dico["edges"].append({'A':get_id_from_name(dico, "M5")[0], 'B':'output'})
for
input
in
inputs
:
dico
[
"
edges
"
].
append
({
'
A
'
:
"
input
"
,
'
B
'
:
input
})
U
=
[]
...
...
@@ -560,15 +574,13 @@ def relev_user_view_builder(dico, relevant_modules):
#Line 10
for
r
in
R
:
M
=
set
([
r
]).
union
(
set
(
in_r
[
r
])).
union
(
set
(
out_r
[
r
]))
U
=
set
(
U
).
union
(
M
)
U
.
append
(
list
(
M
)
)
#Step 2
NRC
=
[]
for
n
in
set
(
N
)
-
set
(
R
):
if
(
marked_statues
[
n
]
==
'
unmarked
'
):
def
condition_line_13
(
NRC
,
n
,
dico
,
R
,
inputs
,
outputs
):
def
check_same_elements
(
list1
,
list2
):
return
set
(
list1
)
==
set
(
list2
)
#Ms = generate_subsets(NRC)
for
i
in
range
(
len
(
NRC
)):
M
=
NRC
[
i
]
if
(
check_same_elements
(
rPredM
(
M
,
dico
,
R
,
[
"
input
"
]),
rPred
(
n
,
dico
,
R
,
[
"
input
"
]))
and
...
...
@@ -584,9 +596,8 @@ def relev_user_view_builder(dico, relevant_modules):
else
:
M
=
[
n
]
NRC
.
append
(
M
)
print
(
get_names_tab
(
dico
,
NRC
))
#
print(get_names_tab(dico, NRC))
1
/
0
#Step 3
changes_in_NRC
=
True
while
(
changes_in_NRC
):
...
...
@@ -604,19 +615,47 @@ def relev_user_view_builder(dico, relevant_modules):
#Line 23
condition_left
,
condition_right
=
True
,
True
for
n
in
V_plus
:
if
(
rPred
(
n
,
dico
,
R
,
[
'
input
'
])
!=
rPredM
(
M
,
dico
,
R
,
[
"
input
"
])):
if
(
not
check_same_elements
(
rPred
(
n
,
dico
,
R
,
[
'
input
'
])
,
rPredM
(
M
,
dico
,
R
,
[
"
input
"
]))
)
:
condition_left
=
False
for
n
in
V_minus
:
if
(
rSucc
(
n
,
dico
,
R
,
[
'
output
'
])
!=
rSuccM
(
M
,
dico
,
R
,
[
"
output
"
])):
if
(
not
check_same_elements
(
rSucc
(
n
,
dico
,
R
,
[
'
output
'
])
,
rSuccM
(
M
,
dico
,
R
,
[
"
output
"
]))
)
:
condition_left
=
False
if
(
condition_left
and
condition_right
):
NRC
.
remove
(
M1
)
NRC
.
remove
(
M2
)
NRC
.
append
(
M
)
changes_in_NRC
=
True
tab
=
list
(
U
)
+
NRC
print
(
tab
)
print
(
get_names_tab
(
dico
,
tab
))
return
new_nodes
=
list
(
U
)
+
NRC
new_dico
=
{}
new_dico
[
"
nodes
"
]
=
[]
new_dico
[
"
edges
"
]
=
[]
new_dico
[
"
subworkflows
"
]
=
[]
for
i
in
range
(
len
(
new_nodes
)):
new_nodes
[
i
].
sort
()
node
=
{
"
id
"
:
''
.
join
(
new_nodes
[
i
]).
replace
(
'
<
'
,
''
).
replace
(
'
>
'
,
''
),
"
name
"
:
get_name_new_node
(
get_names_tab
(
dico
,
new_nodes
[
i
]),
relevant_modules
),
"
shape
"
:
"
ellipse
"
,
"
xlabel
"
:
""
,
"
fillcolor
"
:
""
}
new_dico
[
"
nodes
"
].
append
(
node
)
added_edges
=
[]
for
edge
in
dico
[
"
edges
"
]:
for
i
in
range
(
len
(
new_dico
[
"
nodes
"
])):
nA
=
new_dico
[
"
nodes
"
][
i
]
for
y
in
range
(
len
(
new_dico
[
"
nodes
"
])):
if
(
i
!=
y
):
nB
=
new_dico
[
"
nodes
"
][
y
]
edge_string
=
f
'
{
nA
[
"
id
"
]
}
->
{
nB
[
"
id
"
]
}
'
if
(
edge
[
"
A
"
].
replace
(
'
<
'
,
''
).
replace
(
'
>
'
,
''
)
in
nA
[
"
id
"
]
and
edge
[
"
B
"
].
replace
(
'
<
'
,
''
).
replace
(
'
>
'
,
''
)
in
nB
[
"
id
"
]
and
edge_string
not
in
added_edges
):
#So we don't have dupliacte edges
new_dico
[
"
edges
"
].
append
({
"
A
"
:
nA
[
"
id
"
],
"
B
"
:
nB
[
"
id
"
],
"
label
"
:
""
})
added_edges
.
append
(
edge_string
)
return
new_dico
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