Commit 8b571480 authored by mmassaviol's avatar mmassaviol
Browse files

Add list type for rule input

parent 632ccd26
......@@ -54,17 +54,46 @@ def generate(name, path_yaml = "", path_input = DEFAULT_PATH_INPUT, path_output
for step in yaml["steps_in"]:
TOOL_YAML = read_yaml(path_input+"/tools/"+step["tool_name"]+"/"+step["tool_name"]+".yaml")
if "rule_name" in step:
# get rule yaml
inputs_list = list()
RULE_YAML = dict()
for command in TOOL_YAML["commands"]:
if command["name"] == step["rule_name"]:
RULE_YAML = command
# Parcourir le yaml du tool, les commandes et leurs inputs
# Traiter les inputs de type liste
# Gérer les from params (ex: fasta genomes)
result += "def " + step["step_name"] + "__" + step["rule_name"] + "_inputs():\n"
result += "\tinputs = dict()\n"
if "params" in step:
for param in step["params"]:
if "raw_" in param["origin_command"] :
result += "\tinputs[\"" + param["input_name"] + "\"] = " + param["origin_command"]+"[\""+param["origin_name"]+"\"]\n"
# get input yaml
INPUT_YAML = dict()
for inputt in RULE_YAML["inputs"]:
if inputt["name"] == param["input_name"]:
INPUT_YAML = inputt
if ("list" in INPUT_YAML and INPUT_YAML["list"]):
if param["input_name"] not in inputs_list:
inputs_list.append(param["input_name"])
result += "\tinputs[\"" + param["input_name"] + "\"] = list()\n"
if "raw_" in param["origin_command"] :
result += "\tinputs[\"" + param["input_name"] + "\"].append(" + param["origin_command"]+"[\""+param["origin_name"]+"\"])\n"
else:
result += "\tinputs[\"" + param["input_name"] + "\"].append(rules." + param["origin_step"] + "__" + param["origin_command"] + ".output." + param["origin_name"] + ")\n"
else:
result += "\tinputs[\"" + param["input_name"] + "\"] = rules." + param["origin_step"] + "__" + param["origin_command"] + ".output." + param["origin_name"] + "\n"
if "raw_" in param["origin_command"] :
result += "\tinputs[\"" + param["input_name"] + "\"] = " + param["origin_command"]+"[\""+param["origin_name"]+"\"]\n"
else:
result += "\tinputs[\"" + param["input_name"] + "\"] = rules." + param["origin_step"] + "__" + param["origin_command"] + ".output." + param["origin_name"] + "\n"
result += "\treturn inputs\n"
result += "\n"
......
Supports Markdown
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