You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: _episodes/14-runtime.md
+21-7Lines changed: 21 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -4,16 +4,20 @@ teaching: 10
4
4
exercises: 0
5
5
questions:
6
6
- "How do I create required input files from input parameters at runtime?"
7
+
- "How do I invoke a script rather than just a simple command line?"
8
+
- "How do I make inputs available to my script?"
7
9
objectives:
8
10
- "Learn how to create files on the fly during runtime."
11
+
- "Learn how to use expressions in bash scripts."
9
12
keypoints:
10
13
- "Use `InitialWorkDirRequirement` to specify input files that need to be
11
14
created during tool runtime."
12
15
---
13
16
Sometimes you need to create a file on the fly from input parameters,
14
17
such as tools which expect to read their input configuration from a file
15
-
rather than the command line parameters. To do this, use
16
-
`InitialWorkDirRequirement`.
18
+
rather than the command line parameters, or need a small wrapper shell script.
19
+
20
+
To generate such files we can use the `InitialWorkDirRequirement`.
17
21
18
22
*createfile.cwl*
19
23
@@ -22,6 +26,12 @@ rather than the command line parameters. To do this, use
22
26
~~~
23
27
{: .source}
24
28
29
+
Any [expressions](../13-expressions/index.html) like `$(inputs.message)` are expanded by the CWL engine before creating the file; here inserting the value at the input `message`.
30
+
31
+
> **Tip:** The _CWL expressions_ are independent of any _shell variables_ used later during command line tool invocation. That means that any genuine need for the character `$` should be **_escaped** with `\`, for instance `\${PREFIX}` above is expanded to `${PREFIX}` in the generated file to be evaluated by the shell script instead of the CWL engine.
32
+
33
+
To test the above CWL tool use this job to provide the input value `message`:
34
+
25
35
*echo-job.yml*
26
36
27
37
~~~
@@ -34,22 +44,26 @@ command line:
34
44
35
45
~~~
36
46
$ cwl-runner createfile.cwl echo-job.yml
37
-
[job createfile.cwl] /home/example$ cat \
38
-
example.conf > /home/example/output.txt
47
+
[job createfile.cwl] /private/tmp/docker_tmphrqxxcdl$ sh \
0 commit comments