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
44ef0dcf
Commit
44ef0dcf
authored
8 months ago
by
George Marchment
Browse files
Options
Downloads
Patches
Plain Diff
add initia -> new algo
parent
778fecaf
No related branches found
No related tags found
No related merge requests found
Pipeline
#14205
passed with stage
in 2 minutes and 21 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/graph.py
+11
-10
11 additions, 10 deletions
src/graph.py
src/outils_graph.py
+37
-0
37 additions, 0 deletions
src/outils_graph.py
with
48 additions
and
10 deletions
src/graph.py
+
11
−
10
View file @
44ef0dcf
...
@@ -317,17 +317,18 @@ class Graph():
...
@@ -317,17 +317,18 @@ class Graph():
#self.initialise_flattened_dico(self.full_dico)
#self.initialise_flattened_dico(self.full_dico)
dico
=
self
.
dico_flattened
dico
=
self
.
dico_flattened
user_view
,
self
.
new_nodes_user_view
=
relev_user_view_builder
(
dico
,
relevant_modules
=
relevant_processes
)
user_view
,
self
.
new_nodes_user_view
=
user_view_builder_couples
(
dico
,
relevant_modules
=
relevant_processes
)
print
(
user_view
)
with
open
(
self
.
get_output_dir
()
/
"
graphs/user_view.json
"
,
'
w
'
)
as
output_file
:
#
with open(self.get_output_dir()/ "graphs/user_view.json", 'w') as output_file :
json
.
dump
(
user_view
,
output_file
,
indent
=
4
)
#
json.dump(user_view, output_file, indent=4)
#
#
user_view_with_subworkflows
=
add_subworkflows_2_dico
(
self
.
dico_process_dependency_graph
,
user_view
)
#
user_view_with_subworkflows = add_subworkflows_2_dico(self.dico_process_dependency_graph, user_view)
with
open
(
self
.
get_output_dir
()
/
"
graphs/user_view_with_subworkflows.json
"
,
'
w
'
)
as
output_file
:
#
with open(self.get_output_dir()/ "graphs/user_view_with_subworkflows.json", 'w') as output_file :
json
.
dump
(
user_view_with_subworkflows
,
output_file
,
indent
=
4
)
#
json.dump(user_view_with_subworkflows, output_file, indent=4)
#
return
user_view
,
user_view_with_subworkflows
#
return user_view, user_view_with_subworkflows
def
generate_user_view
(
self
,
relevant_processes
=
[],
render_graphs
=
True
):
def
generate_user_view
(
self
,
relevant_processes
=
[],
render_graphs
=
True
):
user_view
,
user_view_with_subworkflows
=
self
.
get_user_view_graph_georges_algo
(
relevant_processes
=
relevant_processes
)
user_view
,
user_view_with_subworkflows
=
self
.
get_user_view_graph_georges_algo
(
relevant_processes
=
relevant_processes
)
...
...
This diff is collapsed.
Click to expand it.
src/outils_graph.py
+
37
−
0
View file @
44ef0dcf
...
@@ -852,6 +852,43 @@ def relev_user_view_builder(dico_param, relevant_modules):
...
@@ -852,6 +852,43 @@ def relev_user_view_builder(dico_param, relevant_modules):
# new_dico["edges"].append({'A':"input", 'B':input, "label": ""})
# new_dico["edges"].append({'A':"input", 'B':input, "label": ""})
return
new_dico
,
new_nodes
return
new_dico
,
new_nodes
def
user_view_builder_couples
(
dico_param
,
relevant_modules
):
import
time
dico
=
copy
.
deepcopy
(
dico_param
)
tag
=
str
(
time
.
time
())
#Add this to simplify the use of duplicate processes
nodes_2_num
=
{}
for
node
in
dico
[
"
nodes
"
]:
nodes_2_num
[
node
[
'
name
'
]]
=
0
for
node
in
dico
[
"
nodes
"
]:
tmp
=
nodes_2_num
[
node
[
'
name
'
]]
nodes_2_num
[
node
[
'
name
'
]]
+=
1
node
[
'
name
'
]
=
f
"
{
node
[
'
name
'
]
}{
tag
}{
tmp
}
"
tab_temp
=
[]
for
n
in
relevant_modules
:
for
i
in
range
(
0
,
nodes_2_num
[
n
]):
tab_temp
.
append
(
f
"
{
n
}{
tag
}{
i
}
"
)
relevant_modules
=
tab_temp
R
=
[]
for
r
in
relevant_modules
:
R
+=
get_id_from_name
(
dico
,
r
)
R
=
list
(
set
(
R
))
outputs
=
get_output_nodes
(
dico
)
inputs
=
get_input_nodes
(
dico
)
#dico['nodes'].append({'id':"input", 'name':"input"})
#dico['nodes'].append({'id':"output", 'name':"output"})
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, f"M5_0{tag}0")[0], 'B':'output'})
for
input
in
inputs
:
dico
[
"
edges
"
].
append
({
'
A
'
:
"
input
"
,
'
B
'
:
input
})
return
dico
,
[]
#This function fills the new_dico with the flattened_dico but
#This function fills the new_dico with the flattened_dico but
#reintegrates the subworkflows (from the full workflow)
#reintegrates the subworkflows (from the full workflow)
def
add_subworkflows_2_dico
(
full_dico
,
flattened_dico
,
add_root_nodes
=
True
):
def
add_subworkflows_2_dico
(
full_dico
,
flattened_dico
,
add_root_nodes
=
True
):
...
...
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