In CWL, how to make arrays optional input
1
0
Entering edit mode
7.8 years ago

How do I make an array optional input?

This works:

cwlVersion: v1.0
class: CommandLineTool

inputs:
  insertSize:
    type:
      type: array
      items: int
      inputBinding:
        prefix: -s
        separate: true
    inputBinding:
      position: 2

I want to make insertSize optional, but changing array into array? gives a long list of errors (pasted below).

What is the correct way to do this?

Error:

Tool definition failed validation: Validation error in object file:///mnt/mc3_tcga/pindel/pindel.cwl   Could not validate `CommandLineTool` because
    CommandLineTool record could not validate field `inputs` because
      At position 16
        could not validate field `type` because
          the value `{'inputBinding': {'prefix': '-s', 'separate': True},
           'items': 'int',
           'type': [u'null', 'array']}`
           is not a valid type in the union, expected one of:
          - null, but
             the value `{'inputBinding': {'prefix': '-s', 'separate': True},
             'items': 'int',
             'type': [u'null', 'array']}` is not null
          - CWLType, but
             the value `{'inputBinding': {'prefix': '-s', 'separate': True},
             'items': 'int',
             'type': [u'null', 'array']}`
             is not a valid symbol in enum CWLType, expected one of 'File', 'Directory'
          - CommandInputRecordSchema, but
             could not validate field `type` because
              the value `[u'null', 'array']`
               is not a valid symbol in enum Record_symbol, expected one of 'record'

            could not validate field `items` because it is not recognized and strict is True, valid fields are: fields, type, label
            could not validate field `inputBinding` because it is not recognized and strict is True, valid fields are: fields, type, label
          - CommandInputEnumSchema, but
             missing required field `symbols`
            could not validate field `type` because
              the value `[u'null', 'array']`
               is not a valid symbol in enum Enum_symbol, expected one of 'enum'

            could not validate field `items` because it is not recognized and strict is True, valid fields are: symbols, type, label, inputBinding
          - CommandInputArraySchema, but
             could not validate field `type` because
              the value `[u'null', 'array']`
               is not a valid symbol in enum Array_symbol, expected one of 'array'

          - string, but
             the value `{'inputBinding': {'prefix': '-s', 'separate': True},
             'items': 'int',
             'type': [u'null', 'array']}` is not string
          - array of <CWLType or CommandInputRecordSchema or CommandInputEnumSchema or CommandInputArraySchema or string>, but
             the value `{'inputBinding': {'prefix': '-s', 'separate': True},
             'items': 'int',
             'type': [u'null', 'array']}` is not a list, expected list of CWLType or CommandInputRecordSchema or CommandInputEnumSchema or CommandInputArraySchema or string
cwl • 2.7k views
ADD COMMENT
0
Entering edit mode
7.8 years ago

Setting

type: string[]?

makes it optional, but that only solves half the problem as it doesn't keep inputBinding

perhaps:

type:
- null
- type: array
  ...

I havn't tested it though

ADD COMMENT

Login before adding your answer.

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