Default value for a `type: File` with `secondaryFiles`

Hello, I’m trying to set default file input for workflow step, but with secondaryFiles.

For now I’ve achieved working example without secondary (.tbi), but cannot fix this problem.

Working example:

steps:
  - id: S_vep
    in:
      - id: gdb
        default:
          class: File
          location: /mnt/gdb.vcf.gz

Tool part:

  - id: gdb
    type: File?
    inputBinding:
      position: 22
      prefix: --gdb
    secondaryFiles: [.tbi]

This results an error:

[workflow ] starting step S_vep
[step S_vep] start
Exception on step 'S_vep'.[0m
[step S_vep] Cannot make job: cwl_schema.yml:243:5: Missing required secondary file 'gdb.vcf.gz.tbi' from file object: {
cwl_schema.yml:243:5:     "class": "File",
cwl_schema.yml:243:5:     "location": "file:///mnt/gdb.vcf.gz",
cwl_schema.yml:243:5:     "basename": "gdb.vcf.gz",
cwl_schema.yml:243:5:     "nameroot": "gdb.vcf",
cwl_schema.yml:243:5:     "nameext": ".gz",
cwl_schema.yml:243:5:     "size": 620,
cwl_schema.yml:243:5:     "secondaryFiles": []
cwl_schema.yml:243:5: }.[0m
INFO.[0m [workflow ] completed permanentFail

I assume that the reason is missing secondaryFiles in workflow input, but if I add some - I’ve got more errors:

Variant 1:

steps:
  - id: S_vep
    in:
      - id: gdb
        default:
          class: File
          location: /mnt/gdb.vcf.gz
          secondaryFiles: [.tbi]

Error 1:

INFO.[0m [workflow ] starting step S_vep
INFO.[0m [step S_vep] start
ERROR.[0m .[31mException on step 'S_vep'.[0m
ERROR.[0m .[31m[step S_vep] Cannot make job: Invalid job input record:
the 'gdb' field is not valid because
cwl:133:11:   the
              'secondaryFiles'
              field is not valid
              because
                tried array of
                <File or Directory>
                but
cwl:133:28:       item is
                  invalid because
                    - tried
                    File but
                      Missing
                      'class' field
                    - tried
                    Directory but
                      Missing
                      'class' field.[0m
INFO.[0m [workflow ] completed permanentFail

Variant 2:

steps:
  - id: S_vep
    in:
      - id: gdb
        default:
          class: File
          location: /mnt/gdb.vcf.gz
        secondaryFiles: [.tbi]

Error 2:

ERROR. Tool definition failed validation:
cwl:1:1:     Object
           'cwl'
           is not valid because
             tried 'Workflow'
             but
cwl:99:1:       the 'steps'
               field is not valid
               because
                 tried array
                 of <WorkflowStep>
                 but
cwl:100:5:         item is
                   invalid because
cwl:101:5:           the 'in'
                     field is not valid
                     because
cwl:129:9:             item is
                       invalid because
cwl:133:9:
                         invalid field
                         'secondaryFiles',
                         expected one of:
                         'source',
                         'linkMerge', 'id',
                         'default',
                         'valueFrom'.

@mrc I’ve found workaround:

inputs:
  - id: WFI_gdb
    type: File
    default:
      class: File
      location: /mnt/gdb.vcf.gz
    secondaryFiles: [.tbi]
steps:
  - id: S_vep
    in:
      - id: gdb
        source: WFI_gdb

But still interested in solution inside workflow step (without workflow input).

Hello @Stikus .

The issue is the difference between specifying secondaryFiles on an input parameter (which uses the https://www.commonwl.org/v1.2/CommandLineTool.html#SecondaryFileSchema) and on a class: File real object (not a type: File specification): https://www.commonwl.org/v1.2/CommandLineTool.html#File.

For a class: File, the secondaryFiles field is an list of class: File and/or class: Directory objects themselves.

steps:
  - id: S_vep
    in:
      - id: gdb
        default:
          class: File
          location: file:///mnt/gdb.vcf.gz
          secondaryFiles:
            - class: File
              location: file:///mnt/gdb.vcf.tbi

(For portability reasons, it would be nicer to use a relative path instead of location,
path: ./gdb.vcf or path: ../gdb.vcf perhaps)