CWL workflow: setting default for array of integer input
0
0
Entering edit mode
3.3 years ago
cole.shaw ▴ 20

Hello, I'm new to bioinformatics and the common workflow language. I could not find an answer to this question on the common workflow language user guide nor on this forum, and I appreciate any help or pointers to the right resources.

I'm creating a CWL workflow, and I have some steps that require an array of integer inputs. What is the syntax to specify default values for an array of integers? I have tried several things that all throw exceptions when I use cwltool to validate the workflow definition.

Input definition:

  pcs:
    type:
      type: array
      items: int
      label: 'Principal Components'

The step definition:

      in:
        data: output_data
        pcs:
          - 1
          - 2

Results in an error:

  checking field `in`
      checking object `test.yaml#test/pcs`
                         `source` field is int, expected string, list, or a dict.
                         `source` field is int, expected string, list, or a dict.

I have also tried variants like:

pcs: [1 2 3]

pcs: [1, 2, 3]

 pcs:
   1
   2
   3

 pcs: 1
 pcs: 2
 pcs: 3

All throw errors of some sort. I read this section in the guide on Maps, but that does not seem to help in this case.

Thanks for your help!

cwl input • 968 views
ADD COMMENT
1
Entering edit mode

cwl official support has moved to a new forum. Someone may answer here but you may want to post there as well.

ADD REPLY
1
Entering edit mode

Thanks, I was not aware of this!

ADD REPLY
0
Entering edit mode

Hello cole.shaw,

The concept you are trying to fill out is called WorkflowStepInput inside the WorkflowStep in the CWL reference specification https://www.commonwl.org/v1.0/Workflow.html#WorkflowStepInput & https://www.commonwl.org/v1.0/Workflow.html#WorkflowStep

So your key_field is the id of WorkflowStepInput, and if you don't use a map as the value then the value you provide gets evaluated as if it is the source field. Checking the definition of WorkflowStepInput we see that the default field may be helpful to you.

The default value for this parameter to use if either there is no source field, or the value produced by the source is null. The default must be applied prior to scattering or evaluating valueFrom.

So give this a try:

pcs:
  default: [1, 2, 3]
ADD REPLY
1
Entering edit mode

Thanks, got it to work! The pointer to the correct concept name for my mental map is very useful, thank you!

ADD REPLY

Login before adding your answer.

Traffic: 1413 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