-
-
Notifications
You must be signed in to change notification settings - Fork 66
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
Fienne
wants to merge
14
commits into
common-workflow-language:main
Choose a base branch
from
Fienne:how-does-outputbinding.glob-work
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 13 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
d4d1871
add info on how outputBinding and glob works
Fienne 8902743
add wildcard characters
Fienne 70b85c0
add wildcard example
Fienne 4f4c763
more info on glob
Fienne d6e5142
more info on glob
Fienne 6ecaecd
more info on glob and examples
Fienne 9c9123d
edit information on glob
Fienne 003bb64
edit glob example
Fienne 3d70122
Merge branch 'main' into how-does-outputbinding.glob-work
Fienne 47ec637
modify info on glob and examples
Fienne cc2792b
modify info on glob and examples
Fienne b420ea5
add glob example
Fienne 8a4ee4d
Merge remote-tracking branch 'origin/how-does-outputbinding.glob-work…
Fienne 2e8d3db
add glob example
Fienne File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -447,6 +447,57 @@ 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. | ||
|
||
Fienne marked this conversation as resolved.
Show resolved
Hide resolved
|
||
In the example below, the glob field using the `*` wildcard is used to return all outputs from the tool. | ||
|
||
``` | ||
cwlVersion: v1.0 | ||
class: CommandLineTool | ||
inputs: | ||
in1: | ||
type: File | ||
default: | ||
class: File | ||
path: /path/to/my/file | ||
inputBinding: | ||
position: 1 | ||
|
||
baseCommand: cat | ||
|
||
outputs: | ||
my_output: | ||
type: | ||
type: array | ||
items: [Directory, File] | ||
outputBinding: | ||
glob: "*" | ||
``` | ||
|
||
In the following example, the wildcard `?` is used in the glob field to return all tools with the letter `a` in their pathname. | ||
|
||
``` | ||
cwlVersion: v1.0 | ||
class: CommandLineTool | ||
baseCommand: [tar, --extract] | ||
inputs: | ||
tarfile: | ||
type: File | ||
inputBinding: | ||
prefix: --file | ||
outputs: | ||
untarfile: | ||
type: File[] | ||
outputBinding: | ||
glob: "?a" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't believe this is correct -- I think ? is a single wild card where * is 1 or more wildcards? But you should double check |
||
|
||
``` | ||
|
||
Fienne marked this conversation as resolved.
Show resolved
Hide resolved
|
||
## Debug JavaScript Expressions | ||
|
||
You can use the <code>--js-console</code> option of <code>cwltool</code>, or you can try | ||
Fienne marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The wildcard characters can either be an asterisk
*
, a question mark matching pathnames in directories,?
, or a range[]
.i think this needs to be a comma
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
? does look like it works for a single character. Not sure about range, let me check.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok -- so glob[3] is for C library functions. glob[7] is for general Linux programming reference -- so we can use the rules for glob[7] https://man7.org/linux/man-pages/man7/glob.7.html