Skip to content
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

add info on how outputBinding and glob works #353

Open
wants to merge 14 commits into
base: main
Choose a base branch
from

Conversation

Fienne
Copy link
Contributor

@Fienne Fienne commented Dec 29, 2022

resolves #282

@swzCuroverse
Copy link
Contributor

swzCuroverse commented Jan 4, 2023

This looks like it just re-wrote and expanded a little bit about what already is in the user guide in the output section. I believe the request was to go a little bit deeper into how it works and why you use it. You can read the exchange linked from the ticket BUT-- in general it was to give information https://www.commonwl.org/v1.2/CommandLineTool.html#Output_binding here - and perhaps link to this accordingly.

I would keep what you have and go into more detail below about what glob does, which glob is used (and so you have restrictions based on that) and why you would use it. For motivation -- https://towardsdatascience.com/the-python-glob-module-47d82f4cbd2d

@swzCuroverse
Copy link
Contributor

swzCuroverse commented Jan 4, 2023

It also might nice be nice to look through biostars and other resources include a few more examples of using glob that are more complicated such as:
https://www.biostars.org/p/390453/
https://rabix.io/cwl-patterns.html (last entry)

Note glob can be used to return directories not just files/file arrays.

src/faq.md Outdated Show resolved Hide resolved
src/faq.md Outdated Show resolved Hide resolved
src/faq.md Outdated Show resolved Hide resolved
src/faq.md Show resolved Hide resolved
src/faq.md Outdated Show resolved Hide resolved
src/faq.md Outdated Show resolved Hide resolved
src/faq.md Outdated Show resolved Hide resolved
src/faq.md Show resolved Hide resolved
@swzCuroverse
Copy link
Contributor

@Fienne I think this looks good now but I think you need remove the entries from the FAQ renaming and just keep the glob related changes.

@Fienne Fienne force-pushed the how-does-outputbinding.glob-work branch from 9b1ee9a to f29e52a Compare January 26, 2023 14:03
@Fienne Fienne force-pushed the how-does-outputbinding.glob-work branch from f29e52a to 003bb64 Compare January 26, 2023 14:22
@Fienne
Copy link
Contributor Author

Fienne commented Jan 26, 2023

@swzCuroverse can you please check this out

src/faq.md Outdated Show resolved Hide resolved
src/faq.md Show resolved Hide resolved
@swzCuroverse
Copy link
Contributor

There is a nice conversation happening now in the matrix chat about the difference between . * and $(runtime.outdir)

@Fienne
Copy link
Contributor Author

Fienne commented Jan 27, 2023

Thank you, I noticed. I'm going through the chat

@swzCuroverse
Copy link
Contributor

swzCuroverse commented Feb 16, 2023

It looks like you just adding one of these but I think it would be good to show not just * as a glob example. Please include a few more from some of the examples I showed you -- for example something like *.gvcf, defining a directory the output is in, and something that uses the input name to find the output file.

You can look at the following places for examples:
https://github.com/common-workflow-library/bio-cwl-tools and search for glob
https://github.com/common-workflow-library/bio-cwl-tools/search?p=2&q=glob

## 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 `[]`.
Copy link
Contributor

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

Copy link
Contributor

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.

Copy link
Contributor

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

src/faq.md Outdated
untarfile:
type: File[]
outputBinding:
glob: "?a"
Copy link
Contributor

Choose a reason for hiding this comment

The 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

explain how outputBinding.glob works in more detail
2 participants