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
f9d947fd
Commit
f9d947fd
authored
2 months ago
by
George Marchment
Browse files
Options
Downloads
Patches
Plain Diff
Added functionnality that the dot positions for the nodes are added in the json
parent
67a4eeb5
No related branches found
No related tags found
No related merge requests found
Pipeline
#14618
failed with stage
in 2 minutes and 24 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/outils_graph.py
+38
-0
38 additions, 0 deletions
src/outils_graph.py
src/workflow.py
+13
-1
13 additions, 1 deletion
src/workflow.py
with
51 additions
and
1 deletion
src/outils_graph.py
+
38
−
0
View file @
f9d947fd
...
...
@@ -1254,3 +1254,41 @@ def remove_artificial_nodes(param_dico):
edge
=
{
"
A
"
:
source
[
'
source
'
],
"
B
"
:
sink
[
'
sink
'
],
"
label
"
:
source
[
'
label
'
]}
dico
[
"
edges
"
].
append
(
edge
)
return
dico
def
enrich_json_with_positions
(
file
):
import
json
with
open
(
file
,
'
r
'
)
as
JSON
:
dico
=
json
.
load
(
JSON
)
pos_file
=
file
[:
-
len
(
"
.json
"
)]
+
"
_pos.dot
"
try
:
f
=
open
(
pos_file
)
contents_pos
=
f
.
read
()
f
.
close
()
except
:
return
def
search_for_pos
(
id
,
text
):
import
re
pattern
=
re
.
escape
(
id
)
+
r
'
.+\n.+\s+pos=
"
([^,]+),([^
"
]+)
"
,
'
for
match
in
re
.
finditer
(
pattern
,
text
):
return
match
.
group
(
1
),
match
.
group
(
2
)
return
-
1
,
-
1
def
enrich_nodes
(
wf_dico
):
for
node
in
wf_dico
[
"
nodes
"
]:
id
=
node
[
'
id
'
]
x_pos
,
y_pos
=
search_for_pos
(
id
,
contents_pos
)
if
(
x_pos
==-
1
and
y_pos
==-
1
):
return
else
:
node
[
'
position
'
]
=
{}
node
[
'
position
'
][
'
x
'
]
=
x_pos
node
[
'
position
'
][
'
y
'
]
=
y_pos
for
sub
in
wf_dico
[
'
subworkflows
'
]:
enrich_nodes
(
wf_dico
[
'
subworkflows
'
][
sub
])
enrich_nodes
(
dico
)
with
open
(
file
,
'
w
'
)
as
output_file
:
json
.
dump
(
dico
,
output_file
,
indent
=
4
)
This diff is collapsed.
Click to expand it.
src/workflow.py
+
13
−
1
View file @
f9d947fd
...
...
@@ -4,7 +4,7 @@ from .nextflow_file import Nextflow_File
from
.ro_crate
import
RO_Crate
from
.
import
constant
from
.outils
import
is_git_directory
,
format_with_tabs
,
replace_thing_by_call
,
replace_group1
,
group_together_ifs
,
extract_curly
,
remove_extra_jumps
,
get_channels_to_add_in_false_conditions
,
extract_conditions
,
remove_empty_conditions_place_anker
from
.outils_graph
import
get_flatten_dico
,
initia_link_dico_rec
,
get_number_cycles
,
generate_graph
from
.outils_graph
import
get_flatten_dico
,
initia_link_dico_rec
,
get_number_cycles
,
generate_graph
,
enrich_json_with_positions
from
.outils_annotate
import
get_tools_commands_from_user_for_process
from
.bioflowinsighterror
import
BioFlowInsightError
from
.graph
import
Graph
...
...
@@ -197,17 +197,29 @@ George Marchment, Bryan Brancotte, Marie Schmit, Frédéric Lemoine, Sarah Cohen
self
.
iniatilise_tab_processes_2_remove
()
self
.
graph
.
initialise
(
processes_2_remove
=
self
.
processes_2_remove
)
self
.
graph
.
get_specification_graph
(
render_graphs
=
render_graphs
)
self
.
enrich_json_files_with_positions
()
def
generate_process_dependency_graph
(
self
,
render_graphs
=
True
):
self
.
iniatilise_tab_processes_2_remove
()
self
.
graph
.
initialise
(
processes_2_remove
=
self
.
processes_2_remove
)
self
.
graph
.
render_process_dependency_graph
(
render_graphs
=
render_graphs
)
self
.
enrich_json_files_with_positions
()
#TODO -> update this
def
generate_all_graphs
(
self
,
render_graphs
=
True
):
self
.
generate_specification_graph
(
render_graphs
=
render_graphs
)
self
.
generate_process_dependency_graph
(
render_graphs
=
render_graphs
)
self
.
enrich_json_files_with_positions
()
#This function takes the json files and searches for the corrresponding dot pos files
#And adds the information regarding the position of the nodes
def
enrich_json_files_with_positions
(
self
):
jsons
=
glob
.
glob
(
f
'
{
self
.
get_output_dir
()
/
"
graphs
"
}
/*.json
'
,
recursive
=
False
)
for
file
in
jsons
:
enrich_json_with_positions
(
file
)
#Method that checks if a given graph sepcification is an isomorphism with the workflows
def
check_if_json_equal_to_full_structure
(
self
,
file
):
self
.
iniatilise_tab_processes_2_remove
()
...
...
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