Skip to content

Commit 676582f

Browse files
Made modifications to pages (#299)
* modified quick-start.md * Update prerequisites.md * Update basic-concepts.md * Update faq.md * Update yaml-guide.md Co-authored-by: Peter Amstutz <[email protected]>
1 parent 3b0e1a6 commit 676582f

File tree

4 files changed

+106
-51
lines changed

4 files changed

+106
-51
lines changed

src/faq.md

Lines changed: 61 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@ outputs:
4040
4141
## Rename an input file
4242
43-
This example shows how you can change the name of an input file
43+
This example demonstrates how to change the name of an input file
4444
as part of a tool description.
4545
This could be useful when you are taking files produced from another
46-
step in a workflow and don't want to work with the default names that these
46+
step in a workflow, and don't want to work with the default names that these
4747
files were given when they were created.
4848
4949
```yaml
@@ -58,7 +58,7 @@ requirements:
5858
5959
## Rename an output file
6060
61-
This example shows how you can change the name of an output file
61+
This example demonstrates how to change the name of an output file
6262
from the default name given to it by a tool:
6363
6464
```yaml
@@ -79,6 +79,61 @@ outputs:
7979
outputEval: ${self[0].basename=inputs.otu_table_name; return self;}
8080
```
8181
82+
## Referencing a local script
83+
84+
There are two ways to reference a local script:
85+
86+
The first method involves adding the folder containing your scripts to the `PATH` environment variable. This allows you to run the shell script without using `sh` or `bash` commands.
87+
88+
Start with adding a _shebang_ at the top of your file:
89+
90+
```{code-block}
91+
#!/bin/bash
92+
```
93+
94+
After that, make the script executable with the command `chmod +x scriptname.sh`
95+
96+
Finally, modify your `PATH` to add the directory where your script is located.
97+
(It is good practice to use `$HOME/bin` for storing your own scripts).
98+
99+
```bash
100+
export PATH=$PATH:/appropriate/directory
101+
```
102+
103+
Now you can use `baseCommand: scriptname.sh` to run the script directly.
104+
105+
```cwl
106+
#!/bin/bash
107+
cwlVersion: v1.0
108+
class: CommandLineTool
109+
baseCommand: scriptname.sh
110+
```
111+
112+
When you wish to share your work later, you can place your script in a software container in the Docker format.
113+
114+
The second method involves including an input of `type: File` in the script itself:
115+
116+
```cwl
117+
class: CommandLineTool
118+
119+
inputs:
120+
my_script:
121+
type: File
122+
inputBinding:
123+
position: 0
124+
125+
126+
# other inputs go here
127+
128+
baseCommand: sh
129+
130+
outputs: []
131+
```
132+
133+
```{note}
134+
In CWL, everything must be directly stated.
135+
```
136+
82137
## Setting `self`-based input bindings for optional inputs
83138

84139
Currently, `cwltool` can't cope with missing optional inputs if their
@@ -108,8 +163,8 @@ outputs: []
108163

109164
## Model a "one-or-the-other" parameter
110165

111-
Below is an example of how
112-
you can specify different strings to be added to a command line
166+
Below is an example showing how
167+
to specify different strings to be added to a command line,
113168
based on the value given to a Boolean parameter.
114169

115170
```yaml
@@ -265,7 +320,7 @@ For command-line flags that are either **mutually exclusive** or **dependent**,
265320
```
266321
## Setting Mutually Exclusive Parameters
267322

268-
In order to properly set fields in a record input type, you need to pass a dictionary to the input to properly set the parameters. This is done by using inline javascript and returning the dictionary with the key of the field you want to set. The source field is set to indicate the input from the workflow to be used as the value.
323+
To properly set fields in a record input type, you need to pass a dictionary to the input to properly set the parameters. This is done by using inline JavaScript and returning the dictionary with the key of the field you want to set. The source field is set to indicate the input from the workflow to be used as the value.
269324

270325
```yaml
271326
steps:

src/introduction/basic-concepts.md

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# Basic Concepts
22

3-
This section describes the basic concepts for users to get started working with
3+
This section describes the basic concepts for users to get started on working with
44
Common Workflow Language (CWL) workflows. Readers are expected to be familiar
5-
with workflow managers, YAML, and comfortable following instructions for the
6-
command-line. The other sections of the user guide cover the same concepts but
7-
in more detail. If you are already familiar with CWL or looking for more advanced
5+
with workflow managers, YAML, and comfortable with following instructions for the
6+
command-line. The other sections of the user guide cover the same concepts, but
7+
in more detail. If you are already familiar with CWL or you are looking for more advanced
88
content, you may want to skip this section.
99

1010
## The CWL specification
@@ -24,7 +24,7 @@ is the {{ cwl_version }}.
2424

2525
The specification version can have up to three numbers separated by `.`'s (dots).
2626
The first number is the major release, used for backward-incompatible changes like
27-
the removal of deprecated features. The second is the minor release number,
27+
the removal of deprecated features. The second number is the minor release,
2828
used for new features or smaller changes that are backward-compatible. The last number
2929
is used for bug fixes, like typos and other corrections to the specification.
3030

@@ -37,7 +37,7 @@ the end of this section to [learn more](#learn-more) about it.
3737
## Implementations
3838

3939
An implementation of the CWL specification is any software written following
40-
what is defined in a version of the specification document. Implementations may
40+
what is defined in a version of the specification document. However, implementations may
4141
not implement every aspect of the specification. CWL implementations are
4242
licensed under both Open Source and commercial licenses.
4343

@@ -47,6 +47,7 @@ in parallel across many nodes.
4747

4848
% TODO: add a link to the Core Concepts -> Requirements section below?
4949

50+
5051
```{graphviz}
5152
:name: specification-and-implementations-graph
5253
:caption: CWL specification, implementations, and other tools.
@@ -125,13 +126,13 @@ takes inputs and produces outputs like a command-line tool.
125126

126127
The workflow is a process that contains steps. Steps can be other
127128
workflows (nested workflows), command-line tools, or expression tools.
128-
The inputs of a workflow can be passed to any of its steps, and
129+
The inputs of a workflow can be passed to any of its steps, while
129130
the outputs produced by its steps can be used in the final output
130131
of the workflow.
131132

132133
Operation is an abstract process that also takes inputs, produces
133134
outputs, and can be used in a workflow. But it is a special operation
134-
not so commonly used. It is discussed in another section.
135+
not so commonly used. It is discussed in the [Operations section](../topics/operations.md) of this user guide.
135136

136137
The CWL specification allows for implementations to provide extra
137138
functionality and specify prerequisites to workflows through *requirements*.
@@ -149,12 +150,12 @@ runners.
149150

150151
Hints are similar to requirements, but while requirements list features
151152
that are required, hints list optional features. Requirements are explained
152-
in detail in another section.
153+
in detail in the [Requirements](../topics/requirements-and-hints.md) section.
153154

154155
## FAIR workflows
155156

156157
> The FAIR principles have laid a foundation for sharing and publishing
157-
> digital assets and, in particular, data. The FAIR principles emphasize
158+
> digital assets, and in particular, data. The FAIR principles emphasize
158159
> machine accessibility and that all digital assets should be Findable,
159160
> Accessible, Interoperable, and Reusable. Workflows encode the methods
160161
> by which the scientific process is conducted and via which data are
@@ -164,11 +165,11 @@ in detail in another section.
164165
> Workflows Community Initiative.
165166
166167
CWL has roots in "make" and many similar tools that determine order of
167-
execution based on dependencies between tasks. However, unlike "make", CWL
168+
execution, based on dependencies between tasks. However, unlike "make", CWL
168169
tasks are isolated, and you must be explicit about your inputs and outputs.
169170

170171
The benefit of explicitness and isolation are flexibility, portability, and
171-
scalability: tools and workflows described with CWL can transparently leverage
172+
scalability; tools and workflows described with CWL can transparently leverage
172173
technologies such as Docker and be used with CWL implementations from different
173174
vendors.
174175

src/introduction/prerequisites.md

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
# Prerequisites
22

3-
% This page supersedes the old setup.md. We used that page as reference while
3+
% This page supersedes the old setup page: setup.md. We used that page as a reference while
44
% writing this documentation.
55

66
The software and configurations listed in this section are prerequisites for
77
following this user guide. The CWL standards are implemented by many different
88
workflow runners and platforms. This list of requirements focuses on the CWL reference runner,
9-
`cwltool`. You can use another CWL compatible runner or workflow systems but the results and
9+
`cwltool`. You can use another CWL-compatible runner or workflow system, but the results and
1010
interface may look different (though the exact workflow outputs should be identical).
1111

1212
```{admonition} CWL Implementations
1313
14-
There are many implementations of the CWL standards. Some are complete CWL runners,
15-
others are plug-ins or extensions to workflow engines. We have a better
14+
There are many implementations of the CWL standards. Some are complete CWL runners, while
15+
others could be plug-ins or extensions to workflow engines. We have a better
1616
explanation in the [Implementations](basic-concepts.md#implementations) section.
1717
```
1818

@@ -26,7 +26,7 @@ of the following options for your operating system:
2626
- Windows
2727

2828
```{note}
29-
If you are using Windows, you will have to install the Windows Subsystem for Linux 2.
29+
If you are using Windows, you will have to install the [Windows Subsystem for Linux 2](https://learn.microsoft.com/en-us/windows/wsl/install) (WSL2).
3030
Visit the `cwltool` [documentation](https://github.com/common-workflow-language/cwltool/blob/main/README.rst#ms-windows-users)
3131
for details on installing WSL2.
3232
Your operating system also needs internet access and a recent version of Python (3.6+).
@@ -59,7 +59,7 @@ $ (venv) pip install cwltool
5959
```
6060

6161
```{note}
62-
You can find the `cwl-runner` source code [here](https://github.com/common-workflow-language/cwltool/tree/main/cwlref-runner).
62+
You can find the `cwl-runner` [source code](https://github.com/common-workflow-language/cwltool/tree/main/cwlref-runner) in the `cwltool` repository.
6363
Visit the `cwltool` [documentation](https://github.com/common-workflow-language/cwltool#install)
6464
for other ways to install `cwltool` with `apt` and `conda`.
6565
```
@@ -71,10 +71,10 @@ Let's use a simple CWl tool description `true.cwl` with `cwltool`.
7171
:name: true.cwl
7272
```
7373

74-
The `cwltool` command has an option to validate CWL tool and workflow descriptionss. It will parse the
75-
CWL document, look for syntax errors, and verify that the descriptions are compliant
76-
with the CWL standards, without running it. To validate CWL workflows (or even a
77-
standalone command line tool description like above) pass the `--validate` option
74+
The `cwltool` command has an option to validate CWL tool and workflow descriptions. This option will parse the
75+
CWL document, look for syntax errors, and verify that the workflow descriptions are compliant
76+
with the CWL standards. However, these actions will be performed without running the document. To validate CWL workflows (or even a
77+
standalone command line tool description like the above) pass the `--validate` option
7878
to the `cwltool` command:
7979

8080
```{runcmd} cwltool --validate true.cwl
@@ -91,7 +91,7 @@ You can run the CWL tool description by omitting the `--validate` option:
9191

9292
### cwl-runner Python module
9393

94-
`cwl-runner` is an implementation-agnostic alias for CWL Runners.
94+
`cwl-runner` is an implementation-agnostic alias for CWL Runners. This simply means that the `cwl-runner` alias command can be invoked independently, and is not reliant on a particular CWL runner.
9595
Users can invoke `cwl-runner` instead of invoking a CWL runner like `cwltool`
9696
directly. The `cwl-runner` alias command then chooses the correct CWL runner.
9797
This is convenient for environments with multiple CWL runners.
@@ -106,7 +106,7 @@ an alias for `cwltool` under the name `cwl-runner`
106106
$ pip install cwlref-runner
107107
```
108108

109-
Now you can validate and run your workflow with `cwl-runner` executable,
109+
Now you can validate and run your workflow with the `cwl-runner` executable,
110110
which will invoke `cwltool`. You should have the same results and output
111111
as in the previous section.
112112

@@ -120,9 +120,9 @@ as in the previous section.
120120
:caption: Running `true.cwl` with `cwl-runner`.
121121
```
122122

123-
Another way to execute `cwl-runner` is invoking the file directly. For that,
124-
the first thing you need to copy `true.cwl` workflow into a new file
125-
`true_shebang.cwl` and include a special first line, a *shebang*:
123+
Another way to execute `cwl-runner` is by invoking the file directly. For that,
124+
the first thing you need to do is copy `true.cwl` workflow into a new file:
125+
`true_shebang.cwl`, and include a special first line, a *shebang*:
126126

127127
```{literalinclude} /_includes/cwl/true_shebang.cwl
128128
:language: cwl
@@ -139,7 +139,7 @@ Now you can make the file `true_shebang.cwl` executable with `chmod u+x`.
139139
$ chmod u+x true.cwl
140140
```
141141

142-
And finally you can execute it directly in the command-line and the program
142+
And finally, you can execute it directly in the command-line. On execution, the program
143143
specified in the shebang (`cwl-runner`) will be used to execute the
144144
rest of the file.
145145

@@ -152,9 +152,8 @@ rest of the file.
152152
The *shebang* is the two-character sequence `#!` at the beginning of a
153153
script. When the script is executable, the operating system will execute
154154
the script using the executable specified after the shebang. It is
155-
considered a good practice to use `/usr/bin/env <executable>` since it
156-
looks for the `<executable>` program in the system `PATH`, instead of
157-
using a hard-coded location.
155+
considered a good practice to use `/usr/bin/env <executable>` rather than using a hard-coded location, since `/usr/bin/env <executable>`
156+
looks for the `<executable>` program in the system `PATH`,
158157
```
159158

160159
## Text Editor
@@ -164,7 +163,7 @@ an editor with YAML support. Popular editors are Visual Studio Code, Sublime,
164163
WebStorm, vim/neovim, and Emacs.
165164

166165
There are extensions for Visual Studio Code and WebStorm that provide
167-
integration with CWL, with customized syntax highlighting and better
166+
integration with CWL, and features such as customized syntax highlighting and better
168167
auto-complete:
169168

170169
- Visual Studio Code with the Benten (CWL) plugin - <https://github.com/rabix/benten#install-vs-code-extension>
@@ -182,7 +181,7 @@ Follow the instructions in the Docker documentation to install it for your
182181
operating system: <https://docs.docker.com/>.
183182

184183
You do not need to know how to write and build Docker containers. In the
185-
rest of the user guide we will use existing Docker images for running
184+
rest of the user guide, we will use existing Docker images for running
186185
examples, and to clarify the differences between the execution models
187186
with and without containers.
188187

src/topics/yaml-guide.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
[YAML][yaml] is a file format
77
designed to be readable by both computers and humans.
8-
This guide introduces the features of YAML
8+
This guide introduces the features of YAML that are
99
relevant when writing CWL descriptions and input parameter files.
1010

1111
```{note}
@@ -27,7 +27,7 @@ Fundamentally, a file written in YAML consists of a set of _key-value pairs_.
2727
Each pair is written as `key: value`,
2828
where whitespace after the `:` is required.
2929
Key names in CWL files should not contain whitespace -
30-
We use [_camelCase_][camelCase] for multi-word key names
30+
[_camelCase_][camelCase] is used for multi-word key names
3131
that have special meaning in the CWL specification
3232
and underscored key names otherwise.
3333
For example:
@@ -48,7 +48,7 @@ numeric (integer, floating point, or scientific representation),
4848
Boolean (`true` or `false`),
4949
or more complex nested types (see below).
5050

51-
Values may be wrapped in quotation marks
51+
Values may be wrapped in quotation marks,
5252
but be aware that this may change the way that they are interpreted
5353
i.e. `"1234"` will be treated as a character string
5454
, while `1234` will be treated as an integer.
@@ -80,7 +80,7 @@ be sure to add at least one space before the `#`!
8080

8181
When describing a tool or workflow with CWL,
8282
it is usually necessary to construct more complex, nested representations.
83-
Called _maps_,
83+
Referred to as _maps_,
8484
these hierarchical structures are described in YAML by providing
8585
additional key-value pairs as the value of any key.
8686
These pairs (sometimes referred to as "children") are written
@@ -101,7 +101,7 @@ inputs: # this key has an object value
101101
prefix: -f
102102
```
103103

104-
The YAML above illustrates how you can build up complex nested object
104+
The YAML above illustrates how to build up complex nested object
105105
descriptions relatively quickly.
106106
The `inputs` map contains a single key, `example_flag`,
107107
which itself contains two keys, `type` and `inputBinding`,
@@ -126,7 +126,7 @@ graph TD
126126

127127
## Arrays
128128

129-
In certain circumstances it is necessary to provide
129+
In certain circumstances, it is necessary to provide
130130
multiple values or objects for a single key.
131131
As we've already seen in the [Maps](#maps) section above,
132132
more than one key-value pair can be mapped to a single key.
@@ -166,8 +166,8 @@ exclusive_parameters:
166166

167167
## JSON Style
168168

169-
YAML is based on [JavaScript Object Notation (JSON)][json]
170-
and maps and arrays can also be defined in YAML using the native JSON syntax.
169+
YAML is based on [JavaScript Object Notation (JSON)][json].
170+
Maps and arrays can also be defined in YAML using the native JSON syntax.
171171
For example:
172172

173173
```yaml
@@ -182,13 +182,13 @@ inputs: {example_flag: {type: boolean, inputBinding: {position: 1, prefix: -f}}}
182182
```
183183
184184
Native JSON can be useful
185-
to indicate where a field is being left intentionally empty
185+
in indicating where a field is intentionally left empty
186186
(such as `[]` for an empty array),
187-
and where it makes more sense
187+
as well as where it makes more sense
188188
for the values to be located on the same line
189-
(such as when providing option flags and their values in a shell command).
189+
(For example, when providing option flags and their values in a shell command).
190190
However, as the second example above shows,
191-
it can severely affect the readability of a YAML file
191+
it can severely affect the readability of a YAML file,
192192
and should be used sparingly.
193193

194194
## Reference

0 commit comments

Comments
 (0)