Commit 6829475f authored by aknecht2's avatar aknecht2
Browse files

Fixed new input type handling, testing in progress.

parent db6244b7
......@@ -18,7 +18,8 @@ bwa_align_paired:
- bwa_genome:
type: file
outputs:
- sam
- sam:
type: file
command: bwa
arguments:
- "mem":
......
......@@ -18,7 +18,8 @@ bwa_sai_to_sam:
- bwa_genome:
type: file
outputs:
- sam
- sam:
type: file
command: bwa
arguments:
- samse:
......
......@@ -112,10 +112,11 @@ class WorkflowJob(object):
if self.base[self.jobname][param_type] is not None:
if (len(param_list) == len(self.base[self.jobname][param_type])):
for i, param in enumerate(param_list):
# Only extension check against actual files
if not any([param["name"][-len(ext):] == ext if param["type"] == "file" else True for ext in chipathlon.conf.file_extensions[self.base[self.jobname][param_type][i]]]):
self.err += "File '%s' is not of type '%s'. Should match one of '%s' extensions.\n" % (param["name"], self.base[self.jobname][param_type][i], chipathlon.conf.file_extensions[self.base[self.jobname][param_type][i]])
valid_params = False
if param["type"] == "file":
# Only extension check against actual files
if not any([param["name"][-len(ext):] == ext if param["type"] == "file" else True for ext in chipathlon.conf.file_extensions[self.base[self.jobname][param_type][i].keys()[0]]]):
self.err += "File '%s' is not of type '%s'. Should match one of '%s' extensions.\n" % (param["name"], self.base[self.jobname][param_type][i].keys()[0], chipathlon.conf.file_extensions[self.base[self.jobname][param_type][i].keys()[0]])
valid_params = False
else:
self.err += "Number of file_names '%s' must match number of expected %s files.\n" % (len(param_list), param_type[:-1])
valid_params = False
......
......@@ -124,11 +124,12 @@ class WorkflowModule(object):
job_info = job_dict[job_name]
for param_type, param_list in zip(["inputs", "additional_inputs", "outputs"], [inputs, additional_files, output_files]):
if job_info[param_type] is not None:
for param in job_info[param_type]:
param_name = param.keys()[0]
for param_dict in job_info[param_type]:
param_name = param_dict.keys()[0]
param = param_dict[param_name]
if param["type"] == "file":
if param_name not in file_list and param_name not in output_files:
if prefix is None or self._get_full_name(prefix, markers, param_name) in master_files:
if param_name not in [x["name"] for x in param_list] and param_name not in [x["name"] for x in output_files]:
if prefix is None or self._get_full_name(prefix, markers, param_name) not in master_files:
param_list.append({"name": param_name, "type": "file"})
else:
param_list.append({"name": param_name, "type": "argument"})
......@@ -165,21 +166,23 @@ class WorkflowModule(object):
def _setup_param_list(self, master_files, job_info, param_type, param_dict, prefix, markers):
param_list = []
if job_info[param_type] is not None:
for param in job_info[param_type]:
for job_dict in job_info[param_type]:
param_name = job_dict.keys()[0]
param = job_dict[param_name]
if param["type"] == "file":
full_name = self._get_full_name(prefix, markers, param)
full_name = self._get_full_name(prefix, markers, param_name)
# If file is an output file, add to master_files
if param_type == "output":
if param_type == "outputs":
master_files[full_name] = File(full_name)
param_list.append({
"name": full_name if full_name in master_files else param_dict[param],
"file": master_files[full_name] if full_name in master_files else master_files[param_dict[param]],
"name": full_name if full_name in master_files else param_dict[param_name],
"file": master_files[full_name] if full_name in master_files else master_files[param_dict[param_name]],
"type": "file"
})
else:
param_list.append({
"name": param,
"value": param_dict[param],
"name": param_name,
"value": param_dict[param_name],
"type": "argument"
})
return param_list
......@@ -208,7 +211,6 @@ class WorkflowModule(object):
# will be easier later and not very costly
for file_dict in job_outputs:
master_jobs[file_dict["name"]] = job
master_jobs[prefix + "_" + self.name]
for file_dict in job_inputs:
if file_dict["name"] in master_jobs:
dax.depends(child = job, parent = master_jobs[file_dict["name"]])
......@@ -222,7 +224,7 @@ class WorkflowModule(object):
if valid:
data = module_params
for arg_params, param_key in zip([inputs, additional_files], ["inputs", "additional_files"]):
for file_dict in [arg_param for arg_param in arg_params if arg_param["type"] == "file"]:
for file_dict in [file_param for file_param in module_params[param_key] if file_param["type"] == "file"]:
file_name = file_dict["name"]
if file_name not in module_params[param_key]:
valid = False
......@@ -233,7 +235,7 @@ class WorkflowModule(object):
for param_dict in module_params[param_key]:
if param_dict["type"] == "file":
file_name = param_dict["name"]
if file_name not in arg_files:
if file_name not in arg_params:
valid = False
msg += "Error loading '%s' jobs. Required file '%s' for %s not defined.\n" % (self.name, file_name, param_key)
else:
......
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