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
6b23c6de
Commit
6b23c6de
authored
6 months ago
by
George Marchment
Browse files
Options
Downloads
Patches
Plain Diff
update to DSL1 to DSL2: add val around variables in tuple
parent
678ab80b
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#14264
failed with stage
Stage:
in 2 minutes and 17 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/outils.py
+26
-1
26 additions, 1 deletion
src/outils.py
src/process.py
+9
-4
9 additions, 4 deletions
src/process.py
src/workflow.py
+4
-4
4 additions, 4 deletions
src/workflow.py
with
39 additions
and
9 deletions
src/outils.py
+
26
−
1
View file @
6b23c6de
...
@@ -1053,7 +1053,32 @@ def process_2_DSL2(code):
...
@@ -1053,7 +1053,32 @@ def process_2_DSL2(code):
code
=
re
.
sub
(
r
'
file( | *\()
'
,
replace_file_by_path
,
code
)
code
=
re
.
sub
(
r
'
file( | *\()
'
,
replace_file_by_path
,
code
)
code
=
re
.
sub
(
r
'
set( | *\()
'
,
replace_set_by_tuple
,
code
)
code
=
re
.
sub
(
r
'
set( | *\()
'
,
replace_set_by_tuple
,
code
)
return
code
return
add_vals_when_necessary
(
code
)
#Function that adds vals around variables in a tuple
def
add_vals_when_necessary
(
line
):
starts_with_tuple
=
False
code_to_replace
=
""
for
match
in
re
.
finditer
(
r
"
tuple\s*\((.+)\)
"
,
line
):
starts_with_tuple
=
True
code_to_replace
=
match
.
group
(
1
)
if
(
not
starts_with_tuple
):
for
match
in
re
.
finditer
(
r
"
tuple\s*(.+)
"
,
line
):
starts_with_tuple
=
True
code_to_replace
=
match
.
group
(
1
)
if
(
starts_with_tuple
):
code_to_replace
=
re
.
split
(
r
'
\,\s*emit\s*\:
'
,
code_to_replace
)[
0
]
#Adding val to cases where it's just the variable
line_split
=
code_to_replace
.
split
(
'
,
'
)
for
y
in
range
(
len
(
line_split
))
:
param
=
line_split
[
y
]
if
(
bool
(
re
.
fullmatch
(
'
\w+
'
,
param
.
strip
()))):
line_split
[
y
]
=
f
"
val(
{
param
.
strip
()
}
)
"
temp
=
"
,
"
.
join
(
line_split
)
line
=
line
.
replace
(
code_to_replace
,
temp
)
return
line
def
operation_2_DSL2
(
code
,
origin
):
def
operation_2_DSL2
(
code
,
origin
):
...
...
This diff is collapsed.
Click to expand it.
src/process.py
+
9
−
4
View file @
6b23c6de
...
@@ -558,15 +558,20 @@ class Process(Nextflow_Building_Blocks):
...
@@ -558,15 +558,20 @@ class Process(Nextflow_Building_Blocks):
code
=
process_2_DSL2
(
code
)
code
=
process_2_DSL2
(
code
)
lines
=
[]
lines
=
[]
for
line
in
code
.
split
(
"
\n
"
):
for
line
in
code
.
split
(
"
\n
"
):
lines
.
append
(
line
.
split
(
"
from
"
)[
0
])
temp
=
process_2_DSL2
(
line
.
split
(
"
from
"
)[
0
])
lines
.
append
(
temp
)
code
=
"
\n
"
.
join
(
lines
)
code
=
"
\n
"
.
join
(
lines
)
return
code
return
code
def
convert_output_code_to_DSL2
(
self
):
def
convert_output_code_to_DSL2
(
self
):
code
=
self
.
output_code
code
=
self
.
output_code
code
=
process_2_DSL2
(
code
)
lines
=
[]
code
=
code
.
replace
(
"
into
"
,
"
, emit:
"
)
for
line
in
code
.
split
(
"
\n
"
):
code
=
code
.
replace
(
"
mode flatten
"
,
""
)
line
=
line
.
replace
(
"
into
"
,
"
, emit:
"
)
line
=
line
.
replace
(
"
mode flatten
"
,
""
)
line
=
process_2_DSL2
(
line
)
lines
.
append
(
line
)
code
=
"
\n
"
.
join
(
lines
)
return
code
return
code
#This method is to detect which are the channels which need to be flattened
#This method is to detect which are the channels which need to be flattened
...
...
This diff is collapsed.
Click to expand it.
src/workflow.py
+
4
−
4
View file @
6b23c6de
...
@@ -856,7 +856,7 @@ George Marchment, Bryan Brancotte, Marie Schmit, Frédéric Lemoine, Sarah Cohen
...
@@ -856,7 +856,7 @@ George Marchment, Bryan Brancotte, Marie Schmit, Frédéric Lemoine, Sarah Cohen
processes_added
=
[]
processes_added
=
[]
things_added_in_cluster
=
[]
things_added_in_cluster
=
[]
if
(
len
(
elements
)
>
1
):
if
(
len
(
elements
)
>
1
):
name
,
body
,
take
,
emit
=
""
,
"
main:
\n
"
,
""
,
""
name
,
body
,
take
,
emit
=
""
,
""
,
""
,
""
first_element
=
True
first_element
=
True
for
ele
in
elements
:
for
ele
in
elements
:
...
@@ -976,9 +976,9 @@ George Marchment, Bryan Brancotte, Marie Schmit, Frédéric Lemoine, Sarah Cohen
...
@@ -976,9 +976,9 @@ George Marchment, Bryan Brancotte, Marie Schmit, Frédéric Lemoine, Sarah Cohen
#Replace names inside subworkflow
#Replace names inside subworkflow
subworkflow_code
=
f
"
sub
workflow
{
name
}
{{
\n
{
take
}
\n
{
body
}
\n
{
emit
}
\n
}}
"
subworkflow_code
=
f
"
workflow
{
name
}
{{
\n
{
take
}
\
n
main:
\
n
{
body
}
\n
{
emit
}
\n
}}
"
for
i
in
range
(
len
(
new_param_names
)):
for
i
in
range
(
len
(
new_param_names
)):
pattern
=
fr
"
[\=\,\(] *(
{
re
.
escape
(
takes_param
[
i
].
get_code
())
}
)[\s\,\)]
"
pattern
=
fr
"
[\=\,\(] *(
{
re
.
escape
(
takes_param
[
i
].
get_code
())
}
)[\s\,\)
\.
]
"
subworkflow_code
=
replace_group1
(
subworkflow_code
,
pattern
,
new_param_names
[
i
])
subworkflow_code
=
replace_group1
(
subworkflow_code
,
pattern
,
new_param_names
[
i
])
#subworkflow_code = subworkflow_code.replace(takes_param[i].get_code(), new_param_names[i])
#subworkflow_code = subworkflow_code.replace(takes_param[i].get_code(), new_param_names[i])
...
@@ -1011,7 +1011,7 @@ George Marchment, Bryan Brancotte, Marie Schmit, Frédéric Lemoine, Sarah Cohen
...
@@ -1011,7 +1011,7 @@ George Marchment, Bryan Brancotte, Marie Schmit, Frédéric Lemoine, Sarah Cohen
print
(
format_with_tabs
(
subworkflow_code
))
print
(
format_with_tabs
(
subworkflow_code
))
print
(
"
-----------
"
)
print
(
"
//
-----------
"
)
#TODO -> rmoving the conditions which are problematic
#TODO -> rmoving the conditions which are problematic
...
...
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