From ee8a85a3fea6987b26da3c5fa1856e1d15a956bd Mon Sep 17 00:00:00 2001
From: aknecht2 <aknecht2@unl.edu>
Date: Fri, 28 Apr 2017 13:24:04 -0500
Subject: [PATCH] Added job yaml file.  Updated workflow_job parsing to handle
 rawfolder argument.

---
 chipathlon/jobs/params/music_punctate.yaml | 89 ++++++++++++++++++++++
 chipathlon/workflow_job.py                 | 10 +++
 2 files changed, 99 insertions(+)
 create mode 100644 chipathlon/jobs/params/music_punctate.yaml

diff --git a/chipathlon/jobs/params/music_punctate.yaml b/chipathlon/jobs/params/music_punctate.yaml
new file mode 100644
index 0000000..6b12172
--- /dev/null
+++ b/chipathlon/jobs/params/music_punctate.yaml
@@ -0,0 +1,89 @@
+music_punctate:
+  inputs:
+    - name: prefix
+      type: string
+
+    - name: control.bed
+      type: file
+      file_type: bed
+
+    - name: signal.bed
+      type: file
+      file_type: bed
+  additional_inputs:
+    - name: mapp_inputs
+      type: list
+      file_type: bin
+  outputs:
+    - name: scale_129.bed
+      type: file
+      file_type: bed
+
+    - name: scale_194.bed
+      type: file
+      file_type: bed
+
+    - name: scale_291.bed
+      type: file
+      file_type: bed
+
+    - name: scale_437.bed
+      type: file
+      file_type: bed
+
+    - name: scale_656.bed
+      type: file
+      file_type: bed
+
+    - name: scale_985.bed
+      type: file
+      file_type: bed
+
+    - name: scale_1477.bed
+      type: file
+      file_type: bed
+
+    - name: scale_2216.bed
+      type: file
+      file_type: bed
+  command: run_music.py
+  arguments:
+    - "--prefix":
+        type: string
+        changeable: false
+        required: true
+        has_value: true
+        default: "$inputs.0"
+    - "--peak_type":
+        type: string
+        changeable: false
+        required: true
+        has_value: true
+        default: "punctate"
+    - "--controls":
+        type: file
+        changeable: false
+        required: true
+        has_value: true
+        default: "$inputs.1"
+    - "--signals":
+        type: file
+        changeable: false
+        required: true
+        has_value: true
+        default: "$inputs.2"
+    - "--mapp":
+        type: rawfolder
+        changeable: true
+        required: true
+        has_value: true
+    - "--lmapp":
+        type: numeric
+        changeable: true
+        required: true
+        has_value: true
+        default: 50
+  walltime: 240
+  memory: 16000
+  cores: 1
+  nodes: 1
diff --git a/chipathlon/workflow_job.py b/chipathlon/workflow_job.py
index 1bad4b5..36df2d9 100644
--- a/chipathlon/workflow_job.py
+++ b/chipathlon/workflow_job.py
@@ -294,9 +294,19 @@ class WorkflowJob(object):
             valid_arg, msg = self._is_valid_arg(arg_name, arg_info)
             if valid_arg:
                 # If the argument is a rawfile, add it to the raw_file list for use in the DAX
+                # This is for files that are on disk and need to be staged
                 if arg_info["type"] == "rawfile":
                     arg_value = self._get_arg_value(arg_name, arg_info)
                     self.raw_files[os.path.basename(arg_value)] = {"path": arg_value}
+                # Sometimes we have a folder full of files we need to include,
+                # in this case, use the rawfolder argument to stage all files
+                # within the folder.
+                elif arg_info["type"] == "rawfolder":
+                    arg_value = self._get_arg_value(arg_name, arg_info)
+                    for root, dirs, files in os.walk(arg_value):
+                        for f in files:
+                            self.raw_files[f] = {"path": "%s/%s" % (arg_value, f)}
+                        break
             else:
                 self.errors.append(msg)
         if self.params.get("arguments") is not None:
-- 
GitLab