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
fbec83d9
Commit
fbec83d9
authored
8 months ago
by
George Marchment
Browse files
Options
Downloads
Patches
Plain Diff
Added functionnalities to detect weird things between process graph and user view
parent
64c835fd
No related branches found
No related tags found
No related merge requests found
Pipeline
#14134
passed with stage
in 2 minutes and 37 seconds
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
src/graph.py
+39
-6
39 additions, 6 deletions
src/graph.py
src/nextflow_file.py
+14
-0
14 additions, 0 deletions
src/nextflow_file.py
src/outils_graph.py
+20
-9
20 additions, 9 deletions
src/outils_graph.py
src/workflow.py
+13
-0
13 additions, 0 deletions
src/workflow.py
with
86 additions
and
15 deletions
src/graph.py
+
39
−
6
View file @
fbec83d9
...
@@ -16,6 +16,8 @@ class Graph():
...
@@ -16,6 +16,8 @@ class Graph():
self
.
link_dico
=
None
self
.
link_dico
=
None
#Dico to graph without operations
#Dico to graph without operations
self
.
dico_process_dependency_graph
=
{}
self
.
dico_process_dependency_graph
=
{}
self
.
user_view_with_subworkflows
=
{}
self
.
new_nodes_user_view
=
[]
self
.
dico_wo_branch_operation
=
{}
self
.
dico_wo_branch_operation
=
{}
#Dictionaries for metadata
#Dictionaries for metadata
...
@@ -289,13 +291,14 @@ class Graph():
...
@@ -289,13 +291,14 @@ class Graph():
#============================
#============================
#GENERATE USER VIEW
#GENERATE USER VIEW
#============================
#============================
def
generate_user_view
(
self
,
relevant_processes
=
[],
render_graphs
=
True
):
def
get_user_view_graph
(
self
,
relevant_processes
=
[]):
#For now i'm only gonna work from the flattened dico
#For now i'm only gonna work from the flattened dico
self
.
initialise_flattened_dico
(
self
.
dico_process_dependency_graph
)
self
.
initialise_flattened_dico
(
self
.
dico_process_dependency_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
=
relev_user_view_builder
(
dico
,
relevant_modules
=
relevant_processes
)
user_view
,
self
.
new_nodes_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
:
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
)
...
@@ -305,6 +308,11 @@ class Graph():
...
@@ -305,6 +308,11 @@ class Graph():
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
def
generate_user_view
(
self
,
relevant_processes
=
[],
render_graphs
=
True
):
user_view
,
user_view_with_subworkflows
=
self
.
get_user_view_graph
(
relevant_processes
=
relevant_processes
)
self
.
user_view_with_subworkflows
=
user_view_with_subworkflows
generate_graph
(
self
.
get_output_dir
()
/
'
graphs
'
/
"
user_view
"
,
user_view
,
label_edge
=
True
,
label_node
=
True
,
render_graphs
=
render_graphs
)
generate_graph
(
self
.
get_output_dir
()
/
'
graphs
'
/
"
user_view
"
,
user_view
,
label_edge
=
True
,
label_node
=
True
,
render_graphs
=
render_graphs
)
generate_graph
(
self
.
get_output_dir
()
/
'
graphs
'
/
"
user_view_with_subworkflows
"
,
user_view_with_subworkflows
,
label_edge
=
True
,
label_node
=
True
,
render_graphs
=
render_graphs
)
generate_graph
(
self
.
get_output_dir
()
/
'
graphs
'
/
"
user_view_with_subworkflows
"
,
user_view_with_subworkflows
,
label_edge
=
True
,
label_node
=
True
,
render_graphs
=
render_graphs
)
...
@@ -312,18 +320,43 @@ class Graph():
...
@@ -312,18 +320,43 @@ class Graph():
#GENERATE LEVEL GRAPHS
#GENERATE LEVEL GRAPHS
#============================
#============================
def
generate_level_graphs
(
self
,
render_graphs
=
True
,
label_edge
=
True
,
label_node
=
True
):
def
generate_level_graphs
(
self
,
render_graphs
=
True
,
label_edge
=
True
,
label_node
=
True
):
#
dico = self.dico_process_dependency_graph
dico
=
self
.
dico_process_dependency_graph
dico
=
self
.
full_dico
#
dico = self.full_dico
max_level
=
get_max_level
(
dico
)
max_level
=
get_max_level
(
dico
)
for
l
in
range
(
max_level
+
1
):
for
l
in
range
(
max_level
+
1
):
new_dico
=
get_graph_level_l
(
dico
,
l
)
new_dico
=
get_graph_level_l
(
dico
,
l
)
#print(new_dico)
#print(new_dico)
generate_graph
(
self
.
get_output_dir
()
/
'
graphs
'
/
f
"
level_
{
l
}
"
,
new_dico
,
label_edge
=
label_edge
,
label_node
=
label_node
,
render_graphs
=
render_graphs
)
generate_graph
(
self
.
get_output_dir
()
/
'
graphs
'
/
f
"
level_
{
l
}
"
,
new_dico
,
label_edge
=
label_edge
,
label_node
=
label_node
,
render_graphs
=
render_graphs
)
#============================
#GET NUMBER OF SUBWORKFLOWS
#============================
def
get_number_subworkflows_process_dependency_graph
(
self
):
return
get_number_of_subworkflows
(
self
.
dico_process_dependency_graph
)
def
get_number_subworkflows_user_view
(
self
):
return
get_number_of_subworkflows
(
self
.
user_view_with_subworkflows
)
#============================
#GET node_2_subworkflows
#============================
def
node_2_subworkflows_process_dependency_graph
(
self
):
node_2_subworkflows
=
{}
fill_node_2_subworkflows
(
self
.
dico_process_dependency_graph
,
node_2_subworkflows
)
return
node_2_subworkflows
#This methods returns the nodes to subworkflow dico but for the OG processes
def
node_2_subworkflows_user_view
(
self
):
node_2_subworkflows
=
{}
fill_node_2_subworkflows
(
self
.
user_view_with_subworkflows
,
node_2_subworkflows
)
new_node_2_subworkflows
=
{}
for
group
in
self
.
new_nodes_user_view
:
for
node
in
group
:
for
id
in
node_2_subworkflows
:
if
(
node
.
replace
(
'
<
'
,
''
).
replace
(
'
>
'
,
''
)
in
id
):
new_node_2_subworkflows
[
node
]
=
node_2_subworkflows
[
id
]
return
new_node_2_subworkflows
#============================
#============================
#METADATA FROM GRAPH
#METADATA FROM GRAPH
...
...
This diff is collapsed.
Click to expand it.
src/nextflow_file.py
+
14
−
0
View file @
fbec83d9
...
@@ -720,6 +720,20 @@ class Nextflow_File(Nextflow_Building_Blocks):
...
@@ -720,6 +720,20 @@ class Nextflow_File(Nextflow_Building_Blocks):
#def get_metadata_graph_wo_operations(self):
#def get_metadata_graph_wo_operations(self):
# self.graph.get_metadata_graph_wo_operations()
# self.graph.get_metadata_graph_wo_operations()
def
get_number_subworkflows_process_dependency_graph
(
self
):
return
self
.
graph
.
get_number_subworkflows_process_dependency_graph
()
def
get_number_subworkflows_user_view
(
self
):
return
self
.
graph
.
get_number_subworkflows_user_view
()
def
node_2_subworkflows_process_dependency_graph
(
self
):
return
self
.
graph
.
node_2_subworkflows_process_dependency_graph
()
def
node_2_subworkflows_user_view
(
self
):
return
self
.
graph
.
node_2_subworkflows_user_view
()
def
add_main_DSL1_2_rocrate
(
self
,
dico
,
file_dico
,
file_name
):
def
add_main_DSL1_2_rocrate
(
self
,
dico
,
file_dico
,
file_name
):
main_key
=
f
"
{
file_name
}
#main
"
main_key
=
f
"
{
file_name
}
#main
"
file_dico
[
"
hasPart
"
].
append
(
main_key
)
file_dico
[
"
hasPart
"
].
append
(
main_key
)
...
...
This diff is collapsed.
Click to expand it.
src/outils_graph.py
+
20
−
9
View file @
fbec83d9
...
@@ -638,7 +638,7 @@ def relev_user_view_builder(dico_param, relevant_modules):
...
@@ -638,7 +638,7 @@ def relev_user_view_builder(dico_param, relevant_modules):
for
out
in
outputs
:
for
out
in
outputs
:
dico
[
"
edges
"
].
append
({
'
A
'
:
out
,
'
B
'
:
'
output
'
})
dico
[
"
edges
"
].
append
({
'
A
'
:
out
,
'
B
'
:
'
output
'
})
#TODO remove this -> it's to replicate the one in the algortihm demo
#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,
f
"M5
{tag}0
")[0], 'B':'output'})
for
input
in
inputs
:
for
input
in
inputs
:
dico
[
"
edges
"
].
append
({
'
A
'
:
"
input
"
,
'
B
'
:
input
})
dico
[
"
edges
"
].
append
({
'
A
'
:
"
input
"
,
'
B
'
:
input
})
U
=
[]
U
=
[]
...
@@ -731,7 +731,6 @@ def relev_user_view_builder(dico_param, relevant_modules):
...
@@ -731,7 +731,6 @@ def relev_user_view_builder(dico_param, relevant_modules):
new_nodes
=
list
(
U
)
+
NRC
new_nodes
=
list
(
U
)
+
NRC
new_dico
=
{}
new_dico
=
{}
new_dico
[
"
nodes
"
]
=
[]
new_dico
[
"
nodes
"
]
=
[]
new_dico
[
"
edges
"
]
=
[]
new_dico
[
"
edges
"
]
=
[]
...
@@ -765,6 +764,8 @@ def relev_user_view_builder(dico_param, relevant_modules):
...
@@ -765,6 +764,8 @@ def relev_user_view_builder(dico_param, relevant_modules):
"
label
"
:
""
"
label
"
:
""
})
})
added_edges
.
append
(
edge_string
)
added_edges
.
append
(
edge_string
)
#The output nodes are the nodes which their outputs aren't connected to anything else
outputs
=
get_output_nodes
(
new_dico
)
outputs
=
get_output_nodes
(
new_dico
)
inputs
=
get_input_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
"
:
"
input
"
,
"
name
"
:
"
i
"
,
"
shape
"
:
"
triangle
"
,
"
fillcolor
"
:
"
#ffffff
"
})
...
@@ -773,7 +774,7 @@ def relev_user_view_builder(dico_param, relevant_modules):
...
@@ -773,7 +774,7 @@ def relev_user_view_builder(dico_param, relevant_modules):
new_dico
[
"
edges
"
].
append
({
'
A
'
:
out
,
'
B
'
:
'
output
'
,
"
label
"
:
""
})
new_dico
[
"
edges
"
].
append
({
'
A
'
:
out
,
'
B
'
:
'
output
'
,
"
label
"
:
""
})
for
input
in
inputs
:
for
input
in
inputs
:
new_dico
[
"
edges
"
].
append
({
'
A
'
:
"
input
"
,
'
B
'
:
input
,
"
label
"
:
""
})
new_dico
[
"
edges
"
].
append
({
'
A
'
:
"
input
"
,
'
B
'
:
input
,
"
label
"
:
""
})
return
new_dico
return
new_dico
,
new_nodes
#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)
...
@@ -807,16 +808,20 @@ def get_max_level(dico, val = 0):
...
@@ -807,16 +808,20 @@ def get_max_level(dico, val = 0):
max_val
=
tmp
max_val
=
tmp
return
max_val
return
max_val
#Function that fills the dictionnary node_2_subworkflows
def
fill_node_2_subworkflows
(
dico
,
node_2_subworkflows
,
back_log_subworklows
=
[]):
for
n
in
dico
[
"
nodes
"
]:
node_2_subworkflows
[
n
[
'
id
'
]]
=
back_log_subworklows
for
sub
in
dico
[
"
subworkflows
"
]:
fill_node_2_subworkflows
(
dico
[
"
subworkflows
"
][
sub
],
node_2_subworkflows
,
back_log_subworklows
+
[
sub
])
def
get_graph_level_l
(
dico
,
level
):
def
get_graph_level_l
(
dico
,
level
):
import
time
import
time
tag
=
str
(
time
.
time
())
tag
=
str
(
time
.
time
())
def
fill_node_2_subworkflows
(
dico
,
node_2_subworkflows
,
back_log_subworklows
=
[]):
for
n
in
dico
[
"
nodes
"
]:
node_2_subworkflows
[
n
[
'
id
'
]]
=
back_log_subworklows
for
sub
in
dico
[
"
subworkflows
"
]:
fill_node_2_subworkflows
(
dico
[
"
subworkflows
"
][
sub
],
node_2_subworkflows
,
back_log_subworklows
+
[
sub
])
node_2_subworkflows
=
{}
node_2_subworkflows
=
{}
fill_node_2_subworkflows
(
dico
,
node_2_subworkflows
)
fill_node_2_subworkflows
(
dico
,
node_2_subworkflows
)
#print(node_2_subworkflows)
#print(node_2_subworkflows)
...
@@ -891,7 +896,13 @@ def get_graph_level_l(dico, level):
...
@@ -891,7 +896,13 @@ def get_graph_level_l(dico, level):
return
new_dico
return
new_dico
def
get_number_of_subworkflows
(
dico
,
val
=
0
):
for
sub
in
dico
[
"
subworkflows
"
]:
if
(
dico
[
"
subworkflows
"
][
sub
][
"
nodes
"
]
!=
[]):
val
+=
1
val
=
get_number_of_subworkflows
(
dico
[
"
subworkflows
"
][
sub
],
val
)
return
val
This diff is collapsed.
Click to expand it.
src/workflow.py
+
13
−
0
View file @
fbec83d9
...
@@ -581,3 +581,16 @@ George Marchment, Bryan Brancotte, Marie Schmit, Frédéric Lemoine, Sarah Cohen
...
@@ -581,3 +581,16 @@ George Marchment, Bryan Brancotte, Marie Schmit, Frédéric Lemoine, Sarah Cohen
return
self
.
processes_2_tools
return
self
.
processes_2_tools
else
:
else
:
return
self
.
processes_2_tools
return
self
.
processes_2_tools
def
get_number_subworkflows_process_dependency_graph
(
self
):
return
self
.
nextflow_file
.
get_number_subworkflows_process_dependency_graph
()
def
get_number_subworkflows_user_view
(
self
):
return
self
.
nextflow_file
.
get_number_subworkflows_user_view
()
def
node_2_subworkflows_process_dependency_graph
(
self
):
return
self
.
nextflow_file
.
node_2_subworkflows_process_dependency_graph
()
def
node_2_subworkflows_user_view
(
self
):
return
self
.
nextflow_file
.
node_2_subworkflows_user_view
()
\ No newline at end of file
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