Skip to content

add info on how outputBinding and glob works #353

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 14 commits into
base: main
Choose a base branch
from
45 changes: 45 additions & 0 deletions src/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,51 @@ The reference runner and several other CWL implementations support running
those Docker format containers using the Singularity engine. Directly
specifying a Singularity format container is not part of the CWL standards.

## How does glob work when describing output values?
The field outputBinding describes how to set the value of each output parameter. The 'glob' field specifies a pattern to find files/directories relative to the output directory. The pattern used for glob' must be either relative to the output directory, an absolute path to the output directory, or an absolute path to an input file.

CWL uses the POSIX glob(3) pathname matching. Wildcards are allowed in the glob field and are useful when If you don’t know the exact name of a file or directory in advance. The wildcard characters can either be an asterisk *, a question mark matching pathnames in directories. `?` or a range `[]`.

If an array used in the glob field, any files that match any pattern in the array are returned.

In the example below, the glob field is used to specify the file(`hello.txt`) in which the output should be stored.

```cwl
outputs:
example_out:
type: File
outputBinding:
glob: "hello.txt"
```

The glob field in the above output section can also be written with the `*` wildcard character as

```cwl
outputs:
example_out:
type: File
outputBinding:
glob: '*.txt'
```

Glob can also be used to return all files in the output directory. For example

```
outputs:
type: Directory
outputBinding: { glob: . }
```

OR

```
outputs:
type:
type: array
items: [Directory, File]
outputBinding: {glob: "*"}
```

## Debug JavaScript Expressions

You can use the <code>--js-console</code> option of <code>cwltool</code>, or you can try
Expand Down