Commit ba96f06c authored by mmassaviol's avatar mmassaviol
Browse files

Update raw_inputs system

parent 21d6689b
......@@ -98,6 +98,12 @@ def generate_params(pipeline):
params_info[option["name"]] = collections.OrderedDict()
params_info[option["name"]]["type"] = option["type"]
if "input" in pipeline_config:
raw_inputs_yaml = read_yaml("./raw_inputs/"+pipeline_config["input"]+".yaml")
for option in raw_inputs_yaml["options"]:
params_info[option["name"]] = collections.OrderedDict()
params_info[option["name"]]["type"] = option["type"]
for step in pipeline_config["steps"]:
params["params"][step["name"]] = step["default"]
for tool in step["tools"]:
......
......@@ -55,6 +55,7 @@ def generate(name):
raw_inputs_yaml = read_yaml("./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"
#else : # OLD (to replace for all workflows with input raw_reads)
# result += "# Generic input functions\n"
......
......@@ -41,10 +41,11 @@ def raw_reads(results_dir, sample_dir, SeOrPe):
for sample in sorted(samples):
sampleTab.write("\n"+sample+"\t"+"\t".join(sorted(dicoSamples[sample])))
out = {'samples': sorted(samples), 'suffix': suffix, 'dico': dicoSamples}
out = {'samples': sorted(samples), 'sample_suffix': suffix, 'dico': dicoSamples}
if SeOrPe == "SE":
out ["read"] = os.path.join(sample_dir,"{sample}"+suffix)
out ["read2"] = ""
else:
out ["read"] = os.path.join(sample_dir,"{sample}"+PE_mark+"1"+suffix)
out ["read2"] = os.path.join(sample_dir,"{sample}"+PE_mark+"2"+suffix)
......
......@@ -20,6 +20,7 @@ config = config["params"]
# raw_inputs function call
raw_reads = raw_reads(config['results_dir'], config['sample_dir'], config['SeOrPe'])
config.update(raw_reads)
SAMPLES = raw_reads['samples']
# Tools inputs functions
......
......@@ -20,6 +20,7 @@ config = config["params"]
# raw_inputs function call
raw_long_reads = raw_long_reads(config['results_dir'], config['sample_dir'])
config.update(raw_long_reads)
SAMPLES = raw_long_reads['samples']
# Tools inputs functions
......
......@@ -20,6 +20,7 @@ config = config["params"]
# raw_inputs function call
raw_reads = raw_reads(config['results_dir'], config['sample_dir'], config['SeOrPe'])
config.update(raw_reads)
SAMPLES = raw_reads['samples']
# Tools inputs functions
......
......@@ -20,6 +20,7 @@ config = config["params"]
# raw_inputs function call
raw_reads = raw_reads(config['results_dir'], config['sample_dir'], config['SeOrPe'])
config.update(raw_reads)
SAMPLES = raw_reads['samples']
# Tools inputs functions
......
......@@ -20,6 +20,7 @@ config = config["params"]
# raw_inputs function call
raw_reads = raw_reads(config['results_dir'], config['sample_dir'], config['SeOrPe'])
config.update(raw_reads)
SAMPLES = raw_reads['samples']
# Tools inputs functions
......
......@@ -30,6 +30,7 @@ individus = get_individus()
# raw_inputs function call
raw_reads = raw_reads(config['results_dir'], config['sample_dir'], config['SeOrPe'])
config.update(raw_reads)
SAMPLES = raw_reads['samples']
## get reads (trimmed or raw)
......
......@@ -30,6 +30,7 @@ individus = get_individus()
# raw_inputs function call
raw_reads = raw_reads(config['results_dir'], config['sample_dir'], config['SeOrPe'])
config.update(raw_reads)
SAMPLES = raw_reads['samples']
## get reads (trimmed or raw)
......
......@@ -16,6 +16,7 @@ config = config["params"]
# raw_inputs function call
raw_reads = raw_reads(config['results_dir'], config['sample_dir'], config['SeOrPe'])
config.update(raw_reads)
SAMPLES = raw_reads['samples']
## get reads (trimmed or raw)
......
......@@ -7,7 +7,6 @@ import csv
# Wildcards #
#############
SAMPLES = config["samples"]
STEPS = config["steps"]
PREPARE_REPORT_OUTPUTS = config["prepare_report_outputs"]
PREPARE_REPORT_SCRIPTS = config["prepare_report_scripts"]
......@@ -19,28 +18,15 @@ config = config["params"]
# Inputs #
##########
# Generic input functions
## get raw_reads
def raw_reads():
inputs = dict()
if (config["SeOrPe"] == "PE"):
inputs["read"] = config['sample_dir']+'/{sample}_R1'+config["sample_suffix"]
inputs["read2"] = config['sample_dir']+'/{sample}_R2'+config["sample_suffix"]
elif (config["SeOrPe"] == "SE"):
inputs["read"] = config['sample_dir']+'/{sample}'+config["sample_suffix"]
else:
sys.exit("SeOrPe should be SE or PE")
return inputs
## get reads (trimmed or raw)
def reads():
return raw_reads()
# raw_inputs function call
raw_reads = raw_reads(config['results_dir'], config['sample_dir'], config['SeOrPe'])
config.update(raw_reads)
SAMPLES = raw_reads['samples']
# Tools inputs functions
def trimmomatic_inputs():
return raw_reads()
return raw_reads
def fastqc_inputs():
inputs = dict()
......
......@@ -4,6 +4,7 @@
description: ,
version: "0.0.1",
author: "MBB",
input: raw_reads,
steps:
[
{ title: Trimming, name: trimming, tools: [trimmomatic, "null"], default: "null" },
......@@ -22,25 +23,5 @@
label: "Results directory: ",
volumes: [Results: "/Results"]
},
{
name: "sample_dir",
type: "input_dir",
value: "/Data",
label: "Data directory: ",
volumes: [Data: "/Data", Results: "/Results"]
},
#{
# name: "sample_suffix",
# type: "text",
# value: ".fastq.gz",
# label: "Samples suffix: ",
#},
{
name: "SeOrPe",
type: "radio",
value: "PE",
choices: [Single end: SE, Paired end: PE],
label: "Single end reads (SE) or Paired end reads (PE): ",
},
],
}
\ No newline at end of file
......@@ -20,6 +20,7 @@ config = config["params"]
# raw_inputs function call
raw_reads = raw_reads(config['results_dir'], config['sample_dir'], config['SeOrPe'])
config.update(raw_reads)
SAMPLES = raw_reads['samples']
# Tools inputs functions
......
......@@ -20,6 +20,7 @@ config = config["params"]
# raw_inputs function call
raw_reads = raw_reads(config['results_dir'], config['sample_dir'], config['SeOrPe'])
config.update(raw_reads)
SAMPLES = raw_reads['samples']
# Tools inputs functions
......
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