Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
genotoul-bioinfo
jflow
Commits
da8e5fd1
Commit
da8e5fd1
authored
Oct 08, 2013
by
Jerome Mariette
Browse files
No commit message
No commit message
parent
45f7834e
Changes
3
Hide whitespace changes
Inline
Side-by-side
bin/jflow_cli.py
View file @
da8e5fd1
...
@@ -129,10 +129,15 @@ if __name__ == '__main__':
...
@@ -129,10 +129,15 @@ if __name__ == '__main__':
# create the subparser for each applications
# create the subparser for each applications
sub_parser
=
subparsers
.
add_parser
(
instance
.
name
,
help
=
instance
.
description
,
fromfile_prefix_chars
=
'@'
)
sub_parser
=
subparsers
.
add_parser
(
instance
.
name
,
help
=
instance
.
description
,
fromfile_prefix_chars
=
'@'
)
sub_parser
.
convert_arg_line_to_args
=
instance
.
__class__
.
config_parser
sub_parser
.
convert_arg_line_to_args
=
instance
.
__class__
.
config_parser
for
param
in
instance
.
parameters
:
parameters_groups
=
instance
.
get_parameters_per_groups
()
sub_parser
.
add_argument
(
param
.
flag
,
**
param
.
export_to_argparse
())
for
group
in
parameters_groups
:
sub_parser
.
set_defaults
(
cmd_object
=
instance
.
__class__
.
__name__
)
if
group
==
"default"
:
for
param
in
parameters_groups
[
group
]:
sub_parser
.
add_argument
(
param
.
flag
,
**
param
.
export_to_argparse
())
else
:
pgroup
=
sub_parser
.
add_argument_group
(
group
)
for
param
in
parameters_groups
[
group
]:
pgroup
.
add_argument
(
param
.
flag
,
**
param
.
export_to_argparse
())
args
=
vars
(
parser
.
parse_args
())
args
=
vars
(
parser
.
parse_args
())
if
args
[
"cmd_object"
]
in
wf_classes
:
if
args
[
"cmd_object"
]
in
wf_classes
:
...
...
src/jflow/parameter.py
View file @
da8e5fd1
...
@@ -72,7 +72,7 @@ class Parameter(object):
...
@@ -72,7 +72,7 @@ class Parameter(object):
"""
"""
def
__init__
(
self
,
name
,
help
,
flag
,
default
=
None
,
type
=
types
.
StringType
,
choices
=
None
,
def
__init__
(
self
,
name
,
help
,
flag
,
default
=
None
,
type
=
types
.
StringType
,
choices
=
None
,
required
=
False
,
action
=
"store"
,
sub_parameters
=
[]):
required
=
False
,
action
=
"store"
,
sub_parameters
=
[]
,
group
=
"default"
):
self
.
name
=
name
self
.
name
=
name
self
.
flag
=
flag
self
.
flag
=
flag
...
@@ -80,6 +80,8 @@ class Parameter(object):
...
@@ -80,6 +80,8 @@ class Parameter(object):
self
.
action
=
action
self
.
action
=
action
self
.
nargs
=
None
self
.
nargs
=
None
self
.
sub_parameters
=
sub_parameters
self
.
sub_parameters
=
sub_parameters
self
.
group
=
group
if
len
(
self
.
sub_parameters
)
>
0
:
if
len
(
self
.
sub_parameters
)
>
0
:
self
.
nargs
=
"+"
self
.
nargs
=
"+"
if
type
==
"date"
:
if
type
==
"date"
:
...
...
src/jflow/workflow.py
View file @
da8e5fd1
...
@@ -168,6 +168,15 @@ class Workflow(threading.Thread):
...
@@ -168,6 +168,15 @@ class Workflow(threading.Thread):
del
odict
[
'_Thread__stderr'
]
del
odict
[
'_Thread__stderr'
]
return
odict
return
odict
def
get_parameters_per_groups
(
self
):
parameters
=
{}
for
param
in
self
.
parameters
:
if
parameters
.
has_key
(
param
.
group
):
parameters
[
param
.
group
].
append
(
param
)
else
:
parameters
[
param
.
group
]
=
[
param
]
return
parameters
def
add_component
(
self
,
component_name
,
args
=
[],
kwargs
=
{},
component_prefix
=
"default"
):
def
add_component
(
self
,
component_name
,
args
=
[],
kwargs
=
{},
component_prefix
=
"default"
):
# first build and check if this component is OK
# first build and check if this component is OK
if
self
.
comp_pckg
.
has_key
(
component_name
):
if
self
.
comp_pckg
.
has_key
(
component_name
):
...
...
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