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
bb78772a
Commit
bb78772a
authored
1 year ago
by
George Marchment
Browse files
Options
Downloads
Patches
Plain Diff
added method get_layers
parent
4c4f91d0
No related branches found
No related tags found
No related merge requests found
Pipeline
#13380
passed with stage
in 1 minute
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/workflow.py
+26
-9
26 additions, 9 deletions
src/workflow.py
with
26 additions
and
9 deletions
src/workflow.py
+
26
−
9
View file @
bb78772a
...
...
@@ -2,13 +2,14 @@
from
.nextflow_file
import
Nextflow_File
from
.ro_crate
import
RO_Crate
from
.
import
constant
from
.outils_graph
import
flatten_dico
from
.outils_graph
import
flatten_dico
,
initia_link_dico_rec
,
get_number_cycles
import
os
import
re
import
json
from
pathlib
import
Path
import
glob
import
ctypes
from
.bioflowinsighterror
import
BioFlowInsightError
...
...
@@ -267,7 +268,7 @@ class Workflow:
if
(
not
graph
.
is_initialised
()):
graph
.
initialise
()
process_dependency_graph
=
graph
.
get_process_dependency_graph_dico
()
dico_flattened
=
{
"
nodes
"
:
[],
"
edges
"
:
[]}
dico_flattened
=
{
"
nodes
"
:
[],
"
edges
"
:
[],
"
subworkflows
"
:
[]}
def
get_node
(
dico
,
id
):
for
n
in
dico
[
'
nodes
'
]:
...
...
@@ -298,16 +299,27 @@ class Workflow:
print
(
"
prob2
"
)
flatten_dico
(
process_dependency_graph
,
dico_flattened
)
links
=
initia_link_dico_rec
(
dico_flattened
)
_
,
edges_create_cycles
=
get_number_cycles
(
links
)
#If the graph isn't a dag -> we remoce the edges which make it cyclic
for
A
,
B
in
edges_create_cycles
:
#print({"A":A, "B":B})
#print(dico_flattened["edges"])
dico_flattened
[
"
edges
"
].
remove
({
"
A
"
:
A
,
"
B
"
:
B
,
"
label
"
:
''
})
layers
=
[]
while
(
dico_flattened
[
"
nodes
"
]
!=
[]):
layer
=
dico_flattened
[
"
nodes
"
].
copy
()
for
edge
in
dico_flattened
[
"
edges
"
]:
try
:
layer
.
remove
(
get_node
(
dico_flattened
,
edge
[
'
B
'
]))
except
:
None
removed
=
False
node
=
get_node
(
dico_flattened
,
edge
[
'
B
'
])
while
(
not
removed
):
try
:
layer
.
remove
(
node
)
except
:
removed
=
True
for
node
in
layer
:
...
...
@@ -315,10 +327,15 @@ class Workflow:
remove_edge_if_A
(
dico_flattened
,
node
[
'
id
'
])
layers
.
append
(
layer
)
return
layers
layers_object
=
[]
for
layer
in
layers
:
tab
=
[]
for
element
in
layer
:
address
=
int
(
re
.
findall
(
r
"
\dx\w+
"
,
element
[
'
id
'
])[
0
],
base
=
16
)
tab
.
append
(
ctypes
.
cast
(
address
,
ctypes
.
py_object
).
value
)
layers_object
.
append
(
tab
)
return
layers_object
print
(
flatten_dico
(
process_dependency_graph
,
dico_flattened
))
def
initialise
(
self
,
create_rocrate
=
True
):
self
.
nextflow_file
.
initialise
()
...
...
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