Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
I
IMP
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
40
Issues
40
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Environments
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
IMP
IMP
Commits
d5c38874
Commit
d5c38874
authored
Feb 21, 2017
by
Yohan Jarosz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add env variable propagation via -e flag
parent
98c67744
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
36 deletions
+35
-36
impy.py
impy.py
+35
-36
No files found.
impy.py
View file @
d5c38874
...
@@ -39,12 +39,13 @@ CONTAINER_CODE_DIR = '/home/imp/code'
...
@@ -39,12 +39,13 @@ CONTAINER_CODE_DIR = '/home/imp/code'
@
click
.
option
(
'-b'
,
'--binning-method'
,
help
=
"Binning method to use."
,
type
=
click
.
Choice
([
'maxbin'
,
'no'
]),
default
=
'maxbin'
)
@
click
.
option
(
'-b'
,
'--binning-method'
,
help
=
"Binning method to use."
,
type
=
click
.
Choice
([
'maxbin'
,
'no'
]),
default
=
'maxbin'
)
@
click
.
option
(
'-c'
,
'--config-file-path'
,
help
=
'Set different config file path.'
)
@
click
.
option
(
'-c'
,
'--config-file-path'
,
help
=
'Set different config file path.'
)
@
click
.
option
(
'-d'
,
'--database-path'
,
help
=
'Set different database path.'
,
default
=
IMP_DEFAULT_DB_DIR
)
@
click
.
option
(
'-d'
,
'--database-path'
,
help
=
'Set different database path.'
,
default
=
IMP_DEFAULT_DB_DIR
)
@
click
.
option
(
'-e'
,
'--environment'
,
help
=
'Add an environment variable (-e <key>=<value>).'
,
multiple
=
True
)
@
click
.
option
(
'-s'
,
'--source-code'
,
help
=
'Use IMP source code at the file path specified instead of the one shipped inside the image.'
)
@
click
.
option
(
'-s'
,
'--source-code'
,
help
=
'Use IMP source code at the file path specified instead of the one shipped inside the image.'
)
@
click
.
option
(
'--threads'
,
default
=
4
,
help
=
'Number of threads to use'
)
@
click
.
option
(
'--threads'
,
default
=
4
,
help
=
'Number of threads to use'
)
@
click
.
option
(
'--memtotal'
,
default
=
8
,
help
=
'Cap of memory to use for megahit in GB.'
)
@
click
.
option
(
'--memtotal'
,
default
=
8
,
help
=
'Cap of memory to use for megahit in GB.'
)
@
click
.
option
(
'--memcore'
,
default
=
2
,
help
=
'Memory allowed per core for samtools in GB.'
)
@
click
.
option
(
'--memcore'
,
default
=
2
,
help
=
'Memory allowed per core for samtools in GB.'
)
@
click
.
pass_context
@
click
.
pass_context
def
cli
(
ctx
,
image_name
,
image_tag
,
image_repo
,
threads
,
memtotal
,
assembler
,
binning_method
,
memcore
,
database_path
,
config_file_path
,
source_code
,
enter
):
def
cli
(
ctx
,
image_name
,
image_tag
,
image_repo
,
threads
,
memtotal
,
assembler
,
binning_method
,
memcore
,
database_path
,
config_file_path
,
source_code
,
enter
,
environment
):
"""Integrated Metaomic Pipeline"""
"""Integrated Metaomic Pipeline"""
if
not
ctx
.
obj
:
if
not
ctx
.
obj
:
ctx
.
obj
=
{}
ctx
.
obj
=
{}
...
@@ -93,6 +94,10 @@ def cli(ctx, image_name, image_tag, image_repo, threads, memtotal, assembler, bi
...
@@ -93,6 +94,10 @@ def cli(ctx, image_name, image_tag, image_repo, threads, memtotal, assembler, bi
click
.
secho
(
"`database path` must be a directory."
,
fg
=
'red'
,
bold
=
True
)
click
.
secho
(
"`database path` must be a directory."
,
fg
=
'red'
,
bold
=
True
)
ctx
.
abort
()
ctx
.
abort
()
ctx
.
obj
[
'environment'
]
=
{}
for
value
in
environment
:
k
,
v
=
value
.
split
(
'='
)
ctx
.
obj
[
'environment'
][
k
]
=
v
# # TODO # add environment variables
# # TODO # add environment variables
# envs = ['-e {}="{}"'.format(*e.split('=')) for e in args['-e']]
# envs = ['-e {}="{}"'.format(*e.split('=')) for e in args['-e']]
...
@@ -378,7 +383,7 @@ def init(ctx, generate, index):
...
@@ -378,7 +383,7 @@ def init(ctx, generate, index):
ctx
.
abort
()
ctx
.
abort
()
click
.
secho
(
'IMP image found'
,
fg
=
'green'
)
click
.
secho
(
'IMP image found'
,
fg
=
'green'
)
ev
=
{}
ev
=
ctx
.
obj
[
'environment'
]
# check if fasta file is provided
# check if fasta file is provided
if
index
:
if
index
:
...
@@ -522,17 +527,15 @@ def preprocessing(ctx, metagenomic, metranscriptomic,
...
@@ -522,17 +527,15 @@ def preprocessing(ctx, metagenomic, metranscriptomic,
click
.
secho
(
'Metatranscriptomic data should be 2 paired files.'
,
fg
=
'red'
,
bold
=
True
)
click
.
secho
(
'Metatranscriptomic data should be 2 paired files.'
,
fg
=
'red'
,
bold
=
True
)
ctx
.
abort
()
ctx
.
abort
()
ev
=
ctx
.
obj
[
'environment'
]
ev
=
{
ev
[
'IMP_BINNING_METHOD'
]
=
ctx
.
obj
[
'binning-method'
]
'IMP_BINNING_METHOD'
:
ctx
.
obj
[
'binning-method'
],
ev
[
'MEMTOTAL'
]
=
ctx
.
obj
[
'memtotal'
]
'MEMTOTAL'
:
ctx
.
obj
[
'memtotal'
],
ev
[
'MEMCORE'
]
=
ctx
.
obj
[
'memcore'
]
'MEMCORE'
:
ctx
.
obj
[
'memcore'
],
ev
[
'THREADS'
]
=
ctx
.
obj
[
'threads'
]
'THREADS'
:
ctx
.
obj
[
'threads'
],
ev
[
'MG'
]
=
' '
.
join
(
mg_data
)
'MG'
:
' '
.
join
(
mg_data
),
ev
[
'MT'
]
=
' '
.
join
(
mt_data
)
'MT'
:
' '
.
join
(
mt_data
),
ev
[
'IMP_ASSEMBLER'
]
=
ctx
.
obj
[
'assembler'
]
'IMP_ASSEMBLER'
:
ctx
.
obj
[
'assembler'
],
ev
[
'IMP_STEPS'
]
=
' '
.
join
(
steps
)
'IMP_STEPS'
:
' '
.
join
(
steps
)
}
if
no_filtering
:
if
no_filtering
:
ev
[
'PREPROCESSING_FILTERING'
]
=
False
ev
[
'PREPROCESSING_FILTERING'
]
=
False
if
screen
:
if
screen
:
...
@@ -672,15 +675,14 @@ def assembly(ctx, metagenomic, metranscriptomic,
...
@@ -672,15 +675,14 @@ def assembly(ctx, metagenomic, metranscriptomic,
ctx
.
abort
()
ctx
.
abort
()
# <-- end assembly validation
# <-- end assembly validation
ev
=
ctx
.
obj
[
'environment'
]
ev
[
'IMP_BINNING_METHOD'
]
=
ctx
.
obj
[
'binning-method'
]
ev
[
'MEMTOTAL'
]
=
ctx
.
obj
[
'memtotal'
]
ev
[
'MEMCORE'
]
=
ctx
.
obj
[
'memcore'
]
ev
[
'THREADS'
]
=
ctx
.
obj
[
'threads'
]
ev
[
'IMP_ASSEMBLER'
]
=
ctx
.
obj
[
'assembler'
]
ev
[
'IMP_STEPS'
]
=
' '
.
join
(
steps
)
ev
=
{
'IMP_BINNING_METHOD'
:
ctx
.
obj
[
'binning-method'
],
'MEMTOTAL'
:
ctx
.
obj
[
'memtotal'
],
'MEMCORE'
:
ctx
.
obj
[
'memcore'
],
'THREADS'
:
ctx
.
obj
[
'threads'
],
'IMP_ASSEMBLER'
:
ctx
.
obj
[
'assembler'
],
'IMP_STEPS'
:
' '
.
join
(
steps
)
}
if
mg_data
:
if
mg_data
:
ev
[
'MG'
]
=
' '
.
join
(
mg_data
)
ev
[
'MG'
]
=
' '
.
join
(
mg_data
)
if
mt_data
:
if
mt_data
:
...
@@ -812,14 +814,12 @@ def analysis(ctx, data_dir, single_omics,
...
@@ -812,14 +814,12 @@ def analysis(ctx, data_dir, single_omics,
and
assembly_dir
.
files
(
'mt.reads.sorted.bam'
)):
and
assembly_dir
.
files
(
'mt.reads.sorted.bam'
)):
click
.
secho
(
"`Assembly directory` must contains mg and mt data. e.g: mgmt.assembly.merged.fa, mg.reads.sorted.bam, mg.reads.sorted.bam"
,
fg
=
'red'
,
bold
=
True
)
click
.
secho
(
"`Assembly directory` must contains mg and mt data. e.g: mgmt.assembly.merged.fa, mg.reads.sorted.bam, mg.reads.sorted.bam"
,
fg
=
'red'
,
bold
=
True
)
ctx
.
abort
()
ctx
.
abort
()
ev
=
ctx
.
obj
[
'environment'
]
ev
=
{
ev
[
'IMP_BINNING_METHOD'
]
=
ctx
.
obj
[
'binning-method'
]
'IMP_BINNING_METHOD'
:
ctx
.
obj
[
'binning-method'
],
ev
[
'MEMTOTAL'
]
=
ctx
.
obj
[
'memtotal'
]
'MEMTOTAL'
:
ctx
.
obj
[
'memtotal'
],
ev
[
'MEMCORE'
]
=
ctx
.
obj
[
'memcore'
]
'MEMCORE'
:
ctx
.
obj
[
'memcore'
],
ev
[
'THREADS'
]
=
ctx
.
obj
[
'threads'
]
'THREADS'
:
ctx
.
obj
[
'threads'
],
ev
[
'IMP_STEPS'
]
=
' '
.
join
(
steps
)
'IMP_STEPS'
:
' '
.
join
(
steps
)
}
if
mg_data
:
if
mg_data
:
ev
[
'MG'
]
=
' '
.
join
(
mg_data
)
ev
[
'MG'
]
=
' '
.
join
(
mg_data
)
if
mt_data
:
if
mt_data
:
...
@@ -922,13 +922,12 @@ def binning(ctx, data_dir, single_omics,
...
@@ -922,13 +922,12 @@ def binning(ctx, data_dir, single_omics,
if
single_omics
:
if
single_omics
:
mt_data
=
[]
mt_data
=
[]
ev
=
{
ev
=
ctx
.
obj
[
'environment'
]
'IMP_BINNING_METHOD'
:
ctx
.
obj
[
'binning-method'
],
ev
[
'IMP_BINNING_METHOD'
]
=
ctx
.
obj
[
'binning-method'
]
'MEMTOTAL'
:
ctx
.
obj
[
'memtotal'
],
ev
[
'MEMTOTAL'
]
=
ctx
.
obj
[
'memtotal'
]
'MEMCORE'
:
ctx
.
obj
[
'memcore'
],
ev
[
'MEMCORE'
]
=
ctx
.
obj
[
'memcore'
]
'THREADS'
:
ctx
.
obj
[
'threads'
],
ev
[
'THREADS'
]
=
ctx
.
obj
[
'threads'
]
'IMP_STEPS'
:
' '
.
join
(
steps
)
ev
[
'IMP_STEPS'
]
=
' '
.
join
(
steps
)
}
if
mg_data
:
if
mg_data
:
ev
[
'MG'
]
=
' '
.
join
(
mg_data
)
ev
[
'MG'
]
=
' '
.
join
(
mg_data
)
if
mt_data
:
if
mt_data
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment