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
4df87025
Commit
4df87025
authored
3 months ago
by
George Marchment
Browse files
Options
Downloads
Patches
Plain Diff
Continued adding rewriting
parent
d1821857
No related branches found
No related tags found
No related merge requests found
Pipeline
#14379
failed with stage
in 2 minutes and 13 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/workflow.py
+54
-22
54 additions, 22 deletions
src/workflow.py
with
54 additions
and
22 deletions
src/workflow.py
+
54
−
22
View file @
4df87025
...
@@ -446,6 +446,7 @@ George Marchment, Bryan Brancotte, Marie Schmit, Frédéric Lemoine, Sarah Cohen
...
@@ -446,6 +446,7 @@ George Marchment, Bryan Brancotte, Marie Schmit, Frédéric Lemoine, Sarah Cohen
#Replace old analysis with new analysis (simplified code)
#Replace old analysis with new analysis (simplified code)
self
.
__init__
(
str
(
temp_file
),
display_info
=
False
,
duplicate
=
True
)
self
.
__init__
(
str
(
temp_file
),
display_info
=
False
,
duplicate
=
True
)
self
.
initialise
()
self
.
initialise
()
self
.
generate_all_graphs
()
def
check_relevant_processes_in_workflow
(
self
,
relevant_processes
):
def
check_relevant_processes_in_workflow
(
self
,
relevant_processes
):
#Check all relevat processes are in wf
#Check all relevat processes are in wf
...
@@ -484,10 +485,41 @@ George Marchment, Bryan Brancotte, Marie Schmit, Frédéric Lemoine, Sarah Cohen
...
@@ -484,10 +485,41 @@ George Marchment, Bryan Brancotte, Marie Schmit, Frédéric Lemoine, Sarah Cohen
for
i
in
range
(
len
(
parameters
)):
for
i
in
range
(
len
(
parameters
)):
param
=
parameters
[
i
]
param
=
parameters
[
i
]
takes
=
subworkflow_takes
[
i
].
get_gives
()[
0
]
takes
=
subworkflow_takes
[
i
].
get_gives
()[
0
]
if
(
takes
.
get_code
()
!=
param
.
get_code
(
get_OG
=
True
)):
#Here we're checking that the input inside and outside the subworkflow are the same
#If they are we're going to remove everything to avoid the case
"""
param_1 = fastq
sub(param_1)
AND in the subworkflow
sub{
take:
fastq
}
----------
This would mean when removing the subworkflow def -> we would get this:
param_1 = fastq
fastq = param_1
"""
#Obviously we want to avoid this case
input_val
=
""
try
:
input_val
=
param
.
origins
[
0
].
get_source
()[
0
].
get_origins
()[
0
].
get_name
()
except
:
input_val
=
param
.
get_code
(
get_OG
=
True
)
if
(
takes
.
get_code
()
!=
input_val
):
new_header
+=
f
"
{
takes
.
get_code
()
}
=
{
param
.
get_code
(
get_OG
=
True
)
}
"
new_header
+=
f
"
{
takes
.
get_code
()
}
=
{
param
.
get_code
(
get_OG
=
True
)
}
"
else
:
#In the case they are the same -> we remove the remaining operation (which doesn't serve a purpose)
#The "param_1 = fastq" operation
operation_code
=
param
.
origins
[
0
].
get_source
()[
0
].
get_code
()
code
=
code
.
replace
(
operation_code
,
""
,
1
)
code
=
code
.
replace
(
OG_call
.
get_code
(
get_OG
=
True
),
f
"
{
new_header
}
\n\n
{
OG_body
}
"
)
code
=
code
.
replace
(
OG_call
.
get_code
(
get_OG
=
True
),
f
"
{
new_header
}
\n\n
{
OG_body
}
"
,
1
)
#REPLACE THE EMITS
#REPLACE THE EMITS
#TODO admittedly this code below is very moche -> but it's functionnal -> update it
#TODO admittedly this code below is very moche -> but it's functionnal -> update it
...
@@ -501,7 +533,7 @@ George Marchment, Bryan Brancotte, Marie Schmit, Frédéric Lemoine, Sarah Cohen
...
@@ -501,7 +533,7 @@ George Marchment, Bryan Brancotte, Marie Schmit, Frédéric Lemoine, Sarah Cohen
if
(
len
(
emited
)
==
1
):
if
(
len
(
emited
)
==
1
):
emited
=
emited
[
0
]
emited
=
emited
[
0
]
if
(
emited
.
get_type
()
==
"
Emitted
"
):
if
(
emited
.
get_type
()
==
"
Emitted
"
):
if
(
emited
.
get_emitted_by
()
==
subworklfow
):
if
(
emited
.
get_emitted_by
()
.
get_first_element_called
()
==
subworklfow
):
if
(
emited
.
get_emits
()
not
in
emits
):
if
(
emited
.
get_emits
()
not
in
emits
):
raise
Exception
(
"
This shoudn
'
t happen -> since it is the actual subworkflow
"
)
raise
Exception
(
"
This shoudn
'
t happen -> since it is the actual subworkflow
"
)
to_replace
.
append
((
exe
.
get_code
(
get_OG
=
True
),
f
"
{
exe
.
get_gives
()[
0
].
get_code
()
}
=
{
emited
.
get_emits
().
get_origins
()[
0
].
get_code
()
}
"
))
to_replace
.
append
((
exe
.
get_code
(
get_OG
=
True
),
f
"
{
exe
.
get_gives
()[
0
].
get_code
()
}
=
{
emited
.
get_emits
().
get_origins
()[
0
].
get_code
()
}
"
))
...
@@ -586,25 +618,25 @@ George Marchment, Bryan Brancotte, Marie Schmit, Frédéric Lemoine, Sarah Cohen
...
@@ -586,25 +618,25 @@ George Marchment, Bryan Brancotte, Marie Schmit, Frédéric Lemoine, Sarah Cohen
for
sub
in
broken_subworkflows
:
for
sub
in
broken_subworkflows
:
code
=
self
.
rewrite_subworkflow_call
(
code
,
sub
)
code
=
self
.
rewrite_subworkflow_call
(
code
,
sub
)
#
#TODO -> this needs to be optimised
#TODO -> this needs to be optimised
#
self.rewrite_and_initialise(code)
self
.
rewrite_and_initialise
(
code
)
#
#Get the clusters and the code
#Get the clusters and the code
#
self.
nextflow_file.
generate_user_view(relevant_processes = relevant_processes, processes_2_remove = [])
self
.
generate_user_view
(
relevant_processes
=
relevant_processes
,
processes_2_remove
=
[])
#
clusters = self.
nextflow_file.
graph.get_clusters_from_user_view()
clusters
=
self
.
graph
.
get_clusters_from_user_view
()
#
print
(
clusters
)
#
#
#
#Get the clsuters with the corresponding operations inside
#Get the clsuters with the corresponding operations inside
#
#for i in range(len(clusters)):
#for i in range(len(clusters)):
#
#
c = clusters[i]
# c = clusters[i]
#
#
if(len(c)>1):
# if(len(c)>1):
#
#
clusters[i] = self.nextflow_file.graph.get_induced_subgraph(c)
# clusters[i] = self.nextflow_file.graph.get_induced_subgraph(c)
#
#print(clusters)
#print(clusters)
#
#Get the topological order
#Get the topological order
#
clusters = self.
nextflow_file.
graph.get_topogical_order(clusters)
clusters
=
self
.
graph
.
get_topogical_order
(
clusters
)
##print(clusters)
#
#
##Creating the subworkflows from clusters
##Creating the subworkflows from clusters
#calls_in_operations = []
#calls_in_operations = []
#non_relevant_name = 1
#non_relevant_name = 1
...
...
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