Question: CWL: how to set default values
0
gravatar for bird77
2.1 years ago by
bird7720
bird7720 wrote:

How can I set default values for cwl files?

Here is my test.cwl file

cwlVersion: v1.0
class: CommandLineTool
baseCommand: echo
inputs:
  example_flag:
    type: boolean
    default: true
    inputBinding:
      position: 1
      prefix: -f
  example_string:
    type: string
    default: "abc"
    inputBinding:
      position: 3
      prefix: --example-string
  example_int:
    type: int
    default: 5
    inputBinding:
      position: 2
      prefix: -i
      separate: false
  example_file:
    type: File?
    inputBinding:
      prefix: --file=
      separate: false
      position: 4

outputs: []

With

$ dockstore tool convert cwl2json --cwl test.cwl

I get the following output

{
  "example_string": "fill me in",
  "example_file": {
    "path": "fill me in",
    "class": "File"
  },
  "example_flag": false,
  "example_int": 0
}

Where are the default values I set in the test.cwl file?

cwl common workflow language • 1.2k views
ADD COMMENTlink modified 2.0 years ago by denis.yuen90 • written 2.1 years ago by bird7720
3
gravatar for denis.yuen
2.0 years ago by
denis.yuen90
OICR
denis.yuen90 wrote:

As a heads-up, this is now a feature for Dockstore 1.1. You should be able to do the following

$ dockstore tool convert cwl2json --cwl test.cwl
{
  "example_string": "abc",
  "example_file": {
    "path": "fill me in",
    "class": "File"
  },
  "example_flag": true,
  "example_int": 5
}
$ dockstore tool convert cwl2yaml --cwl test.cwl
example_string: abc
example_file:
  path: fill me in
  class: File
example_flag: true
example_int: 5

$ dockstore tool convert cwl2yaml --cwl test.cwl > test.yaml
$ vim test.yaml
$ dockstore tool launch --entry test.cwl --local-entry --yaml test.yaml
ADD COMMENTlink written 2.0 years ago by denis.yuen90
3
gravatar for Michael R. Crusoe
2.1 years ago by
currently based out of Vilnius, Lithuania / Common Workflow Language project
Michael R. Crusoe1.1k wrote:

Hello,

if you want to use the default values for a particular input then do not list that parameter in your input document.

You could request the dockstore developers to include the default values when generating the template input document, or you could contribute that fix yourself. Additionally I would suggest that they generate YAML formatted input templates instead of JSON as they are easier to read and write.

ADD COMMENTlink written 2.1 years ago by Michael R. Crusoe1.1k

Bug posted: https://github.com/ga4gh/dockstore/issues/484

ADD REPLYlink written 2.1 years ago by bird7720

Issue closed on Nov 23, 2016

ADD REPLYlink written 23 months ago by bird7720
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1745 users visited in the last hour