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
3fb7c24c
Commit
3fb7c24c
authored
4 months ago
by
George Marchment
Browse files
Options
Downloads
Patches
Plain Diff
Added functionnality to romve certain conditions + get dico most influential conditions
parent
40ab502b
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#14352
failed with stage
Stage:
in 2 minutes and 36 seconds
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
src/block.py
+4
-1
4 additions, 1 deletion
src/block.py
src/main.py
+43
-3
43 additions, 3 deletions
src/main.py
src/nextflow_file.py
+2
-0
2 additions, 0 deletions
src/nextflow_file.py
src/root.py
+6
-3
6 additions, 3 deletions
src/root.py
src/workflow.py
+7
-13
7 additions, 13 deletions
src/workflow.py
with
62 additions
and
20 deletions
src/block.py
+
4
−
1
View file @
3fb7c24c
...
...
@@ -8,8 +8,11 @@ class Block(Root):
self
.
condition
=
Condition
(
origin
=
self
,
condition
=
condition
)
def
initialise
(
self
):
if
(
self
.
condition
.
value
not
in
[]
):
if
(
self
.
condition
.
value
not
in
self
.
origin
.
get_conditions_2_ignore
()
):
return
super
().
initialise
()
def
get_conditions_2_ignore
(
self
):
return
self
.
origin
.
get_conditions_2_ignore
()
def
get_type
(
self
):
return
"
Block
"
...
...
This diff is collapsed.
Click to expand it.
src/main.py
+
43
−
3
View file @
3fb7c24c
...
...
@@ -21,6 +21,9 @@ class Main(Nextflow_Building_Blocks):
#def check_in_channels(self, channel):
# return self.root.check_in_channels(channel)
def
get_conditions_2_ignore
(
self
):
return
self
.
nextflow_file
.
get_conditions_2_ignore
()
def
get_modules_defined
(
self
):
return
self
.
nextflow_file
.
get_modules_defined
()
...
...
@@ -41,9 +44,9 @@ class Main(Nextflow_Building_Blocks):
def
get_type
(
self
):
return
"
Main
"
def
get_all_calls
(
self
):
def
get_all_calls
_in_subworkflow
(
self
):
dico
=
{}
self
.
root
.
get_all_calls
(
calls
=
dico
)
self
.
root
.
get_all_calls
_in_subworkflow
(
calls
=
dico
)
return
list
(
dico
.
keys
())
...
...
@@ -81,4 +84,41 @@ class Main(Nextflow_Building_Blocks):
def
get_structure
(
self
,
dico
):
self
.
root
.
get_structure
(
dico
)
return
dico
\ No newline at end of file
def
get_most_influential_conditions
(
self
):
most_influential_conditions
=
{}
all_calls
=
self
.
get_all_calls_in_subworkflow
()
for
c
in
all_calls
:
if
(
c
.
get_first_element_called
().
get_type
()
==
"
Process
"
):
for
condition
in
c
.
get_block
().
get_all_conditions
(
conditions
=
{}):
try
:
temp
=
most_influential_conditions
[
condition
]
except
:
most_influential_conditions
[
condition
]
=
0
most_influential_conditions
[
condition
]
+=
1
if
(
c
.
get_first_element_called
().
get_type
()
==
"
Subworkflow
"
):
#Adding the number of calls from a process at the root of the subworkflow
num
=
0
calls_at_root
=
c
.
get_first_element_called
().
root
.
get_calls_same_level
()
for
call_at_root
in
calls_at_root
:
for
c_at_root
in
call_at_root
.
get_all_calls
():
if
(
c_at_root
.
get_first_element_called
().
get_type
()
==
"
Process
"
):
num
+=
1
most_influential_conditions_in_sub
=
c
.
get_first_element_called
().
get_most_influential_conditions
()
#Adding the conditions from inside the subworkflow
for
condition
in
most_influential_conditions_in_sub
:
try
:
temp
=
most_influential_conditions
[
condition
]
except
:
most_influential_conditions
[
condition
]
=
0
num
+=
most_influential_conditions_in_sub
[
condition
]
most_influential_conditions
[
condition
]
+=
most_influential_conditions_in_sub
[
condition
]
#Adding calls from the subworkflow to the conditions
for
condition
in
c
.
get_block
().
get_all_conditions
(
conditions
=
{}):
try
:
temp
=
most_influential_conditions
[
condition
]
except
:
most_influential_conditions
[
condition
]
=
0
most_influential_conditions
[
condition
]
+=
num
return
most_influential_conditions
\ No newline at end of file
This diff is collapsed.
Click to expand it.
src/nextflow_file.py
+
2
−
0
View file @
3fb7c24c
...
...
@@ -43,6 +43,8 @@ class Nextflow_File(Nextflow_Building_Blocks):
def
get_string_line
(
self
,
bit_of_code
):
return
self
.
code
.
get_string_line
(
bit_of_code
)
def
get_conditions_2_ignore
(
self
):
return
self
.
workflow
.
get_conditions_2_ignore
()
#Method that returns the address of the file
def
get_file_address
(
self
):
...
...
This diff is collapsed.
Click to expand it.
src/root.py
+
6
−
3
View file @
3fb7c24c
...
...
@@ -28,6 +28,9 @@ class Root(Nextflow_Building_Blocks):
def
get_blocks
(
self
):
return
self
.
blocks
def
get_conditions_2_ignore
(
self
):
return
self
.
origin
.
get_conditions_2_ignore
()
def
add_element_to_elements_being_called
(
self
,
element
):
self
.
elements_being_called
.
append
(
element
)
...
...
@@ -207,13 +210,13 @@ class Root(Nextflow_Building_Blocks):
def
get_calls_from_other_blocks_on_same_level
(
self
):
return
[]
def
get_all_calls
(
self
,
calls
=
{}):
def
get_all_calls
_in_subworkflow
(
self
,
calls
=
{}):
all_calls
=
self
.
get_calls_same_level
()
+
self
.
get_calls_inside_level
()
for
call
in
all_calls
:
for
c
in
call
.
get_all_calls
():
calls
[
c
]
=
''
if
(
c
.
get_first_element_called
().
get_type
()
==
"
Subworkflow
"
):
c
.
get_first_element_called
().
root
.
get_all_calls
(
calls
=
calls
)
#
if(c.get_first_element_called().get_type()=="Subworkflow"):
#
c.get_first_element_called().root.get_all_calls(calls = calls)
...
...
This diff is collapsed.
Click to expand it.
src/workflow.py
+
7
−
13
View file @
3fb7c24c
...
...
@@ -68,6 +68,7 @@ class Workflow:
self
.
workflow_directory
=
'
/
'
.
join
(
file
.
split
(
'
/
'
)[:
-
1
])
self
.
name
=
name
self
.
graph
=
None
self
.
conditions_2_ignore
=
[]
OG_file
=
Nextflow_File
(
file
,
workflow
=
self
,
first_file
=
True
)
...
...
@@ -89,6 +90,9 @@ class Workflow:
with
open
(
self
.
output_dir
/
"
debug
"
/
"
operations_in_call.nf
"
,
'
w
'
)
as
file
:
pass
def
get_conditions_2_ignore
(
self
):
return
self
.
conditions_2_ignore
def
get_duplicate_status
(
self
):
return
self
.
duplicate
...
...
@@ -116,13 +120,13 @@ class Workflow:
self
.
nextflow_files
.
append
(
nextflow_file
)
self
.
nextflow_files
=
list
(
set
(
self
.
nextflow_files
))
def
initialise
(
self
):
def
initialise
(
self
,
conditions_2_ignore
=
[]
):
"""
Method that initialises the analysis of the worflow
Keyword arguments:
"""
self
.
conditions_2_ignore
=
conditions_2_ignore
#Right now i'm just gonna do everything in DSL2
#At this point there should only be one nextflow file
...
...
@@ -182,17 +186,8 @@ George Marchment, Bryan Brancotte, Marie Schmit, Frédéric Lemoine, Sarah Cohen
#10 process calls depend on condition2
#3 process calls depend on condition3
def
get_most_influential_conditions
(
self
,
show_values
=
True
):
most_influential_conditions
=
{}
if
(
self
.
get_duplicate_status
()):
all_calls
=
self
.
get_workflow_main
().
get_all_calls
()
for
c
in
all_calls
:
if
(
c
.
get_first_element_called
().
get_type
()
==
"
Process
"
):
for
condition
in
c
.
get_block
().
get_all_conditions
(
conditions
=
{}):
try
:
temp
=
most_influential_conditions
[
condition
]
except
:
most_influential_conditions
[
condition
]
=
0
most_influential_conditions
[
condition
]
+=
1
most_influential_conditions
=
self
.
get_workflow_main
().
get_most_influential_conditions
()
#If show values then we replace the the conditions ids with their values
if
(
show_values
):
most_influential_conditions_values
=
{}
...
...
@@ -206,7 +201,6 @@ George Marchment, Bryan Brancotte, Marie Schmit, Frédéric Lemoine, Sarah Cohen
#Sort the dico
most_influential_conditions
=
{
k
:
v
for
k
,
v
in
sorted
(
most_influential_conditions
.
items
(),
key
=
lambda
item
:
item
[
1
],
reverse
=
True
)}
return
most_influential_conditions
else
:
BioFlowInsightError
(
"
Need to activate
'
duplicate
'
mode to use this method.
"
)
...
...
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