How to set default elements of a record?
1
0
Entering edit mode
6.4 years ago
biokcb ▴ 170

Hi,

I would like to create a workflow that sets default parameters for certain parts of a record and take input from the user for other parts. I want to keep the tool such that the inputs can be changed, but just set defaults for one particular workflow. I'm using the trimmomatic types found here: https://github.com/common-workflow-language/workflows/tree/master/tools

For example, the tool trimmomatic.cwl takes a slidingWindow input as such:

trimmomatic-sliding_window.yaml

type: record
name: slidingWindow
fields:
 - name: windowSize
   type: int
 - name: requiredQuality
   type: int

If I want to set the default for windowSize for my workflow, but allow the user to specify the requiredQuality field in the workflow, how do I do this? I've tried using valueFrom in the step input itself to return a record type and setting defaults from the workflow level inputs, but I've gotten only errors even when the tool validates, so I'm not sure how to proceed. Is this even doable? Any suggestions are appreciated!

cwl • 1.3k views
ADD COMMENT
1
Entering edit mode
6.4 years ago

I suppose that you want to add this parameter to the command line somewhere. You can use arguments to add the desired default value if the original value is not set.

inputs:
  - id: window
    type:
      type: record
      fields:
        - name: windowSize
          type: int?
          inputBinding:
            position: 1
        - name: requiredQuality
          type: int
          inputBinding:
            position: 2
      name: window
    inputBinding:
      position: 0
arguments:
  - position: 1
    valueFrom: |-
      ${
          if(!inputs.window.windowSize) return 12345
          else return ''
      }
ADD COMMENT
0
Entering edit mode

Thank you for the response! I am actually trying to avoid setting the default within the command line tool itself, but rather set defaults for a particular workflow so the tool can remain flexible for use in other workflows with different settings, it just needs the adapter path to be flexible. Would this work to move it into the steps inputs section?

ADD REPLY

Login before adding your answer.

Traffic: 1076 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6