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
0
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
c9325b73
Commit
c9325b73
authored
8 months ago
by
George Marchment
Browse files
Options
Downloads
Patches
Plain Diff
added some methods to thr process class
parent
97f3b761
No related branches found
No related tags found
No related merge requests found
Pipeline
#13876
passed with stage
Stage:
in 1 minute and 4 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/process.py
+37
-6
37 additions, 6 deletions
src/process.py
with
37 additions
and
6 deletions
src/process.py
+
37
−
6
View file @
c9325b73
...
@@ -19,6 +19,7 @@ class Process(Nextflow_Building_Blocks):
...
@@ -19,6 +19,7 @@ class Process(Nextflow_Building_Blocks):
self
.
input_code
=
""
self
.
input_code
=
""
self
.
output_code
=
""
self
.
output_code
=
""
self
.
when_code
=
""
self
.
when_code
=
""
self
.
pusblishDir_code
=
""
self
.
script_code
=
""
self
.
script_code
=
""
self
.
tools
=
[]
self
.
tools
=
[]
self
.
modules
=
[]
self
.
modules
=
[]
...
@@ -103,7 +104,7 @@ class Process(Nextflow_Building_Blocks):
...
@@ -103,7 +104,7 @@ class Process(Nextflow_Building_Blocks):
packages
=
[]
packages
=
[]
packages
+=
self
.
get_python_packages_imported_internal_script
()
packages
+=
self
.
get_python_packages_imported_internal_script
()
packages
+=
self
.
get_python_packages_imported_external_scripts
()
packages
+=
self
.
get_python_packages_imported_external_scripts
()
return
packages
return
list
(
set
(
packages
))
def
get_R_libraries_loaded_internal_script
(
self
):
def
get_R_libraries_loaded_internal_script
(
self
):
...
@@ -122,7 +123,7 @@ class Process(Nextflow_Building_Blocks):
...
@@ -122,7 +123,7 @@ class Process(Nextflow_Building_Blocks):
libraries
=
[]
libraries
=
[]
libraries
+=
self
.
get_R_libraries_loaded_internal_script
()
libraries
+=
self
.
get_R_libraries_loaded_internal_script
()
libraries
+=
self
.
get_R_libraries_loaded_external_scripts
()
libraries
+=
self
.
get_R_libraries_loaded_external_scripts
()
return
libraries
return
list
(
set
(
libraries
))
#TODO -> do the same with Ruby/PErl scripts
#TODO -> do the same with Ruby/PErl scripts
...
@@ -155,6 +156,11 @@ class Process(Nextflow_Building_Blocks):
...
@@ -155,6 +156,11 @@ class Process(Nextflow_Building_Blocks):
def
get_input_code_lines
(
self
):
tab
=
[]
for
l
in
self
.
input_code
.
split
(
'
\n
'
):
tab
.
append
(
l
.
strip
())
return
tab
def
get_inputs
(
self
):
def
get_inputs
(
self
):
return
self
.
inputs
return
self
.
inputs
...
@@ -165,6 +171,12 @@ class Process(Nextflow_Building_Blocks):
...
@@ -165,6 +171,12 @@ class Process(Nextflow_Building_Blocks):
def
get_outputs
(
self
):
def
get_outputs
(
self
):
return
self
.
outputs
return
self
.
outputs
def
get_output_code_lines
(
self
):
tab
=
[]
for
l
in
self
.
output_code
.
split
(
'
\n
'
):
tab
.
append
(
l
.
strip
())
return
tab
def
get_nb_outputs
(
self
):
def
get_nb_outputs
(
self
):
return
len
(
self
.
outputs
)
return
len
(
self
.
outputs
)
...
@@ -184,6 +196,14 @@ class Process(Nextflow_Building_Blocks):
...
@@ -184,6 +196,14 @@ class Process(Nextflow_Building_Blocks):
temp_code
=
temp_code
[:
-
1
].
strip
()
temp_code
=
temp_code
[:
-
1
].
strip
()
if
(
len
(
temp_code
)
==
0
):
if
(
len
(
temp_code
)
==
0
):
raise
BioFlowInsightError
(
f
"
The process
'
{
self
.
get_name
()
}
'
defined in the file
'
{
self
.
get_file_address
()
}
'
is an empty process!
"
,
num
=
22
,
origin
=
self
)
raise
BioFlowInsightError
(
f
"
The process
'
{
self
.
get_name
()
}
'
defined in the file
'
{
self
.
get_file_address
()
}
'
is an empty process!
"
,
num
=
22
,
origin
=
self
)
publishDir_multiple
,
publishDir_pos
=
False
,
(
0
,
0
)
for
match
in
re
.
finditer
(
r
"
publishDir
"
,
code
):
#if(publishDir_multiple):
# raise BioFlowInsightError(f"Multiple 'publishDir' were found in the process '{self.get_name()}'.", num = 22, origin=self)
publishDir_pos
=
match
.
span
(
0
)
publishDir_multiple
=
True
input_multiple
,
input_pos
=
False
,
(
0
,
0
)
input_multiple
,
input_pos
=
False
,
(
0
,
0
)
for
match
in
re
.
finditer
(
constant
.
INPUT
,
code
):
for
match
in
re
.
finditer
(
constant
.
INPUT
,
code
):
if
(
input_multiple
):
if
(
input_multiple
):
...
@@ -210,8 +230,8 @@ class Process(Nextflow_Building_Blocks):
...
@@ -210,8 +230,8 @@ class Process(Nextflow_Building_Blocks):
script_pos
=
match
.
span
(
0
)
script_pos
=
match
.
span
(
0
)
break
break
positions
=
[
input_pos
,
output_pos
,
when_pos
,
script_pos
]
positions
=
[
publishDir_pos
,
input_pos
,
output_pos
,
when_pos
,
script_pos
]
variables_index
=
[
'
input
'
,
'
output
'
,
'
when
'
,
'
script
'
]
variables_index
=
[
'
pusblishDir
'
,
'
input
'
,
'
output
'
,
'
when
'
,
'
script
'
]
positions
,
variables_index
=
sort_and_filter
(
positions
,
variables_index
)
positions
,
variables_index
=
sort_and_filter
(
positions
,
variables_index
)
...
@@ -226,6 +246,8 @@ class Process(Nextflow_Building_Blocks):
...
@@ -226,6 +246,8 @@ class Process(Nextflow_Building_Blocks):
self
.
input_code
=
temp_code
self
.
input_code
=
temp_code
elif
(
variables_index
[
i
]
==
'
output
'
):
elif
(
variables_index
[
i
]
==
'
output
'
):
self
.
output_code
=
temp_code
self
.
output_code
=
temp_code
elif
(
variables_index
[
i
]
==
'
pusblishDir
'
):
self
.
pusblishDir_code
=
temp_code
elif
(
variables_index
[
i
]
==
'
when
'
):
elif
(
variables_index
[
i
]
==
'
when
'
):
self
.
when_code
=
temp_code
self
.
when_code
=
temp_code
elif
(
variables_index
[
i
]
==
'
script
'
):
elif
(
variables_index
[
i
]
==
'
script
'
):
...
@@ -305,11 +327,20 @@ class Process(Nextflow_Building_Blocks):
...
@@ -305,11 +327,20 @@ class Process(Nextflow_Building_Blocks):
def
get_input_parameters
(
self
):
def
get_input_parameters
(
self
):
code
=
self
.
get_input_code
()
code
=
self
.
get_input_code
()
#This is to remove the from for the DSL1 processes
#But also remoce the 'stageAs'
lines
=
code
.
split
(
'
\n
'
)
code
=
""
for
l
in
lines
:
code
+=
l
.
split
(
"
from
"
)[
0
].
split
(
"
stageAs
"
)[
0
]
code
+
'
\n
'
parameters
=
[]
parameters
=
[]
for
match
in
re
.
finditer
(
r
"
\w+
"
,
code
):
for
match
in
re
.
finditer
(
r
"
\w+
(\.\w+)*
"
,
code
):
parameters
.
append
(
match
.
group
(
0
))
parameters
.
append
(
match
.
group
(
0
))
parameters
=
list
(
set
(
parameters
))
#Here we can a unique cause a parameter can only be given once in any case
parameters
=
list
(
set
(
parameters
))
#Here we can a unique cause a parameter can only be given once in any case
words_2_remove
=
[
"
path
"
,
"
val
"
,
"
tuple
"
,
"
into
"
,
"
stageAs
"
,
"
emit
"
]
words_2_remove
=
[
"
path
"
,
"
val
"
,
"
tuple
"
,
"
into
"
,
"
stageAs
"
,
"
emit
"
,
"
file
"
,
"
set
"
]
for
word
in
words_2_remove
:
for
word
in
words_2_remove
:
try
:
try
:
parameters
.
remove
(
word
)
parameters
.
remove
(
word
)
...
...
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