Unable to create a custom File type

as described here;

https://www.commonwl.org/user_guide/19-custom-types/index.html

https://www.commonwl.org/v1.0/CommandLineTool.html#SchemaDefRequirement

I want to create a custom type that looks like this:

class: SchemaDefRequirement
types:
...
- name: RefFasta
  doc: reference genome .fasta file
  type: File
  secondaryFiles:
    - .amb
    - .ann
    - .bwt
    - .pac
    - .sa
    - .fai
    - ^.dict

However it seems that this does not work;

cwl/types.yml:2:1:                                                   the `types` field is not valid
                                                                     because
cwl/types.yml:73:3:                                                   item is invalid because
                                                     - tried CommandInputRecordSchema but
cwl/types.yml:75:3:                                                       * the `type` field is not
                                                                          valid because
                                                         the value 'File' is not a valid
                                                         enum_d9cba076fca539106791a4f46d198c7fcfbdb779, expected
                                                         'record'
cwl/types.yml:76:3:                                                       * invalid field
                                                                          `secondaryFiles`, expected
                                                       one of: 'fields', 'type', 'label', 'doc', 'name',
                                                       'inputBinding'
cwl/types.yml:73:3:                                                     - tried
                                                                        CommandInputEnumSchema but
                                                       * missing required field `symbols`
cwl/types.yml:75:3:                                                       * the `type` field is not
                                                                          valid because
                                                         the value 'File' is not a valid
                                                         enum_d961d79c225752b9fadb617367615ab176b47d77, expected
                                                         'enum'
cwl/types.yml:76:3:                                                       * invalid field
                                                                          `secondaryFiles`, expected
                                                       one of: 'symbols', 'type', 'label', 'doc', 'name',
                                                       'inputBinding'
cwl/types.yml:73:3:                                                     - tried
                                                                        CommandInputArraySchema but
                                                       * missing required field `items`
cwl/types.yml:75:3:                                                       * the `type` field is not
                                                                          valid because
                                                         the value 'File' is not a valid
                                                         enum_d062602be0b4b8fd33e69e29a841317b6ab665bc, expected
                                                         'array'
cwl/types.yml:76:3:                                                       * invalid field
                                                                          `secondaryFiles`, expected
                                                       one of: 'items', 'type', 'label', 'doc', 'name',
                                                       'inputBinding'

What is the problem with this custom type?

We use this definition for a reference genome fasta file, which requires many secondary files, and end up having to copy/paste this chunk of code every place that the file gets used, which is quite a lot of places.

Would be easier to just have it defined once and a single line can reference it everywhere else.

This is not currently part of the CWL standards, as shown in your link (sorry!)

https://www.commonwl.org/v1.0/CommandLineTool.html#SchemaDefRequirement

type: array<InputRecordSchema | InputEnumSchema | InputArraySchema>

means that only custom records and enums are supported in SchemaDefRequirement. Though I just noticed that arrays are listed, which doesn’t make sense as there is no id field. @tetron am I missing something?

I think your request makes sense, and it could be implemented for CWL v1.3. Can you open an issue at https://github.com/common-workflow-language/common-workflow-language/issues/new ?

In the mean time, you can put the following in a separate file named RefFasta.yaml and try type: [ $import: RefFasta.yaml ].

doc: reference genome .fasta file
type: File
secondaryFiles:
    - .amb
    - .ann
    - .bwt
    - .pac
    - .sa
    - .fai
    - ^.dict
1 Like

Thanks, PR opened here;

1 Like

You are welcome. Did the $import trick work for you?