Skip to content

About using hyphen as id #165

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

Merged
merged 2 commits into from
Sep 11, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 69 additions & 0 deletions _extras/miscellaneous.md
Original file line number Diff line number Diff line change
Expand Up @@ -170,3 +170,72 @@ outputs:
type: File
outputSource: first/txt
```

### CWL Paramter Reference error due to hyphen in input identifier

If `cwltool --validate` returns valid

```console
$ cwltool --validate cwl/qiime.cwl
INFO /usr/local/bin/cwltool 1.0.20190831161204
INFO Resolved 'cwl/qiime.cwl' to 'file:///workspace/cwl/qiime.cwl'
cwl/qiime.cwl is valid CWL.
```

But executing it causes an error like:

```console
$ cwltool cwl/qiime.cwl --sample-input metadata.tsv
INFO /usr/local/bin/cwltool 1.0.20190831161204
INFO Resolved 'cwl/qiime.cwl' to 'file:///workspace/cwl/qiime.cwl'
ERROR Workflow error, try again with --debug for more information:
cwl/qiime.cwl:14:5: Expression evaluation error:
Syntax error in parameter reference '(inputs.sample-input)'. This could be due
to using Javascript code without specifying InlineJavascriptRequirement.
```

The file is here

```cwl
cwlVersion: v1.0
class: CommandLineTool
baseCommand: [qiime, metadata, tabulate]
arguments:
- prefix: --m-input-file
valueFrom: $(inputs.sample-input)
inputs:
sample-input: File
outputs: []
```

Problem caused by `-` (hyphen charcter).

```cwl
valueFrom: $(inputs.sample-input)
# ^ this is problem
...

inputs:
sample-input: File
# ^ this is problem
```


Fix this error is change `-` (hyphen) to `_` (underscore)

```cwl
valueFrom: $(inputs.sample_input)
# ^ changed here

...

inputs:
sample_input: File
# ^ changed here
```

If is not possible to change the input identifier, then you can use an alternative CWL Parameter Reference syntax:

```cwl
valueFrom: $(inputs["sample-input"])
```