diff --git a/chipathlon/conf.py b/chipathlon/conf.py index c185faa5a68734352ceae238adfb93bb55aca384..38c2691de5a1f183ae0990ab368588a9f704c0ef 100644 --- a/chipathlon/conf.py +++ b/chipathlon/conf.py @@ -51,7 +51,7 @@ resources = { argument_types = { "argument": ["argument"], "file": ["file", "stdout", "stderr"] -] +} # param keys param_keys = { diff --git a/chipathlon/jobs/modules/align.yaml b/chipathlon/jobs/modules/align.yaml index af41ae931931fd0796270984602e371ad82d0569..50157d4e100112f7b3b9a045228c94fd0263159b 100644 --- a/chipathlon/jobs/modules/align.yaml +++ b/chipathlon/jobs/modules/align.yaml @@ -91,7 +91,7 @@ align: type: file outputs: - align.sam: - type: stdout + type: file - align.quality: type: stderr paired[read_end]: @@ -120,7 +120,7 @@ align: type: file outputs: - align.sam: - type: stdout + type: file - align.quality: type: stderr - samtools_sam_to_bam: diff --git a/chipathlon/workflow_job.py b/chipathlon/workflow_job.py index c1e42425d1fec42511a4b023fd0a03ea40147413..bcf47da29e3e17d446e25fdc60748c9dfada6d80 100644 --- a/chipathlon/workflow_job.py +++ b/chipathlon/workflow_job.py @@ -197,16 +197,30 @@ class WorkflowJob(object): key, index = arg_info["default"].split(".") arg_list.append(arg) # We only add the file object if the passed argument is - # has type == file - arg_list.append(argument_map[key][int(index)]["file"] if argument_map[key][int(index)]["type"] == "file" else argument_map[key][int(index)]["value"]) + # has type == file. We don't want to process + # stdout / stderr arguments here. + if argument_map[key][int(index)]["type"] == "file": + arg_list.append(argument_map[key][int(index)]["file"]) + elif argument_map[key][int(index)]["type"] == "argument": + arg_list.append(argument_map[key][int(index)]["value"]) + else: + print "Error with argument '%s' for file %s. Check the yaml file." % (arg, self.jobname) + sys.exit(1) else: arg_list.append("%s %s" % (arg, arg_info["default"])) else: if not isinstance(arg, bool) and arg[:1] == "$": key, index = arg.split(".") - # We only add the file object if the passed argument is - # has type == file - arg_list.append(argument_map[key][int(index)]["file"] if argument_map[key][int(index)]["type"] == "file" else argument_map[key][int(index)]["value"]) + # We only add the file object if the passed argument + # has type == file. We don't want to process + # stdout / stderr arguments here. + if argument_map[key][int(index)]["type"] == "file": + arg_list.append(argument_map[key][int(index)]["file"]) + elif argument_map[key][int(index)]["type"] == "argument": + arg_list.append(argument_map[key][int(index)]["value"]) + else: + print "Error with argument '%s' for file %s. Check the yaml file." % (arg, self.jobname) + sys.exit(1) else: arg_list.append(arg) return arg_list diff --git a/chipathlon/workflow_module.py b/chipathlon/workflow_module.py index 90afc7ca0e06aa983cdf1822e30265f35d1d0c6c..8e2c01f8ed6bcd3f4da70ee301ae7ec13ea5485a 100644 --- a/chipathlon/workflow_module.py +++ b/chipathlon/workflow_module.py @@ -131,7 +131,7 @@ class WorkflowModule(object): param_name = param_dict.keys()[0] param = param_dict[param_name] # Make sure param is one of the file types - if param["type"] in conf.argument_types["file"]: + if param["type"] in chipathlon.conf.argument_types["file"]: 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"}) @@ -172,7 +172,7 @@ class WorkflowModule(object): for job_dict in job_info[param_type]: param_name = job_dict.keys()[0] param = job_dict[param_name] - if param["type"] in conf.argument_types["file"]: + if param["type"] in chipathlon.conf.argument_types["file"]: full_name = self._get_full_name(prefix, markers, param_name) # If file is an output file, add to master_files if param_type == "outputs": @@ -233,7 +233,7 @@ class WorkflowModule(object): } data = module_params for arg_params, param_key in zip([inputs, additional_files], ["inputs", "additional_files"]): - for file_dict in [file_param for file_param in module_params[param_key] if file_param["type"] in conf.argument_types["file"]]: + for file_dict in [file_param for file_param in module_params[param_key] if file_param["type"] in chipathlon.conf.argument_types["file"]]: file_name = file_dict["name"] if file_name not in module_params[param_key]: valid_params = False @@ -242,7 +242,7 @@ class WorkflowModule(object): valid_params = False msg += "Error loading '%s' jobs. File with name '%s', value '%s', does not exist in master_files.\n" % (self.name, file_name, arg_params[file_name]) for param_dict in module_params[param_key]: - if param_dict["type"] in conf.argument_types["file"]: + if param_dict["type"] in chipathlon.conf.argument_types["file"]: file_name = param_dict["name"] if file_name not in arg_params: valid_params = False