Commit a321bd8b authored by Jerome Mariette's avatar Jerome Mariette
Browse files

add display_name option

parent ac12210e
......@@ -117,7 +117,8 @@ class JFlowServer (object):
"choices": param.choices,
"action": param.action,
"type": param.get_type(),
"name": param.name})
"name": param.name,
"display_name": param.display_name})
workflows.append({"name": instance.name,
"help": instance.description,
"class": instance.__class__.__name__,
......
......@@ -72,7 +72,7 @@ class Parameter(object):
"""
def __init__(self, name, help, flag, default=None, type=types.StringType, choices=None,
required=False, action="store", sub_parameters=[], group="default"):
required=False, action="store", sub_parameters=[], group="default", display_name=None):
self.name = name
self.flag = flag
......@@ -81,6 +81,9 @@ class Parameter(object):
self.nargs = None
self.sub_parameters = sub_parameters
self.group = group
if display_name == None:
self.display_name = name
else: self.display_name = display_name
if len(self.sub_parameters) > 0:
self.nargs = "+"
......
......@@ -328,6 +328,7 @@ class Workflow(threading.Thread):
else:
params[cparam][ckey] = cvalue
if cparam not in param_order: param_order.append(cparam)
for param_name in param_order:
sub_params, current_params, sub_objs = {}, {}, []
for param in params[param_name]:
......@@ -338,7 +339,10 @@ class Workflow(threading.Thread):
else:
sub_params[sub_params_values[0]][sub_params_values[1]] = params[param_name][param]
else:
if param == "name": current_params["display_name"] = params[param_name]["name"]
else: current_params[param] = params[param_name][param]
current_params[param] = params[param_name][param]
current_params["name"] = param_name
if sub_order.has_key(param_name):
for sub_param in sub_order[param_name]:
sub = Parameter(**sub_params[sub_param])
......@@ -349,7 +353,8 @@ class Workflow(threading.Thread):
except:
pass
# finally add the metadata parameter
metadata = Parameter(name="metadata", flag="--metadata", help="Which metadata should be linked to this workflow", action="append")
metadata = Parameter(name="metadata", flag="--metadata", help="Which metadata should be linked to this workflow",
action="append", display_name="Metadata")
parameters.append(metadata)
return [reader.get("global", "name"),
reader.get("global", "description"),
......
......@@ -208,7 +208,7 @@
// it the parameter has ne already been settled
' {{if Object.keys(parameters).indexOf(param.name) == -1 }}',
' <div class="control-group">',
' <label class="control-label">${param.name}</label>',
' <label class="control-label">${param.display_name}</label>',
' <div class="controls">',
// if it's a multiple choice parameter, add a select
' {{if param.choices}}',
......
......@@ -31,18 +31,18 @@ description = align reads against a reference genome
# .action [store]: the basic type of action to be taken (store|append)
#
[parameters]
read_1.name = read_1
read_1.name = Read 1
read_1.flag = --read-1
read_1.help = Which read1 files should be used
read_1.required = True
read_1.action = append
read_2.name = read_2
read_2.name = Read 2
read_2.flag = --read-2
read_2.help = Which read2 files should be used (if single end, leave empty)
read_2.action = append
reference_genome.name = reference_genome
reference_genome.name = Reference genome
reference_genome.flag = --reference-genome
reference_genome.help = Which genome should the read being align on
reference_genome.required = True
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment