Commit c6e9437f authored by khalid's avatar khalid
Browse files

Add a way to deal with more than one raw input

parent 9dbd5f9c
......@@ -136,9 +136,11 @@ def generate_workflow_params(pipeline, waw_dir = "./", workflowData = None):
template["content"].append(option)
if "input" in workflow:
raw_input = read_yaml(waw_dir + "raw_inputs/" + workflow["input"] + ".yaml")
for option in raw_input["options"]:
template["content"].append(option)
for raw in workflow["input"]:
#print(raw)
raw_input = read_yaml(waw_dir + "raw_inputs/" + raw + ".yaml")
for option in raw_input["options"]:
template["content"].append(option)
template["content"].append(
yaml.load("{name: memo, type: textArea, value: '', label: 'Text area for the user'}", Loader=yaml.FullLoader)
......
......@@ -71,9 +71,10 @@ def generate_tool_params(to_remove, waw_dir = "./"):
# input parameters
if "input" in WORKFLOW_YAML:
raw_inputs_yaml = read_yaml(os.path.join(waw_dir+"/raw_inputs/" + WORKFLOW_YAML["input"] + ".yaml"))
for option in raw_inputs_yaml["options"]:
TOOL_PARAMS[option["name"]] = option["value"] if ("value" in option.keys()) else ""
for raw_input in WORKFLOW_YAML["input"]:
raw_inputs_yaml = read_yaml(os.path.join(waw_dir+"/raw_inputs/" + raw_input + ".yaml"))
for option in raw_inputs_yaml["options"]:
TOOL_PARAMS[option["name"]] = option["value"] if ("value" in option.keys()) else ""
# For each step
for step_name, step_yaml in STEPS.items():
......@@ -108,10 +109,11 @@ def generate_params_info(to_remove, waw_dir = "./"):
# input parameters
if "input" in WORKFLOW_YAML:
raw_inputs_yaml = read_yaml(os.path.join(waw_dir+"/raw_inputs/" + WORKFLOW_YAML["input"] + ".yaml"))
for option in raw_inputs_yaml["options"]:
PARAMS_INFO[option["name"]] = collections.OrderedDict()
PARAMS_INFO[option["name"]]["type"] = option["type"]
for raw_input in WORKFLOW_YAML["input"]:
raw_inputs_yaml = read_yaml(os.path.join(waw_dir+"/raw_inputs/" + raw_input + ".yaml"))
for option in raw_inputs_yaml["options"]:
PARAMS_INFO[option["name"]] = collections.OrderedDict()
PARAMS_INFO[option["name"]]["type"] = option["type"]
# For each step
for step_name, step_yaml in STEPS.items():
......@@ -249,7 +251,8 @@ def generate_snakefile(workflow_yaml, waw_dir = "./"):
# import raw_input function
if "input" in WORKFLOW_YAML:
SNAKEFILE += "from "+WORKFLOW_YAML["input"]+" import "+WORKFLOW_YAML["input"]+"\n"
for raw_input in WORKFLOW_YAML["input"]:
SNAKEFILE += "from "+ raw_input +" import "+ raw_input+"\n"
# configure workdir (snakemake -d)
SNAKEFILE += "workdir: config['params']['results_dir']\n"
......@@ -427,7 +430,8 @@ def generate_pipeline_files(workflow_yaml, output_dir, waw_dir, local_config="de
shutil.copy(os.path.join(waw_dir+"/tools.py"), output_dir + "/files")
if "input" in WORKFLOW_YAML:
shutil.copy(os.path.join(waw_dir+"/raw_inputs/"+WORKFLOW_YAML["input"]+".py"), output_dir+"/files")
for raw_input in WORKFLOW_YAML["input"]:
shutil.copy(os.path.join(waw_dir+"/raw_inputs/"+raw_input+".py"), output_dir+"/files")
if (local_config != "default"):
local_config_data = read_yaml(local_config)
......
......@@ -72,11 +72,15 @@ def generate(name, path_yaml = "", path_input = DEFAULT_PATH_INPUT, path_output
result += "\n"
if "input" in yaml:
raw_inputs_yaml = read_yaml(path_input+"/raw_inputs/"+yaml["input"]+".yaml")
result += "# raw_inputs function call\n"
result += yaml["input"]+" = "+raw_inputs_yaml["function_call"]+"\n"
result += "config.update("+yaml["input"]+")\n"
result += "SAMPLES = "+yaml["input"]+"['samples']\n"
for raw_input in yaml["input"]:
raw_inputs_yaml = read_yaml(path_input+"/raw_inputs/"+raw_input+".yaml")
result += "# raw_inputs function call\n"
result += raw_input+" = "+raw_inputs_yaml["function_call"]+"\n"
result += "config.update("+raw_input+")\n"
# !!! possibilité de définir samples plusieurs fois si il y a raw_reads et raw_vcf ... !!!
# il faut vérifier que les samples sont les mêmes ?
if not raw_input.endswith("_index"):
result += "SAMPLES = "+raw_input+"['samples']\n"
result += "\n"
......
......@@ -34,8 +34,8 @@ if config["SeOrPe"] == "PE":
"-2 {input.read2} 2> {log} "
"| samtools view -b 2>> {log} "
"| samtools addreplacerg -r 'ID:WAW\tSM:{wildcards.sample}\tPL:ILLUMINA\tPI:200\tLB:LIB-1' -O BAM - "
"| samtools sort -@ {threads} > {output. bam} 2>> {log} &&"
"samtools index -@ {threads} {output. bam} 2>> {log}"
"| samtools sort -@ {threads} > {output.bam} 2>> {log} &&"
"samtools index -@ {threads} {output.bam} 2>> {log}"
elif config["SeOrPe"] == "SE":
......
......@@ -57,7 +57,7 @@
name: trimmomatic_fastaWithAdapters,
type: input_file,
value: "",
label: "(optional) fastaWithAdapters file for ILLUMINACLIP parameter",
label: "(optional leave blank to use default Illumina adapters) fastaWithAdapters file for ILLUMINACLIP parameter",
},
{
name: trimmomatic_illuminaAdapters,
......@@ -127,7 +127,7 @@
type: radio,
value: "TrueSeq3-",
choices: [TrueSeq3: TrueSeq3-, TrueSeq2: TrueSeq2-],
label: "Use adapter sequences provided for illumina ",
label: "Use adapter sequences provided for illumina",
},
{
name: trimmomatic_illuminaclip,
......
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